[Config] update FileResourceTest

This commit is contained in:
everzet 2011-11-25 14:48:15 +01:00
parent 45a45baf2f
commit 9fe0d00735

View File

@ -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');
}
}