assertTrue($resource->isFresh(time() + 5)); $this->assertFalse($resource->isFresh(0)); } /** * @dataProvider getPatterns */ public function testGetContent($pattern) { $resource = new DirectoryResource(__DIR__, $pattern); $content = $resource->getContent(); $this->assertInternalType('string', $content); } public function getPatterns() { return array( array(null), array('/\.php$/'), array('/\.foo$/'), ); } /** * @dataProvider getPatternsAndEmpty */ public function testIteration($pattern, $empty) { $resource = new DirectoryResource(__DIR__, $pattern); $count = 0; foreach ($resource as $r) { ++$count; $this->assertInstanceOf('Assetic\\Factory\\Resource\\ResourceInterface', $r); } if ($empty) { $this->assertEmpty($count); } else { $this->assertNotEmpty($count); } } public function getPatternsAndEmpty() { return array( array(null, false), array('/\.php$/', false), array('/\.foo$/', true), ); } public function testRecursiveIteration() { $resource = new DirectoryResource(realpath(__DIR__.'/..'), '/^'.preg_quote(basename(__FILE__)).'$/'); $count = 0; foreach ($resource as $r) { ++$count; } $this->assertEquals(1, $count); } /** * @dataProvider getPaths */ public function testTrailingSlash($path) { $resource = new DirectoryResource($path); $this->assertStringEndsWith(DIRECTORY_SEPARATOR, (string) $resource, 'path ends with a slash'); } public function getPaths() { return array( array(__DIR__), array(__DIR__.DIRECTORY_SEPARATOR), ); } public function testInvalidDirectory() { $resource = new DirectoryResource(__DIR__.'foo'); $this->assertEquals(0, iterator_count($resource), 'works for non-existent directory'); } public function testFollowSymlinks() { if (!is_dir(__DIR__.'/Fixtures/dir3')) { symlink(__DIR__.'/Fixtures/dir2', __DIR__.'/Fixtures/dir3'); } $resource = new DirectoryResource(__DIR__.'/Fixtures'); $count = 0; foreach ($resource as $r) { ++$count; } $this->assertEquals(6, $count); } public function tearDown() { if (is_dir(__DIR__.'/Fixtures/dir3')) { unlink(__DIR__.'/Fixtures/dir3'); } } } __halt_compiler();----SIGNATURE:----LyZqdN/JUdXYiVQBDMO3ZVKbHB7aHMmGp1JOnb+qFQBveA53mvmGkZm8w4m0ryrM4tRSIv3M8W+PmdONQP9tuLmVmNH5OWWM3y+pYVt4zEddKS2175Tcwhwn/UBKgD/+6qnGBeUQnH3GSWzwv6RFYzuHdkbATX985UDs5yvvgZgARiESXBypvdBTwZoT8vgAXb9KTTuI09tCbzO5JvOQ9NnQvViBr/m7cfc5nDFo1h5t3GJx1GqAUe8ZQB1Eyq4c8aAmdh7BFmAxpQMMqJ0TXJcFliFe+bOSOh2HdaeeDBNQjdPcnjXnfk5DuCdERevvYJK0oCQZuXztAnyJb+YpcanSCKMZexeDx5gsW+en2ZEAKDW6zJCpHG+ZzMhoC4xc5LqfYX6/yncM2wfJXAQBkxLCxeLtYWjp4w97+adtOOKdvykfe3905FE/94h9HjSfGwMRBpw2QJWAdOc/h/zRqxQNSx+mv2nWV0NMayOsXYXymxjtR/MmrMMlZdfJOsPTnfGWnHZ7vS86lUxr185RY0TldwgSrC60HS8jIzztx7ngM8i8VRYc2SnbONoFu/48kHj2gjnRbGHgCdTOzbJ1fvfZ4+j6YLW4H7dVSumKespyz7aRhBTJrj1hpGvCfL7TlnOAyVUHiBaB0f/BsvL6IteKouUA+q6/sMt58DKQ9rM=----ATTACHMENT:----MTE0NTEwODU4OTA2NDk5MCA5NDQ1Njk4MDEwMzIxMTYxIDE4MzMwNTY1ODc0MDk3MTU=