/**
  * @covers Symfony\CS\FixerFactory::attachConfig
  */
 public function testMethodAttachConfig()
 {
     $factory = new FixerFactory();
     $fixer = new Psr0Fixer();
     $factory->registerFixer($fixer);
     $mock = $this->getMock('Symfony\\CS\\ConfigInterface');
     $testInstance = $factory->attachConfig($mock);
     $property = AccessibleObject::create($fixer)->config;
     $this->assertSame($mock, $property);
 }
示例#2
0
 /**
  * @covers Symfony\CS\FixerFactory::attachConfig
  */
 public function testMethodAttachConfig()
 {
     $factory = new FixerFactory();
     $fixer = new Psr0Fixer();
     $factory->registerFixer($fixer);
     $mock = $this->getMock('Symfony\\CS\\ConfigInterface');
     $testInstance = $factory->attachConfig($mock);
     $classReflection = new \ReflectionClass($fixer);
     $propertyReflection = $classReflection->getProperty('config');
     $propertyReflection->setAccessible(true);
     $property = $propertyReflection->getValue($fixer);
     $this->assertSame($mock, $property);
 }
 /**
  * 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;
 }