|
0
|
1 |
<?php |
|
|
2 |
|
|
|
3 |
/* |
|
|
4 |
* This file is part of the Symfony framework. |
|
|
5 |
* |
|
|
6 |
* (c) Fabien Potencier <fabien@symfony.com> |
|
|
7 |
* |
|
|
8 |
* This source file is subject to the MIT license that is bundled |
|
|
9 |
* with this source code in the file LICENSE. |
|
|
10 |
*/ |
|
|
11 |
|
|
|
12 |
namespace Symfony\Bundle\AsseticBundle\Tests\CacheWarmer; |
|
|
13 |
|
|
|
14 |
use Symfony\Bundle\AsseticBundle\CacheWarmer\AssetManagerCacheWarmer; |
|
|
15 |
|
|
|
16 |
class AssetManagerCacheWarmerTest extends \PHPUnit_Framework_TestCase |
|
|
17 |
{ |
|
|
18 |
protected function setUp() |
|
|
19 |
{ |
|
|
20 |
if (!class_exists('Assetic\\AssetManager')) { |
|
|
21 |
$this->markTestSkipped('Assetic is not available.'); |
|
|
22 |
} |
|
|
23 |
} |
|
|
24 |
|
|
|
25 |
public function testWarmUp() |
|
|
26 |
{ |
|
|
27 |
$am = $this |
|
|
28 |
->getMockBuilder('Assetic\\Factory\\LazyAssetManager') |
|
|
29 |
->disableOriginalConstructor() |
|
|
30 |
->getMock() |
|
|
31 |
; |
|
|
32 |
|
|
|
33 |
$am->expects($this->once())->method('load'); |
|
|
34 |
|
|
|
35 |
$container = $this |
|
|
36 |
->getMockBuilder('Symfony\\Component\\DependencyInjection\\Container') |
|
|
37 |
->setConstructorArgs(array()) |
|
|
38 |
->getMock() |
|
|
39 |
; |
|
|
40 |
|
|
|
41 |
$container |
|
|
42 |
->expects($this->once()) |
|
|
43 |
->method('get') |
|
|
44 |
->with('assetic.asset_manager') |
|
|
45 |
->will($this->returnValue($am)) |
|
|
46 |
; |
|
|
47 |
|
|
|
48 |
$warmer = new AssetManagerCacheWarmer($container); |
|
|
49 |
$warmer->warmUp('/path/to/cache'); |
|
|
50 |
} |
|
|
51 |
} |