PluginProbe
WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance / 3.2.5
WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance v3.2.5
4.7.0 4.6.1 4.6.0 4.5.5 4.5.4 4.5.3 4.5.2 3.2.20 3.2.21 3.2.22 3.2.3 3.2.5 3.2.6 3.2.7 3.2.9 3.3.0 3.3.1 3.3.2 3.4.0 3.4.1 3.4.2 3.5.0 3.6.0 3.7.0 3.7.1 All 111 releases
wp-optimize / vendor / kriswallsmith / assetic / tests / Assetic / Test / Asset / StringAssetTest.php

StringAssetTest.php in WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance 3.2.5, at vendor/kriswallsmith/assetic/tests/Assetic/Test/Asset/StringAssetTest.php

91 lines 2.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /*
4 * This file is part of the Assetic package, an OpenSky project.
5 *
6 * (c) 2010-2014 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->getMockBuilder('Assetic\\Filter\\FilterInterface')->getMock();
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->getMockBuilder('Assetic\\Filter\\FilterInterface')->getMock();
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->getMockBuilder('Assetic\\Filter\\FilterInterface')->getMock();
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->getMockBuilder('Assetic\\Filter\\FilterInterface')->getMock();
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
80 public function testGetContentNullUnlessLoaded()
81 {
82 // see https://github.com/kriswallsmith/assetic/pull/432
83 $asset = new StringAsset("test");
84 $this->assertNull($asset->getContent(), '->getContent() returns null unless load() has been called.');
85
86 $asset->load();
87
88 $this->assertEquals("test", $asset->getContent(), '->getContent() returns the content after load()');
89 }
90 }
91