Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
PSDI Army
yii2
Commits
a5480de8
Commit
a5480de8
authored
Jun 10, 2013
by
Klimov Paul
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test case "FileHelperTest::testGetMimeTypeByExtension()" has been added.
parent
8f7a7837
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
0 deletions
+18
-0
FileHelperTest.php
tests/unit/framework/helpers/FileHelperTest.php
+18
-0
No files found.
tests/unit/framework/helpers/FileHelperTest.php
View file @
a5480de8
...
@@ -278,4 +278,21 @@ class FileHelperTest extends TestCase
...
@@ -278,4 +278,21 @@ class FileHelperTest extends TestCase
FileHelper
::
mkdir
(
$dirName
,
null
,
true
);
FileHelper
::
mkdir
(
$dirName
,
null
,
true
);
$this
->
assertTrue
(
file_exists
(
$dirName
),
'Unable to create directory recursively!'
);
$this
->
assertTrue
(
file_exists
(
$dirName
),
'Unable to create directory recursively!'
);
}
}
public
function
testGetMimeTypeByExtension
()
{
$magicFile
=
$this
->
testFilePath
.
DIRECTORY_SEPARATOR
.
'mime_type.php'
;
$mimeTypeMap
=
array
(
'txa'
=>
'application/json'
,
'txb'
=>
'another/mime'
,
);
$magicFileContent
=
'<?php return '
.
var_export
(
$mimeTypeMap
,
true
)
.
';'
;
file_put_contents
(
$magicFile
,
$magicFileContent
);
foreach
(
$mimeTypeMap
as
$extension
=>
$mimeType
)
{
$fileName
=
'test.'
.
$extension
;
$this
->
assertNull
(
FileHelper
::
getMimeTypeByExtension
(
$fileName
));
$this
->
assertEquals
(
$mimeType
,
FileHelper
::
getMimeTypeByExtension
(
$fileName
,
$magicFile
));
}
}
}
}
\ No newline at end of file
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