/** * @param Payment $payment * * @dataProvider dataProvider */ public function testXMLGeneration($payment) { $prophet = new Prophet(); $orderService = $prophet->prophesize('Checkdomain\\TeleCash\\IPG\\API\\Service\\OrderService'); $validate = new ValidateHostedData($orderService->reveal(), $payment); $document = $validate->getDocument(); $document->appendChild($validate->getElement()); $elementValidate = $document->getElementsByTagName('ns2:Validate'); $this->assertEquals(1, $elementValidate->length, 'Expected element Validate not found'); $children = []; /** @var \DOMNode $child */ foreach ($elementValidate->item(0)->childNodes as $child) { $children[$child->nodeName] = $child->nodeValue; } $this->assertArrayHasKey('ns1:Payment', $children, 'Expected element Payment not found'); //no need to further test Payment, as this is already covered in PaymentTest }
/** * Validate externally store data * * @param string $hostedDataId * * @return Response\Action\Validation|Response\Error * @throws \Exception */ public function validateHostedData($hostedDataId) { $service = $this->getService(); $payment = new Model\Payment($hostedDataId); $validateAction = new Request\Action\ValidateHostedData($service, $payment); return $validateAction->validate(); }