Exemplo n.º 1
0
 /**
  * @param array $options
  * @param array $phpFiles
  * @param array $jsFiles
  * @param array $phpMap
  * @param array $jsMap
  * @paran array $phraseFactoryMap
  * @param array $expectedResult
  * @dataProvider addPhraseDataProvider
  */
 public function testAddPhrase($options, $phpFiles, $jsFiles, $phpMap, $jsMap, $phraseFactoryMap, $expectedResult)
 {
     // 1. Create mocks
     $phpAdapter = new AdapterStub();
     $jsAdapter = new AdapterStub();
     // 2. Set mocks
     $this->parser->addAdapter('php', $phpAdapter);
     $this->parser->addAdapter('js', $jsAdapter);
     //3. Set fixtures
     $phpAdapter->setValueMap($phpMap);
     $jsAdapter->setValueMap($jsMap);
     $this->factory->expects($this->any())->method('createPhrase')->with()->willReturnMap($phraseFactoryMap);
     //4. Set expectations
     $this->filesCollector->expects($this->any())->method('getFiles')->will($this->returnValueMap([[$options[0]['paths'], '', $phpFiles], [$options[1]['paths'], '', $jsFiles]]));
     $result = $this->parser->parse($options);
     $this->assertEquals($expectedResult, $result);
 }
 /**
  * @param array $options
  * @param string $message
  * @dataProvider dataProviderForValidateOptions
  */
 public function testValidateOptions($options, $message)
 {
     $this->setExpectedException('InvalidArgumentException', $message);
     $this->_parserMock->addAdapter('php', $this->getMock('Magento\\Setup\\Module\\I18n\\Parser\\AdapterInterface'));
     $this->_parserMock->parse($options);
 }