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