Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Platform
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Platform
Commits
6df250a4
Unverified
Commit
6df250a4
authored
Sep 22, 2017
by
Nicolas Widart
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Testing the file service
parent
579c15c3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
51 additions
and
0 deletions
+51
-0
FileServiceTest.php
Modules/Media/Tests/FileServiceTest.php
+51
-0
No files found.
Modules/Media/Tests/FileServiceTest.php
0 → 100644
View file @
6df250a4
<?php
namespace
Modules\Media\Tests
;
use
Modules\Media\Services\FileService
;
final
class
FileServiceTest
extends
MediaTestCase
{
/**
* @var FileService
*/
private
$fileService
;
public
function
setUp
()
{
parent
::
setUp
();
$this
->
resetDatabase
();
$this
->
fileService
=
app
(
FileService
::
class
);
$this
->
app
[
'config'
]
->
set
(
'asgard.media.config.files-path'
,
'/assets/media/'
);
}
public
function
tearDown
()
{
if
(
$this
->
app
[
'files'
]
->
isDirectory
(
public_path
(
'assets'
))
===
true
)
{
$this
->
app
[
'files'
]
->
deleteDirectory
(
public_path
(
'assets'
));
}
}
/** @test */
public
function
it_creates_a_file_on_disk
()
{
$file
=
\Illuminate\Http\UploadedFile
::
fake
()
->
image
(
'my-file.jpg'
);
$this
->
fileService
->
store
(
$file
);
$this
->
assertTrue
(
$this
->
app
[
'files'
]
->
isDirectory
(
public_path
(
'assets/media'
)));
$this
->
assertTrue
(
$this
->
app
[
'files'
]
->
exists
(
public_path
(
'assets/media/my-file.jpg'
)));
}
/** @test */
public
function
it_creates_file_thumbnails_on_disk
()
{
$file
=
\Illuminate\Http\UploadedFile
::
fake
()
->
image
(
'my-file.jpg'
);
$this
->
fileService
->
store
(
$file
);
$this
->
assertTrue
(
$this
->
app
[
'files'
]
->
isDirectory
(
public_path
(
'assets/media'
)));
$this
->
assertTrue
(
$this
->
app
[
'files'
]
->
exists
(
public_path
(
'assets/media/my-file_smallThumb.jpg'
)));
$this
->
assertTrue
(
$this
->
app
[
'files'
]
->
exists
(
public_path
(
'assets/media/my-file_mediumThumb.jpg'
)));
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment