/**
  * @covers \Magento\Setup\Module\I18n\Parser\Adapter\Php\Tokenizer\Translate\MethodCollector::parse
  */
 public function testParse()
 {
     $file = __DIR__ . '/../_files/methodsCode.php.txt';
     $this->methodCollector->parse($file);
     $expectation = [['phrase' => '\'Some string\'', 'arguments' => 0, 'file' => $file, 'line' => 4], ['phrase' => '\'One more string\'', 'arguments' => 0, 'file' => $file, 'line' => 5]];
     $this->assertEquals($expectation, $this->methodCollector->getPhrases());
 }
Esempio n. 2
0
 public function testSignature()
 {
     $errors = [];
     foreach ($this->_getFiles() as $file) {
         $this->_phraseCollector->parse($file);
         foreach ($this->_phraseCollector->getPhrases() as $phrase) {
             $errors[] = $this->_createPhraseError($phrase);
         }
     }
     $this->assertEmpty($errors, sprintf('%d usages of the old translation method call were discovered: %s', count($errors), implode("\n\n", $errors)));
 }