Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
MethodCollectorTest.php
Go to the documentation of this file.
1 <?php
7 
10 
14 class MethodCollectorTest extends \PHPUnit\Framework\TestCase
15 {
19  protected $methodCollector;
20 
24  protected $objectManager;
25 
26  protected function setUp()
27  {
28  $this->objectManager = Bootstrap::getObjectManager();
29  $this->methodCollector = $this->objectManager->create(
30  \Magento\Setup\Module\I18n\Parser\Adapter\Php\Tokenizer\Translate\MethodCollector::class
31  );
32  }
33 
37  public function testParse()
38  {
39  $file = __DIR__.'/../_files/methodsCode.php.txt';
40  $this->methodCollector->parse($file);
41  $expectation = [
42  [
43  'phrase' => '\'Some string\'',
44  'arguments' => 0,
45  'file' => $file,
46  'line' => 4
47  ],
48  [
49  'phrase' => '\'One more string\'',
50  'arguments' => 0,
51  'file' => $file,
52  'line' => 5
53  ]
54  ];
55  $this->assertEquals($expectation, $this->methodCollector->getPhrases());
56  }
57 }
defined('TESTS_BP')||define('TESTS_BP' __DIR__
Definition: _bootstrap.php:60