/** * Tests the addDirectory method. * * @return void */ public function testAddDirectory() { // instantiate a new instance because we want to be sure it is clean $fixture = new Collection(); // read the phar test fixture $fixture->addDirectory('phar://' . dirname(__FILE__) . '/../../../data/test.phar'); // we know which files are in there; test against it $this->assertEquals(array('phar://' . dirname(__FILE__) . '/../../../data/test.phar/folder/test.php', 'phar://' . dirname(__FILE__) . '/../../../data/test.phar/test.php'), $fixture->getFilenames()); // instantiate a new instance because we want to be sure it is clean $fixture = new Collection(); // load the unit test folder $fixture->addDirectory(dirname(__FILE__) . '/../../'); $files = $fixture->getFilenames(); $count = count($files); // do a few checks to see if it has caught some cases $this->assertGreaterThan(0, $count); $this->assertContains(realpath(dirname(__FILE__) . '/../../phpDocumentor/Fileset/CollectionTest.php'), $files); // should exclude 1 less $fixture = new Collection(); $fixture->getIgnorePatterns()->append('*r/Fileset*.php'); $fixture->addDirectory(dirname(__FILE__) . '/../../'); $this->assertCount($count - 1, $fixture->getFilenames()); }