GlobAssetTest.php 1.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. /*
  3. * This file is part of the Assetic package, an OpenSky project.
  4. *
  5. * (c) 2010-2011 OpenSky Project Inc
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Assetic\Test\Asset;
  11. use Assetic\Asset\GlobAsset;
  12. class GlobAssetTest extends \PHPUnit_Framework_TestCase
  13. {
  14. public function testInterface()
  15. {
  16. $asset = new GlobAsset(__DIR__.'/*.php');
  17. $this->assertInstanceOf('Assetic\\Asset\\AssetInterface', $asset, 'Asset implements AssetInterface');
  18. }
  19. public function testIteration()
  20. {
  21. $assets = new GlobAsset(__DIR__.'/*.php');
  22. $this->assertGreaterThan(0, iterator_count($assets), 'GlobAsset initializes for iteration');
  23. }
  24. public function testRecursiveIteration()
  25. {
  26. $assets = new GlobAsset(__DIR__.'/*.php');
  27. $this->assertGreaterThan(0, iterator_count($assets), 'GlobAsset initializes for recursive iteration');
  28. }
  29. public function testGetLastModifiedType()
  30. {
  31. $assets = new GlobAsset(__DIR__.'/*.php');
  32. $this->assertInternalType('integer', $assets->getLastModified(), '->getLastModified() returns an integer');
  33. }
  34. public function testGetLastModifiedValue()
  35. {
  36. $assets = new GlobAsset(__DIR__.'/*.php');
  37. $this->assertLessThan(time(), $assets->getLastModified(), '->getLastModified() returns a file mtime');
  38. }
  39. public function testLoad()
  40. {
  41. $assets = new GlobAsset(__DIR__.'/*.php');
  42. $assets->load();
  43. $this->assertNotEmpty($assets->getContent(), '->load() loads contents');
  44. }
  45. public function testDump()
  46. {
  47. $assets = new GlobAsset(__DIR__.'/*.php');
  48. $this->assertNotEmpty($assets->dump(), '->dump() dumps contents');
  49. }
  50. }