59 lines
3.5 KiB
YAML
59 lines
3.5 KiB
YAML
|
name: FileTest
|
||
|
class_comment: '# * @requires extension fileinfo'
|
||
|
dependencies:
|
||
|
- name: TestCase
|
||
|
type: class
|
||
|
source: PHPUnit\Framework\TestCase
|
||
|
- name: FileNotFoundException
|
||
|
type: class
|
||
|
source: Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException
|
||
|
- name: File
|
||
|
type: class
|
||
|
source: Symfony\Component\HttpFoundation\File\File
|
||
|
properties: []
|
||
|
methods:
|
||
|
- name: testMoveWithNonLatinName
|
||
|
visibility: public
|
||
|
parameters:
|
||
|
- name: filename
|
||
|
- name: sanitizedFilename
|
||
|
comment: "# * @requires extension fileinfo\n# */\n# class FileTest extends TestCase\n\
|
||
|
# {\n# public function testGetMimeTypeUsesMimeTypeGuessers()\n# {\n# $file = new\
|
||
|
\ File(__DIR__.'/Fixtures/test.gif');\n# $this->assertEquals('image/gif', $file->getMimeType());\n\
|
||
|
# }\n# \n# public function testGuessExtensionWithoutGuesser()\n# {\n# $file =\
|
||
|
\ new File(__DIR__.'/Fixtures/directory/.empty');\n# $this->assertNull($file->guessExtension());\n\
|
||
|
# }\n# \n# public function testGuessExtensionIsBasedOnMimeType()\n# {\n# $file\
|
||
|
\ = new File(__DIR__.'/Fixtures/test');\n# $this->assertEquals('gif', $file->guessExtension());\n\
|
||
|
# }\n# \n# public function testConstructWhenFileNotExists()\n# {\n# $this->expectException(FileNotFoundException::class);\n\
|
||
|
# \n# new File(__DIR__.'/Fixtures/not_here');\n# }\n# \n# public function testMove()\n\
|
||
|
# {\n# $path = __DIR__.'/Fixtures/test.copy.gif';\n# $targetDir = __DIR__.'/Fixtures/directory';\n\
|
||
|
# $targetPath = $targetDir.'/test.copy.gif';\n# @unlink($path);\n# @unlink($targetPath);\n\
|
||
|
# copy(__DIR__.'/Fixtures/test.gif', $path);\n# \n# $file = new File($path);\n\
|
||
|
# $movedFile = $file->move($targetDir);\n# $this->assertInstanceOf(File::class,\
|
||
|
\ $movedFile);\n# \n# $this->assertFileExists($targetPath);\n# $this->assertFileDoesNotExist($path);\n\
|
||
|
# $this->assertEquals(realpath($targetPath), $movedFile->getRealPath());\n# \n\
|
||
|
# @unlink($targetPath);\n# }\n# \n# public function testMoveWithNewName()\n# {\n\
|
||
|
# $path = __DIR__.'/Fixtures/test.copy.gif';\n# $targetDir = __DIR__.'/Fixtures/directory';\n\
|
||
|
# $targetPath = $targetDir.'/test.newname.gif';\n# @unlink($path);\n# @unlink($targetPath);\n\
|
||
|
# copy(__DIR__.'/Fixtures/test.gif', $path);\n# \n# $file = new File($path);\n\
|
||
|
# $movedFile = $file->move($targetDir, 'test.newname.gif');\n# \n# $this->assertFileExists($targetPath);\n\
|
||
|
# $this->assertFileDoesNotExist($path);\n# $this->assertEquals(realpath($targetPath),\
|
||
|
\ $movedFile->getRealPath());\n# \n# @unlink($targetPath);\n# }\n# \n# public\
|
||
|
\ function testGetContent()\n# {\n# $file = new File(__FILE__);\n# \n# $this->assertStringEqualsFile(__FILE__,\
|
||
|
\ $file->getContent());\n# }\n# \n# public static function getFilenameFixtures()\n\
|
||
|
# {\n# return [\n# ['original.gif', 'original.gif'],\n# ['..\\\\..\\\\original.gif',\
|
||
|
\ 'original.gif'],\n# ['../../original.gif', 'original.gif'],\n# ['\u0444\u0430\
|
||
|
\u0439\u043Bfile.gif', '\u0444\u0430\u0439\u043Bfile.gif'],\n# ['..\\\\..\\\\\u0444\
|
||
|
\u0430\u0439\u043Bfile.gif', '\u0444\u0430\u0439\u043Bfile.gif'],\n# ['../../\u0444\
|
||
|
\u0430\u0439\u043Bfile.gif', '\u0444\u0430\u0439\u043Bfile.gif'],\n# ];\n# }\n\
|
||
|
# \n# /**\n# * @dataProvider getFilenameFixtures"
|
||
|
- name: testMoveToAnUnexistentDirectory
|
||
|
visibility: public
|
||
|
parameters: []
|
||
|
comment: null
|
||
|
traits:
|
||
|
- PHPUnit\Framework\TestCase
|
||
|
- Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException
|
||
|
- Symfony\Component\HttpFoundation\File\File
|
||
|
interfaces: []
|