AssetManagerCacheWarmerTest.php 1.3KB

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