/** * @covers Symfony\CS\Fixer::fix * @covers Symfony\CS\Fixer::fixFile */ public function testThatFixInvalidFileReportsToErrorManager() { $fixer = new Fixer(); $fixer->setLinter(new Linter()); $config = Config::create()->finder(new \DirectoryIterator(__DIR__ . DIRECTORY_SEPARATOR . 'Fixtures' . DIRECTORY_SEPARATOR . 'FixerTest' . DIRECTORY_SEPARATOR . 'invalid'))->fixers(array(new \Symfony\CS\Fixer\PSR2\VisibilityFixer(), new \Symfony\CS\Fixer\Symfony\UnusedUseFixer()))->setUsingCache(false); $changed = $fixer->fix($config, true, true); $pathToInvalidFile = __DIR__ . DIRECTORY_SEPARATOR . 'Fixtures' . DIRECTORY_SEPARATOR . 'FixerTest' . DIRECTORY_SEPARATOR . 'invalid' . DIRECTORY_SEPARATOR . 'somefile.php'; $this->assertCount(0, $changed); $errors = $fixer->getErrorsManager()->getInvalidErrors(); $this->assertCount(1, $errors); $error = $errors[0]; $this->assertInstanceOf('Symfony\\CS\\Error\\Error', $error); $this->assertSame(Error::TYPE_INVALID, $error->getType()); $this->assertSame($pathToInvalidFile, $error->getFilePath()); }
/** * @dataProvider provideAddCustomFixersCases */ public function testAddCustomFixers($expected, $suite) { $config = Config::create(); $config->addCustomFixers($suite); $this->assertSame($expected, $config->getCustomFixers()); }