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/Component/Translation/Resource/FileResourceTest.php
2010-10-31 23:23:42 +01:00

49 lines
1.3 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\Component\Translation\Resource;
use Symfony\Component\Translation\Resource\FileResource;
class FileResourceTest extends \PHPUnit_Framework_TestCase
{
/**
* @expectedException InvalidArgumentException
*/
public function testConstructor()
{
$resource = new FileResource(__DIR__.'/../fixtures/foobar');
}
public function testMagicToString()
{
$resource = new FileResource(__DIR__.'/../fixtures/resources.php');
$this->assertEquals(realpath(__DIR__.'/../fixtures/resources.php'), (string) $resource);
}
public function testGetResource()
{
$resource = new FileResource(__DIR__.'/../fixtures/resources.php');
$this->assertEquals(realpath(__DIR__.'/../fixtures/resources.php'), $resource->getResource());
}
public function testIsUptodate()
{
$r = __DIR__.'/../fixtures/resources.php';
$resource = new FileResource($r);
$this->assertFalse($resource->isUptodate(filemtime($r) - 100));
$this->assertTrue($resource->isUptodate(filemtime($r) + 100));
}
}