public function tearDown() { $directoryScanner = new Stagehand_DirectoryScanner(array($this, 'removeJUnitXMLFile')); $directoryScanner->addExclude('^.*'); $directoryScanner->addInclude('\\.xml$'); $directoryScanner->scan($this->tmpDirectory); }
/** * Collects tests. * * @return mixed * @throws Stagehand_TestRunner_Exception */ public function collect() { foreach ($this->config->testingResources as $testingResource) { $absoluteTargetPath = realpath($testingResource); if ($absoluteTargetPath === false) { throw new Stagehand_TestRunner_Exception('The directory or file [ ' . $testingResource . ' ] is not found'); } if (is_dir($absoluteTargetPath)) { $directoryScanner = new Stagehand_DirectoryScanner(array($this, 'collectTestCases')); $directoryScanner->setRecursivelyScans($this->config->recursivelyScans); $directoryScanner->scan($absoluteTargetPath); } else { $this->collectTestCasesFromFile($absoluteTargetPath); } } return $this->suite; }
/** * @test */ public function disableTheCvsExclude() { $scanner = new Stagehand_DirectoryScanner(array($this, 'collectElements'), false); $scanner->scan($this->scanDirectory); $this->assertEquals(4, count($this->elements)); $this->assertContains($this->scanDirectory . DIRECTORY_SEPARATOR . 'foo.txt', $this->elements); $this->assertContains($this->scanDirectory . DIRECTORY_SEPARATOR . 'foo.txt.bak', $this->elements); $this->assertContains($this->scanDirectory . DIRECTORY_SEPARATOR . 'bar', $this->elements); $this->assertContains($this->scanDirectory . DIRECTORY_SEPARATOR . 'bar' . DIRECTORY_SEPARATOR . 'baz.txt', $this->elements); }
/** * @throws Stagehand_DirectorySnap_Exception Snap a directory first. */ public function restore() { if (!$this->snappedPath) { throw new Stagehand_DirectorySnap_Exception('Snap a directory first.'); } $cleaner = new Stagehand_DirectoryCleaner(); $cleaner->clean($this->snappedPath); if ($this->useTemporary) { $scanner = new Stagehand_DirectoryScanner(array($this, 'restoreOrigin'), false); $scanner->scan($this->temporaryPath); } else { foreach ($this->elements as $element) { $element->push($this->snappedPath); } } }