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
a5736e03
Unverified
Commit
a5736e03
authored
Sep 26, 2017
by
Nicolas Widart
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Testing it can delete a non image file in root and subfolder
parent
00f3b8c6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
0 deletions
+29
-0
ImagyTest.php
Modules/Media/Tests/ImagyTest.php
+29
-0
No files found.
Modules/Media/Tests/ImagyTest.php
View file @
a5736e03
...
...
@@ -144,6 +144,35 @@ class ImagyTest extends MediaTestCase
$this
->
assertCount
(
0
,
$this
->
app
[
'files'
]
->
allFiles
(
$path
));
}
/** @test */
public
function
it_can_delete_a_non_image_file
()
{
$this
->
resetDatabase
();
$file
=
\Illuminate\Http\UploadedFile
::
fake
()
->
create
(
'my-file.pdf'
);
$file
=
app
(
FileService
::
class
)
->
store
(
$file
);
$this
->
assertCount
(
1
,
$this
->
app
[
'files'
]
->
allFiles
(
public_path
(
config
(
'asgard.media.config.files-path'
))));
$this
->
imagy
->
deleteAllFor
(
$file
);
$this
->
assertCount
(
0
,
$this
->
app
[
'files'
]
->
allFiles
(
public_path
(
config
(
'asgard.media.config.files-path'
))));
}
/** @test */
public
function
it_can_delete_a_non_image_file_on_subdirectory
()
{
$this
->
resetDatabase
();
app
(
FolderRepository
::
class
)
->
create
([
'name'
=>
'My Folder'
,
'parent_id'
=>
0
]);
$file
=
\Illuminate\Http\UploadedFile
::
fake
()
->
create
(
'my-file.pdf'
);
$file
=
app
(
FileService
::
class
)
->
store
(
$file
,
1
);
$path
=
public_path
(
config
(
'asgard.media.config.files-path'
)
.
'my-folder/'
);
$this
->
assertCount
(
1
,
$this
->
app
[
'files'
]
->
allFiles
(
$path
));
$this
->
imagy
->
deleteAllFor
(
$file
);
$this
->
assertCount
(
0
,
$this
->
app
[
'files'
]
->
allFiles
(
$path
));
}
/** @test */
public
function
it_should_return_same_path_for_non_images
()
{
...
...
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