public function testRuleSet() { $configuration = new Configuration('path/to/rule_set', 'path/to/container.xml', true, 'path/to/cache/dir/', '', true, true, 'html.log'); $this->assertEquals('path/to/rule_set', $configuration->ruleSet()); $this->assertEquals('path/to/container.xml', $configuration->containerPath()); $this->assertTrue($configuration->useCachedRuleSet()); $this->assertEquals('path/to/cache/dir/', $configuration->ruleSetCacheDir()); $this->assertEquals('', $configuration->filteredMethodCalls()); $this->assertTrue($configuration->failOnDeprecation()); $this->assertTrue($configuration->isVerbose()); $this->assertEquals('html.log', $configuration->logHtml()); }
/** * @param DirectoryTraverser $traverser * @param Configuration $configuration * * @return LoaderInterface */ private function getRuleSetLoader(DirectoryTraverser $traverser, Configuration $configuration) { $ruleSetCache = new Cache(new Filesystem()); if ($configuration->useCachedRuleSet()) { $ruleSetCache->disable(); } else { $ruleSetCache->setCacheDir($configuration->ruleSetCacheDir()); } if (is_dir($configuration->ruleSet())) { $loader = new DirectoryLoader($traverser, $ruleSetCache); } elseif ('composer.lock' === basename($configuration->ruleSet())) { $loader = new ComposerLoader($traverser, $ruleSetCache, new ComposerFactory()); } else { $loader = new FileLoader(); } return $loader; }