protected function execute(InputInterface $input, OutputInterface $output) { $path = $input->getOption('path'); $sugar = $this->getService('sugarcrm.application'); $sort = !$input->getOption('no-sort'); $test = $input->getOption('test'); if (!$sugar->isValid()) { $output->writeln('SugarCRM is not present in ' . $path . '.'); return ExitCode::EXIT_NOT_EXTRACTED; } $cleaner = new LangFileCleaner($sugar); $cleaner->clean($sort, $test); }
/** * @expectedException \Exception * @expectedExceptionMessageRegexp /Unable to load the file contents of/ */ public function testCleanFailure() { \PHPUnit_Framework_Error_Warning::$enabled = false; $err_level = error_reporting(); error_reporting($err_level & ~E_WARNING); $fake_sugar = __DIR__ . '/fake_sugar'; touch(self::$invalid_file); chmod(self::$invalid_file, 00); $logger = new TestLogger(); $cleaner = new LangFileCleaner(new Application($logger, $fake_sugar)); $this->assertTrue($cleaner->clean()); error_reporting($err_level); }