/** * Resolve configuration. * * @return ConfigurationResolver */ public function resolve() { $this->resolvePath(); $this->resolveIsStdIn(); $this->resolveIsDryRun(); $this->resolveConfig(); $this->resolveConfigPath(); $this->resolveRiskyAllowed(); $this->fixerFactory->registerCustomFixers($this->getConfig()->getCustomFixers()); $this->fixerFactory->attachConfig($this->getConfig()); $this->resolveRules(); $this->resolveFixers(); $this->resolveProgress(); $this->resolveUsingCache(); $this->resolveCacheFile(); $this->config->fixers($this->getFixers()); $this->config->setRules($this->getRules()); $this->config->setUsingCache($this->usingCache); $this->config->setCacheFile($this->cacheFile); $this->config->setRiskyAllowed($this->allowRisky); return $this; }
public function testHasRule() { $factory = new FixerFactory(); $f1 = $this->createFixerMock('f1'); $f2 = $this->createFixerMock('f2'); $f3 = $this->createFixerMock('f3'); $factory->registerFixer($f1); $factory->registerCustomFixers(array($f2, $f3)); $this->assertTrue($factory->hasRule('f1'), 'Should have f1 fixer'); $this->assertTrue($factory->hasRule('f2'), 'Should have f2 fixer'); $this->assertTrue($factory->hasRule('f3'), 'Should have f3 fixer'); $this->assertFalse($factory->hasRule('dummy'), 'Should not have dummy fixer'); }
public function testHasRule() { $factory = new FixerFactory(); $factory->registerBuiltInFixers(); $f1 = $this->getMock('Symfony\\CS\\FixerInterface'); $f1->expects($this->any())->method('getName')->willReturn('f1'); $f2 = $this->getMock('Symfony\\CS\\FixerInterface'); $f2->expects($this->any())->method('getName')->willReturn('f2'); $f3 = $this->getMock('Symfony\\CS\\FixerInterface'); $f3->expects($this->any())->method('getName')->willReturn('f3'); $factory->registerFixer($f1); $factory->registerCustomFixers(array($f2, $f3)); $this->assertTrue($factory->hasRule('f1'), 'Should have f1 fixer'); $this->assertTrue($factory->hasRule('f2'), 'Should have f2 fixer'); $this->assertTrue($factory->hasRule('f3'), 'Should have f3 fixer'); $this->assertFalse($factory->hasRule('dummy'), 'Should not have dummy fixer'); }