public function testConvert()
 {
     $data = (include __DIR__ . '/../_files/mview_config.php');
     $dom = new \DOMDocument();
     $dom->loadXML($data['inputXML']);
     $this->assertEquals($data['expected'], $this->_model->convert($dom));
 }
示例#2
0
 /**
  * @dataProvider readerDataProvider
  */
 public function testReadValidConfig($files, $expectedFile)
 {
     $this->_fileResolverMock->expects($this->once())->method('get')->with('mview.xml', 'scope')->will($this->returnValue($files));
     $constraint = function (\DOMDocument $actual) use($expectedFile) {
         try {
             $expected = file_get_contents(__DIR__ . '/../_files/' . $expectedFile);
             \PHPUnit_Framework_Assert::assertXmlStringEqualsXmlString($expected, $actual->saveXML());
             return true;
         } catch (\PHPUnit_Framework_AssertionFailedError $e) {
             return false;
         }
     };
     $expectedResult = new \stdClass();
     $this->_converter->expects($this->once())->method('convert')->with($this->callback($constraint))->will($this->returnValue($expectedResult));
     $this->assertSame($expectedResult, $this->_model->read('scope'));
 }
示例#3
0
 /**
  * @param string $xmlData
  * @dataProvider wrongXmlDataProvider
  * @expectedException \Exception
  */
 public function testMapThrowsExceptionWhenXmlHasWrongFormat($xmlData)
 {
     $dom = new \DOMDocument();
     $dom->loadXML($xmlData);
     $this->_model->convert($dom);
 }