Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AbstractParserTest.php
Go to the documentation of this file.
1 <?php
7 
8 class AbstractParserTest extends \PHPUnit\Framework\TestCase
9 {
13  protected $_parserMock;
14 
15  protected function setUp()
16  {
17  $this->_parserMock = $this->getMockForAbstractClass(
18  \Magento\Setup\Module\I18n\Parser\AbstractParser::class,
19  [],
20  '',
21  false
22  );
23  }
24 
31  {
32  $this->expectException('InvalidArgumentException');
33  $this->expectExceptionMessage($message);
34 
35  $this->_parserMock->addAdapter(
36  'php',
37  $this->createMock(\Magento\Setup\Module\I18n\Parser\AdapterInterface::class)
38  );
39  $this->_parserMock->parse($options);
40  }
41 
46  {
47  return [
48  [[['paths' => []]], 'Missed "type" in parser options.'],
49  [[['type' => '', 'paths' => []]], 'Missed "type" in parser options.'],
50  [
51  [['type' => 'wrong_type', 'paths' => []]],
52  'Adapter is not set for type "wrong_type".'
53  ],
54  [[['type' => 'php']], '"paths" in parser options must be array.'],
55  [[['type' => 'php', 'paths' => '']], '"paths" in parser options must be array.']
56  ];
57  }
58 
59  public function getPhrases()
60  {
61  $this->assertInternalType('array', $this->_parserMock->getPhrases());
62  }
63 }
$message