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 / AssetManagerTest.php

AssetManagerTest.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/AssetManagerTest.php

63 lines 1.7 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;
13
14 use Assetic\AssetManager;
15
16 class AssetManagerTest extends \PHPUnit_Framework_TestCase
17 {
18 /** @var AssetManager */
19 private $am;
20
21 protected function setUp()
22 {
23 $this->am = new AssetManager();
24 }
25
26 public function testGetAsset()
27 {
28 $asset = $this->getMockBuilder('Assetic\\Asset\\AssetInterface')->getMock();
29 $this->am->set('foo', $asset);
30 $this->assertSame($asset, $this->am->get('foo'), '->get() returns an asset');
31 }
32
33 public function testGetInvalidAsset()
34 {
35 $this->setExpectedException('InvalidArgumentException');
36 $this->am->get('foo');
37 }
38
39 public function testHas()
40 {
41 $asset = $this->getMockBuilder('Assetic\\Asset\\AssetInterface')->getMock();
42 $this->am->set('foo', $asset);
43
44 $this->assertTrue($this->am->has('foo'), '->has() returns true if the asset is set');
45 $this->assertFalse($this->am->has('bar'), '->has() returns false if the asset is not set');
46 }
47
48 public function testInvalidName()
49 {
50 $this->setExpectedException('InvalidArgumentException');
51
52 $this->am->set('@foo', $this->getMockBuilder('Assetic\\Asset\\AssetInterface')->getMock());
53 }
54
55 public function testClear()
56 {
57 $this->am->set('foo', $this->getMockBuilder('Assetic\Asset\AssetInterface')->getMock());
58 $this->am->clear();
59
60 $this->assertFalse($this->am->has('foo'));
61 }
62 }
63