2dc36191d1
The conversion has been done automatically with the following command: perl -p -i -e 's#this\->assertEquals\((.+?), (.+?)(, '\''(\-|\:|_)|\);)#this->assertEquals($2, $1$3#g' tests/Symfony/Tests/*/*.php tests/Symfony/Tests/*/*/*.php tests/Symfony/Tests/*/*/*.php ... and with some manual tweaking after that
48 lines
1.4 KiB
PHP
48 lines
1.4 KiB
PHP
<?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\DependencyInjection;
|
|
|
|
require_once __DIR__.'/../../bootstrap.php';
|
|
|
|
use Symfony\Components\DependencyInjection\FileResource;
|
|
|
|
class FileResourceTest extends \PHPUnit_Framework_TestCase
|
|
{
|
|
protected $resource;
|
|
protected $file;
|
|
|
|
public function setUp()
|
|
{
|
|
$this->file = sys_get_temp_dir().'/tmp.xml';
|
|
touch($this->file);
|
|
$this->resource = new FileResource($this->file);
|
|
}
|
|
|
|
public function tearDown()
|
|
{
|
|
unlink($this->file);
|
|
}
|
|
|
|
public function testGetResource()
|
|
{
|
|
$this->assertEquals($this->file, $this->resource->getResource(), '->getResource() returns the path to the resource');
|
|
}
|
|
|
|
public function testIsUptodate()
|
|
{
|
|
$this->assertTrue($this->resource->isUptodate(time() + 10), '->isUptodate() returns true if the resource has not changed');
|
|
$this->assertTrue(!$this->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');
|
|
}
|
|
}
|