Blame view
sources/3rdparty/kriswallsmith/assetic/tests/Assetic/Test/Asset/StringAssetTest.php
2.55 KB
|
6d9380f96
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
<?php
/*
* This file is part of the Assetic package, an OpenSky project.
*
* (c) 2010-2014 OpenSky Project Inc
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Assetic\Test\Asset;
use Assetic\Asset\StringAsset;
class StringAssetTest extends \PHPUnit_Framework_TestCase
{
public function testInterface()
{
$asset = new StringAsset('');
$this->assertInstanceOf('Assetic\\Asset\\AssetInterface', $asset, 'Asset implements AssetInterface');
}
public function testLoadAppliesFilters()
{
$filter = $this->getMock('Assetic\\Filter\\FilterInterface');
$filter->expects($this->once())->method('filterLoad');
$asset = new StringAsset('foo', array($filter));
$asset->load();
}
public function testAutomaticLoad()
{
$filter = $this->getMock('Assetic\\Filter\\FilterInterface');
$filter->expects($this->once())->method('filterLoad');
$asset = new StringAsset('foo', array($filter));
$asset->dump();
}
public function testGetFilters()
{
$asset = new StringAsset('');
$this->assertInternalType('array', $asset->getFilters(), '->getFilters() returns an array');
}
public function testLoadAppliesAdditionalFilter()
{
$asset = new StringAsset('');
$asset->load();
$filter = $this->getMock('Assetic\\Filter\\FilterInterface');
$filter->expects($this->once())
->method('filterLoad')
->with($asset);
$asset->load($filter);
}
public function testDumpAppliesAdditionalFilter()
{
$asset = new StringAsset('');
$filter = $this->getMock('Assetic\\Filter\\FilterInterface');
$filter->expects($this->once())
->method('filterDump')
->with($asset);
$asset->dump($filter);
}
public function testLastModified()
{
$asset = new StringAsset('');
$asset->setLastModified(123);
$this->assertEquals(123, $asset->getLastModified(), '->getLastModified() return the set last modified value');
}
public function testGetContentNullUnlessLoaded()
{
// see https://github.com/kriswallsmith/assetic/pull/432
$asset = new StringAsset("test");
$this->assertNull($asset->getContent(), '->getContent() returns null unless load() has been called.');
$asset->load();
$this->assertEquals("test", $asset->getContent(), '->getContent() returns the content after load()');
}
}
|