/** * Parses the given source file or directory with the default tokenizer * and node builder implementations. * * @param string $testCase * @param boolean $ignoreAnnotations * @return \PDepend\Source\AST\ASTNamespace[] */ public static function parseTestCaseSource($testCase, $ignoreAnnotations = false) { list($class, $method) = explode('::', $testCase); $parts = explode('\\', $class); try { return parent::parseSource(sprintf('Metrics/%s/%s/%s.php', $parts[count($parts) - 2], substr($parts[count($parts) - 1], 0, -4), $method), $ignoreAnnotations); } catch (\Exception $e) { } return parent::parseSource(sprintf('Metrics/%s/%s/%s', $parts[count($parts) - 2], substr($parts[count($parts) - 1], 0, -4), $method), $ignoreAnnotations); }
/** * Parses the given source file or directory with the default tokenizer * and node builder implementations. * * @param string $testCase * @param boolean $ignoreAnnotations * * @return \PDepend\Source\AST\ASTNamespace[] */ public static function parseTestCaseSource($testCase, $ignoreAnnotations = false) { list($class, $method) = explode('::', $testCase); return parent::parseSource(sprintf('code/%s/%s.php', substr($class, strrpos($class, '_') + 1, -4), $method), $ignoreAnnotations); }
/** * Initializes a temporary working directory. * * @return void */ protected function setUp() { parent::setUp(); $this->cacheDir = self::createRunResourceURI('cache'); $this->versionFile = "{$this->cacheDir}/_version"; }
/** * tearDown() * * @return void */ protected function tearDown() { if (file_exists($this->outputFile)) { unlink($this->outputFile); } parent::tearDown(); }
/** * Creates temporary test resources. * * @return void */ protected function setUp() { parent::setUp(); $this->cacheDir = self::createRunResourceURI('cacheDir'); $this->testFile = self::createRunResourceURI('testFile'); }
/** * Removes the temporary log files. * * @return void */ protected function tearDown() { @unlink($this->resultFile); parent::tearDown(); }
} if (is_dir($fileOrDirectory)) { $it = new Iterator(new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($fileOrDirectory)), new ExcludePathFilter(array('.svn'))); } else { $it = new \ArrayIterator(array($fileOrDirectory)); } $files = array(); foreach ($it as $file) { if (is_object($file)) { $files[] = realpath($file->getPathname()); } else { $files[] = $file; } } sort($files); $cache = new MemoryCacheDriver(); $builder = new PHPBuilder(); foreach ($files as $file) { $tokenizer = new PHPTokenizerInternal(); $tokenizer->setSourceFile($file); $parser = new PHPParserGeneric($tokenizer, $builder, $cache); if ($ignoreAnnotations === true) { $parser->setIgnoreAnnotations(); } $parser->parse(); } return $builder->getNamespaces(); } } AbstractTest::init();
protected function setUp() { parent::setUp(); $data = json_decode(file_get_contents(__DIR__ . '/../../../../../composer.json')); $this->versionOutput = sprintf("PDepend %s\n\n", $data->version); }