[AsseticBundle] Update the cache warmer tests

This commit is contained in:
Victor Berchet 2011-04-20 23:28:19 +02:00
parent 1191e3aa66
commit f7b1839296
2 changed files with 41 additions and 8 deletions

View File

@ -24,13 +24,28 @@ class AssetManagerCacheWarmerTest extends \PHPUnit_Framework_TestCase
public function testWarmUp()
{
$am = $this->getMockBuilder('Assetic\\Factory\\LazyAssetManager')
$am = $this
->getMockBuilder('Assetic\\Factory\\LazyAssetManager')
->disableOriginalConstructor()
->getMock();
->getMock()
;
$am->expects($this->once())->method('load');
$container = $this
->getMockBuilder('Symfony\\Component\\DependencyInjection\\Container')
->setConstructorArgs(array())
->getMock()
;
$container
->expects($this->once())
->method('get')
->with('assetic.asset_manager')
->will($this->returnValue($am))
;
$warmer = new AssetManagerCacheWarmer($am);
$warmer = new AssetManagerCacheWarmer($container);
$warmer->warmUp('/path/to/cache');
}
}

View File

@ -25,15 +25,33 @@ class AssetWriterCacheWarmerTest extends \PHPUnit_Framework_TestCase
public function testWarmUp()
{
$am = $this->getMock('Assetic\\AssetManager');
$writer = $this->getMockBuilder('Assetic\\AssetWriter')
$writer = $this
->getMockBuilder('Assetic\\AssetWriter')
->disableOriginalConstructor()
->getMock();
->getMock()
;
$writer->expects($this->once())
$writer
->expects($this->once())
->method('writeManagerAssets')
->with($am);
->with($am)
;
$container = $this
->getMockBuilder('Symfony\\Component\\DependencyInjection\\Container')
->setConstructorArgs(array())
->getMock()
;
$container
->expects($this->once())
->method('get')
->with('assetic.asset_manager')
->will($this->returnValue($am))
;
$warmer = new AssetWriterCacheWarmer($am, $writer);
$warmer = new AssetWriterCacheWarmer($container, $writer);
$warmer->warmUp('/path/to/cache');
}
}