[HttpFoundation] Fix FileException checking in FileTest
This commit is contained in:
parent
f8cc8a7deb
commit
907e693350
@ -13,6 +13,7 @@ namespace Symfony\Tests\Component\HttpFoundation\File;
|
|||||||
|
|
||||||
use Symfony\Component\HttpFoundation\File\File;
|
use Symfony\Component\HttpFoundation\File\File;
|
||||||
use Symfony\Component\HttpFoundation\File\MimeType\MimeTypeGuesser;
|
use Symfony\Component\HttpFoundation\File\MimeType\MimeTypeGuesser;
|
||||||
|
use Symfony\Component\HttpFoundation\File\Exception\FileException;
|
||||||
|
|
||||||
class FileTest extends \PHPUnit_Framework_TestCase
|
class FileTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
@ -94,8 +95,6 @@ class FileTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
public function testSizeFailing()
|
public function testSizeFailing()
|
||||||
{
|
{
|
||||||
$this->setExpectedException('Symfony\Component\HttpFoundation\File\Exception\FileException');
|
|
||||||
|
|
||||||
$dir = __DIR__.DIRECTORY_SEPARATOR.'Fixtures'.DIRECTORY_SEPARATOR.'directory';
|
$dir = __DIR__.DIRECTORY_SEPARATOR.'Fixtures'.DIRECTORY_SEPARATOR.'directory';
|
||||||
$path = $dir.DIRECTORY_SEPARATOR.'test.copy.gif';
|
$path = $dir.DIRECTORY_SEPARATOR.'test.copy.gif';
|
||||||
@unlink($path);
|
@unlink($path);
|
||||||
@ -103,7 +102,12 @@ class FileTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
$file = new File($path);
|
$file = new File($path);
|
||||||
@unlink($path);
|
@unlink($path);
|
||||||
|
|
||||||
|
try {
|
||||||
$file->getSize();
|
$file->getSize();
|
||||||
|
$this->fail('File::getSize should throw an exception.');
|
||||||
|
} catch (FileException $e) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testMove()
|
public function testMove()
|
||||||
@ -156,8 +160,11 @@ class FileTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
$file = new File($path);
|
$file = new File($path);
|
||||||
|
|
||||||
$this->setExpectedException('Symfony\Component\HttpFoundation\File\Exception\FileException');
|
try {
|
||||||
$file->move($targetPath);
|
$file->move($targetPath);
|
||||||
|
$this->fail('File::move should throw an exception.');
|
||||||
|
} catch (FileException $e) {
|
||||||
|
}
|
||||||
|
|
||||||
$this->assertFileExists($path);
|
$this->assertFileExists($path);
|
||||||
$this->assertFileNotExists($path.$targetPath.'test.gif');
|
$this->assertFileNotExists($path.$targetPath.'test.gif');
|
||||||
|
Reference in New Issue
Block a user