/** * @dataProvider actionProvider */ public function testDeserializeResponse($class, $method, $func) { $error = new Error('DATA_ERROR', '24998', 'Demo-card or demo-mode transactions are not allowed without demo terminal mode.'); $error->advices = ["Inspect your card number or remove attribute mode=''demo'' of tag 'CC_TRANSACTION'"]; $processing = new ProcessingStatus('8WERH84', 'INFO', 'NOK'); $processing->guWid = 'C895978124540997772104'; $processing->timeStamp = new \DateTime('2009-06-19 13:12:57', new \DateTimeZone('UTC')); $processing->error = $error; $transaction = new Transaction(); $transaction->mode = Transaction::MODE_DEMO; $transaction->id = '9457892347623478'; $transaction->processingStatus = $processing; $action = new $class($transaction); $action->id = 'authentication 1'; $job = call_user_func_array(['\\Wirecard\\Element\\Job', $method], ['0123456789ABCDEF', $action]); $job->id = 'job 1'; $response = new Response($job); $wirecard = WireCard::createWithResponse($response); $xmlString = file_get_contents(__DIR__ . "/data/Response.xml"); $xmlString = str_replace('FNC_CC_', 'FNC_CC_' . $func, $xmlString); $wirecardExpected = $this->serializer->deserialize($xmlString, 'Wirecard\\Element\\WireCard', 'xml'); $this->assertEquals($wirecardExpected, $wirecard); }
public function testWireCardHasResponse() { $response = $this->getMockBuilder('\\Wirecard\\Element\\Response')->disableOriginalConstructor()->getMock(); $wireCard = WireCard::createWithResponse($response); $this->assertInstanceOf('\\Wirecard\\Element\\Response', $wireCard->response); }