예제 #1
0
파일: XMLTest.php 프로젝트: crlang44/frapi
 /**
  * Test that XML generated from response matches expected.
  *
  * @dataProvider responseArrayProvider
  **/
 public function testExpectedXML($response, $expectedXML)
 {
     $outputXML = new Frapi_Output_XML();
     $outputXML->setNumericKey(true);
     try {
         $outputXML->populateOutput($response);
     } catch (Frapi_Output_XML_Exception $e) {
         if ($expectedXML !== false) {
             $this->fail('Expected Frapi_Output_XML_Exception because of invalid element names.');
         }
     }
     if ($expectedXML !== false) {
         $generatedXML = $outputXML->executeOutput();
         $this->assertXMLStringEqualsXMLString($expectedXML, $generatedXML);
         try {
             simplexml_load_string($generatedXML);
         } catch (Exception $e) {
             $this->fail('Invalid XML generated.');
         }
     }
 }