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