/** * Clean all sugar language files. */ public function clean($sort = true, $test = false) { $finder = new Finder(); $finder->files()->in($this->getApplication()->getPath())->path('/^custom\\/include\\/language/')->depth('== 3')->name('*.lang.php'); $found_one = false; foreach ($finder as $file) { $this->getLogger()->notice('Processing file ' . $file); $found_one = true; $content = file_get_contents($file); if ($content === false) { throw new \Exception('Unable to load the file contents of ' . $file . '.'); } $lang = new LangFile($this->getLogger(), $content, $test); file_put_contents($file, $lang->getSortedFile($sort)); } if (!$found_one) { $this->getLogger()->notice('No lang files found to process.'); return false; } return true; }
/** * @dataProvider fileFailureProvider * @expectedException \Exception */ public function testFileFailure($input_file) { $logger = new TestLogger(); $lang_file = new LangFile($logger, $input_file, true); $res = $lang_file->getSortedFile(); }