Skip to content

Commit

Permalink
[AsseticBundle] Update the cache warmer tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vicb committed Apr 20, 2011
1 parent 1191e3a commit f7b1839
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 8 deletions.
Expand Up @@ -24,13 +24,28 @@ protected function setUp()

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');
}
}
Expand Up @@ -25,15 +25,33 @@ protected function setUp()
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');
}
}

0 comments on commit f7b1839

Please sign in to comment.