示例#1
0
 public function testConvert()
 {
     $inputData = new \DOMDocument();
     $inputData->load(__DIR__ . '/_files/formats_merged.xml');
     $expectedResult = (require __DIR__ . '/_files/formats_merged.php');
     $this->assertEquals($expectedResult, $this->_model->convert($inputData));
 }
示例#2
0
 public function testConvert()
 {
     $inputData = new \DOMDocument();
     $this->booleanUtilsMock->expects($this->any())->method('toBoolean')->willReturn(true);
     $inputData->load(__DIR__ . '/../../../../_files/zip_codes.xml');
     $expectedResult = (require __DIR__ . '/../../../../_files/zip_codes.php');
     $this->assertEquals($expectedResult, $this->model->convert($inputData));
 }
示例#3
0
 public function testRead()
 {
     $expectedResult = new \stdClass();
     $constraint = function (\DOMDocument $actual) {
         try {
             $expected = __DIR__ . '/_files/formats_merged.xml';
             \PHPUnit_Framework_Assert::assertXmlStringEqualsXmlFile($expected, $actual->saveXML());
             return true;
         } catch (\PHPUnit_Framework_AssertionFailedError $e) {
             return false;
         }
     };
     $this->_converter->expects($this->once())->method('convert')->with($this->callback($constraint))->will($this->returnValue($expectedResult));
     $this->assertSame($expectedResult, $this->_model->read('scope'));
 }