CachedAssetManagerTest.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. /*
  3. * This file is part of the Symfony framework.
  4. *
  5. * (c) Fabien Potencier <fabien.potencier@symfony-project.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;
  11. use Symfony\Bundle\AsseticBundle\Factory\CachedAssetManager;
  12. class CachedAssetManagerTest 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 testLoadFormulae()
  21. {
  22. $file = tempnam(sys_get_temp_dir(), 'assetic');
  23. file_put_contents($file, '<?php return array(\'foo\' => array());');
  24. $factory = $this->getMockBuilder('Assetic\\Factory\\AssetFactory')
  25. ->disableOriginalConstructor()
  26. ->getMock();
  27. $am = new CachedAssetManager($factory);
  28. $am->addCacheFile($file);
  29. $this->assertTrue($am->has('foo'), '->loadFormulae() loads formulae');
  30. unlink($file);
  31. }
  32. }