public function setUp() { parent::setUp(); if (!defined('IN_PHPBB')) { // Need to set this, otherwise we can not load the language files define('IN_PHPBB', true); } $this->validator = new \Phpbb\TranslationValidator\Validator\FileValidator($this->getMock('Symfony\\Component\\Console\\Input\\InputInterface'), $this->output); $this->validator->setOrigin('origin', dirname(__FILE__) . '/fixtures/origin', 'language/origin/')->setSource('source', dirname(__FILE__) . '/fixtures/source', 'language/source/')->setPhpbbVersion('3.0'); }
/** * Run the actual test suite. */ public function runValidators() { $filelistValidator = new FileListValidator($this->input, $this->output); $validateFiles = $filelistValidator->setSource($this->sourceIso, $this->sourcePath, $this->sourceLanguagePath)->setOrigin($this->originIso, $this->originPath, $this->originLanguagePath)->setPhpbbVersion($this->phpbbVersion)->setDebug($this->debug)->validate(); if (empty($validateFiles)) { $this->output->writelnIfDebug(''); $this->output->writelnIfDebug("<fatal>No files found for validation.</fatal>"); return; } $pluralRule = $this->guessPluralRule(); $this->output->writelnIfDebug("<notice>Using plural rule #{$pluralRule} for validation.</notice>"); $this->output->writelnIfDebug(''); $this->output->writelnIfDebug("Validating file list:"); $this->printErrorLevel($this->output); $this->maxProgress = sizeof($validateFiles) + 1; $this->progressLength = 11 + strlen($this->maxProgress) * 2; $filelistValidator = new FileValidator($this->input, $this->output); $filelistValidator->setSource($this->sourceIso, $this->sourcePath, $this->sourceLanguagePath)->setOrigin($this->originIso, $this->originPath, $this->originLanguagePath)->setPhpbbVersion($this->phpbbVersion)->setPluralRule($pluralRule)->setDebug($this->debug); foreach ($validateFiles as $sourceFile => $originFile) { $this->output->writelnIfDebug(''); $this->output->writelnIfDebug("Validating file: {$originFile}"); $filelistValidator->validate($sourceFile, $originFile); $this->printErrorLevel($this->output); usleep(31250); //125000); } $this->output->writeln('.'); }