public function onGetClassFixClass(GetClassEvent $event) { $fileLocation = $event->getFileLocation(); $command = new FixCommand(); $arguments = ['path' => $fileLocation]; $arguments = array_merge($arguments, $this->arguments); $output = isset($this->output) ? $this->output : new BufferedOutput(); $output->writeln(sprintf('<info>Running PSR Fixer on %s</info>', $fileLocation)); $input = new ArrayInput($arguments); $command->run($input, $output); }
public function testExitCodeActualRunWithChangedAndInvalidFiles() { $errorsManager = new ErrorsManager(); $errorsManager->report(new Error(Error::TYPE_INVALID, 'Invalid.php')); $fixer = $this->getFixerMock(array('Changed.php'), $errorsManager); $command = new FixCommand($fixer); $input = $this->getInputMock(array('dry-run' => false)); $exitCode = $command->run($input, new NullOutput()); $this->assertSame(0, $exitCode); }