Пример #1
0
 /**
  * Test that XML generated from response matches expected.
  *
  * @dataProvider responseArrayProvider
  **/
 public function testExpectedXML($response, $expectedXML)
 {
     $outputXML = new Frapi_Output_XML();
     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.');
         }
     }
 }
Пример #2
0
 /**
  * Test the XML output of an empty response from action.
  **/
 public function testCustomTemplate()
 {
     $outputXML = new Frapi_Output_XML();
     $outputXML->populateOutput(array('custom'), 'CustomTesting2');
     $this->assertXMLStringEqualsXMLString('<response><custom /></response>', $outputXML->executeOutput());
 }