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