[Config] update FileResourceTest
This commit is contained in:
parent
45a45baf2f
commit
9fe0d00735
@ -27,7 +27,9 @@ class FileResourceTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
protected function tearDown()
|
||||
{
|
||||
unlink($this->file);
|
||||
if ($this->file) {
|
||||
unlink($this->file);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -50,22 +52,25 @@ class FileResourceTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertFalse($resource->isFresh(time()), '->isFresh() returns false if the resource does not exist');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Symfony\Component\Config\Resource\FileResource::exists
|
||||
*/
|
||||
public function testExists()
|
||||
{
|
||||
$this->assertTrue($this->resource->exists(), '->exists() returns true if the resource does exist');
|
||||
|
||||
$resource = new FileResource('/____foo/foobar'.rand(1, 999999));
|
||||
$this->assertFalse($resource->exists(), '->exists() returns false if the resource does not exist');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Symfony\Component\Config\Resource\FileResource::getModificationTime
|
||||
*/
|
||||
public function testGetModificationTime()
|
||||
{
|
||||
$this->assertSame(filemtime($this->resource->getResource()), $this->resource->getModificationTime());
|
||||
touch($this->file, $time = time() + 100);
|
||||
$this->assertSame($time, $this->resource->getModificationTime());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Symfony\Component\Config\Resource\FileResource::exists
|
||||
*/
|
||||
public function testExists()
|
||||
{
|
||||
$this->assertTrue($this->resource->exists(), '->exists() returns true if the resource exists');
|
||||
|
||||
unlink($this->file);
|
||||
$this->file = null;
|
||||
|
||||
$this->assertFalse($this->resource->exists(), '->exists() returns false if the resource does not exists');
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user