/** * 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.'); } } }