Skip to content
Next
Projects
Groups
Snippets
Help
Sign in / Register
Toggle navigation
Minds Backend - Engine
Project
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
Issues
290
Merge Requests
40
CI / CD
Security & Compliance
Packages
Wiki
Snippets
Members
Collapse sidebar
Close sidebar
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Minds
Minds Backend - Engine
Commits
cba0d53b
Commit
cba0d53b
authored
29 minutes ago
by
Marcelo Rivera
Browse files
Options
Download
(fix): spec tests
parent
24d1a927
No related merge requests found
Pipeline
#93550785
failed with stages
in 6 minutes and 20 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
89 additions
and
3 deletions
+89
-3
Spec/Core/Media/Image/ManagerSpec.php
View file @
cba0d53b
...
...
@@ -33,6 +33,7 @@ class ManagerSpec extends ObjectBehavior
{
$activity
=
new
Activity
();
$activity
->
set
(
'entity_guid'
,
123
);
$activity
->
set
(
'access_id'
,
ACCESS_PRIVATE
);
$this
->
config
->
get
(
'cdn_url'
)
->
willReturn
(
'https://minds.dev/'
);
$uri
=
'https://minds.dev/fs/v1/thumbnail/123/xlarge'
;
...
...
@@ -42,10 +43,22 @@ class ManagerSpec extends ObjectBehavior
->
shouldBe
(
'signed url will be here'
);
}
public
function
it_should_return_unsigned_public_asset_uri
()
{
$activity
=
new
Activity
();
$activity
->
set
(
'entity_guid'
,
123
);
$activity
->
set
(
'access_id'
,
ACCESS_PUBLIC
);
$this
->
config
->
get
(
'cdn_url'
)
->
willReturn
(
'https://minds.dev/'
);
$this
->
getPublicAssetUri
(
$activity
)
->
shouldBe
(
'https://minds.dev/fs/v1/thumbnail/123/xlarge'
);
}
public
function
it_should_return_public_asset_uri_for_image
()
{
$entity
=
new
Image
();
$entity
->
set
(
'guid'
,
123
);
$entity
->
set
(
'access_id'
,
ACCESS_PRIVATE
);
$this
->
config
->
get
(
'cdn_url'
)
->
willReturn
(
'https://minds.dev/'
);
$uri
=
'https://minds.dev/fs/v1/thumbnail/123/xlarge'
;
...
...
@@ -55,10 +68,21 @@ class ManagerSpec extends ObjectBehavior
->
shouldBe
(
'signed url will be here'
);
}
public
function
it_should_return_an_unsigned_url_for_an_image
()
{
$entity
=
new
Image
();
$entity
->
set
(
'guid'
,
123
);
$entity
->
set
(
'access_id'
,
ACCESS_PUBLIC
);
$this
->
config
->
get
(
'cdn_url'
)
->
willReturn
(
'https://minds.dev/'
);
$this
->
getPublicAssetUri
(
$entity
)
->
shouldBe
(
'https://minds.dev/fs/v1/thumbnail/123/xlarge'
);
}
public
function
it_should_return_public_asset_uri_for_video
()
{
$entity
=
new
Video
();
$entity
->
set
(
'guid'
,
123
);
$entity
->
set
(
'access_id'
,
ACCESS_PRIVATE
);
$this
->
config
->
get
(
'cdn_url'
)
->
willReturn
(
'https://minds.dev/'
);
$uri
=
'https://minds.dev/fs/v1/thumbnail/123/xlarge'
;
...
...
@@ -68,6 +92,19 @@ class ManagerSpec extends ObjectBehavior
->
shouldBe
(
'signed url will be here'
);
}
public
function
it_should_return_unsigned_public_asset_uri_for_video
()
{
$entity
=
new
Video
();
$entity
->
set
(
'guid'
,
123
);
$entity
->
set
(
'access_id'
,
ACCESS_PUBLIC
);
$this
->
config
->
get
(
'cdn_url'
)
->
willReturn
(
'https://minds.dev/'
);
$uri
=
'https://minds.dev/fs/v1/thumbnail/123/xlarge'
;
$this
->
getPublicAssetUri
(
$entity
)
->
shouldBe
(
'https://minds.dev/fs/v1/thumbnail/123/xlarge'
);
}
public
function
it_should_return_public_asset_uri_for_comment
()
{
$entity
=
new
Comment
();
...
...
@@ -80,4 +117,15 @@ class ManagerSpec extends ObjectBehavior
$this
->
getPublicAssetUri
(
$entity
)
->
shouldBe
(
'signed url will be here'
);
}
public
function
it_should_return_unsigned_public_asset_uri_for_comment
()
{
$entity
=
new
Comment
();
$entity
->
setAttachment
(
'attachment_guid'
,
'123'
);
$entity
->
access_id
=
ACCESS_PUBLIC
;
$this
->
config
->
get
(
'cdn_url'
)
->
willReturn
(
'https://minds.dev/'
);
$this
->
getPublicAssetUri
(
$entity
)
->
shouldBe
(
'https://minds.dev/fs/v1/thumbnail/123/xlarge'
);
}
}
This diff is collapsed.
Spec/Core/Media/Video/ManagerSpec.php
View file @
cba0d53b
...
...
@@ -27,7 +27,7 @@ class ManagerSpec extends ObjectBehavior
$this
->
shouldHaveType
(
Manager
::
class
);
}
public
function
it_should_get_a_
720p_video
(
RequestInterface
$request
,
\Aws\CommandInterface
$cmd
)
public
function
it_should_get_a_
signed_720p_video_url
(
RequestInterface
$request
,
\Aws\CommandInterface
$cmd
)
{
$this
->
config
->
get
(
'transcoder'
)
->
willReturn
([
...
...
@@ -39,22 +39,60 @@ class ManagerSpec extends ObjectBehavior
'useRoles'
=>
true
,
]);
$this
->
config
->
get
(
'cinemr_url'
)
->
willReturn
(
'https://url.com/cinemr'
);
$this
->
s3
->
getCommand
(
'GetObject'
,
[
'Bucket'
=>
'cinemr'
,
'Key'
=>
'dir/123/720.mp4'
])
->
shouldBeCalled
()
->
willReturn
(
$cmd
);
$request
->
getUri
()
->
willReturn
(
's3-signed-url-here'
);
$this
->
s3
->
createPresignedRequest
(
Argument
::
any
(),
Argument
::
any
())
->
willReturn
(
$request
);
$video
=
new
Video
();
$video
->
set
(
'cinemr_guid'
,
123
);
$video
->
set
(
'access_id'
,
ACCESS_PRIVATE
);
$this
->
getPublicAssetUri
(
$video
,
'720.mp4'
)
->
shouldBe
(
's3-signed-url-here'
);
}
public
function
it_should_get_an_unsigned_720p_video_url
(
RequestInterface
$request
,
\Aws\CommandInterface
$cmd
)
{
$this
->
config
->
get
(
'transcoder'
)
->
willReturn
([
'dir'
=>
'dir'
,
]);
$this
->
config
->
get
(
'aws'
)
->
willReturn
([
'region'
=>
'us-east-1'
,
'useRoles'
=>
true
,
]);
$this
->
config
->
get
(
'cinemr_url'
)
->
willReturn
(
'https://url.com/cinemr'
);
$this
->
s3
->
getCommand
(
'GetObject'
,
[
'Bucket'
=>
'cinemr'
,
'Key'
=>
'dir/123/720.mp4'
])
->
shouldBeCalled
()
->
willReturn
(
$cmd
);
$request
->
getUri
()
->
willReturn
(
's3-signed-url-here'
);
$this
->
s3
->
createPresignedRequest
(
Argument
::
any
(),
Argument
::
any
())
->
willReturn
(
$request
);
$video
=
new
Video
();
$video
->
set
(
'cinemr_guid'
,
123
);
$this
->
getPublicAssetUri
(
$video
,
'720.mp4'
)
->
shouldBe
(
'https://url.com/cinemr123/720.mp4'
);
}
}
This diff is collapsed.
Please
register
or
sign in
to comment