This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
symfony/tests/Symfony/Tests/Components/Routing/FileResourceTest.php

39 lines
1.3 KiB
PHP
Raw Normal View History

2010-06-24 07:46:50 +01:00
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Tests\Components\Routing;
use Symfony\Components\Routing\FileResource;
class FileResourceTest extends \PHPUnit_Framework_TestCase
{
public function testGetResource()
{
$file = sys_get_temp_dir().'/tmp.xml';
touch($file);
$resource = new FileResource($file);
$this->assertEquals($file, $resource->getResource(), '->getResource() returns the path to the resource');
unlink($file);
}
public function testIsUptodate()
{
$file = sys_get_temp_dir().'/tmp.xml';
touch($file);
$resource = new FileResource($file);
$this->assertTrue($resource->isUptodate(time() + 10), '->isUptodate() returns true if the resource has not changed');
$this->assertTrue(!$resource->isUptodate(time() - 86400), '->isUptodate() returns false if the resource has been updated');
$resource = new FileResource('/____foo/foobar'.rand(1, 999999));
$this->assertTrue(!$resource->isUptodate(time()), '->isUptodate() returns false if the resource does not exist');
}
}