/**
  * Parses the '--CONFIG--' block of a '.test' file and determines what fixers should be used.
  *
  * @param string $config
  *
  * @return FixerInterface[]
  */
 protected function determineFixers($config)
 {
     $ruleSet = json_decode($config, true);
     if (JSON_ERROR_NONE !== json_last_error()) {
         throw new \InvalidArgumentException('Malformed JSON configuration.');
     }
     return FixerFactory::create()->registerBuiltInFixers()->useRuleSet(new RuleSet($ruleSet))->getFixers();
 }
 /**
  * @covers Symfony\CS\FixerFactory::useRuleSet
  * @expectedException        \UnexpectedValueException
  * @expectedExceptionMessage Rule "non_existing_rule" does not exist.
  */
 public function testUseRuleSetWithNonExistingRule()
 {
     $factory = FixerFactory::create()->registerBuiltInFixers()->useRuleSet(new RuleSet(array('non_existing_rule' => true)));
     $fixers = $factory->getFixers();
     $this->assertCount(1, $fixers);
     $this->assertSame('strict', $fixers[0]->getName());
 }
 /**
  * Create fixer factory with all needed fixers registered.
  *
  * @return FixerFactory
  */
 protected function createFixerFactory()
 {
     return FixerFactory::create()->registerBuiltInFixers();
 }