From 4329c15dea2b0756dea10ba2e11bcdae3489d39b Mon Sep 17 00:00:00 2001 From: Craig Paul Date: Fri, 21 Oct 2016 15:33:14 -0600 Subject: [PATCH] Adds test for receipt method --- tests/ResponseTest.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/ResponseTest.php b/tests/ResponseTest.php index 6d0be72..1050a7f 100644 --- a/tests/ResponseTest.php +++ b/tests/ResponseTest.php @@ -89,4 +89,21 @@ public function it_can_validate_an_api_response_from_a_proper_transaction() $this->assertTrue($response->successful); } + + /** @test */ + public function it_can_receive_a_receipt_from_a_properly_processed_transaction() + { + $response = Processor::process($this->transaction); + + /** @var \CraigPaul\Moneris\Response $response */ + $response = $response->validate(); + $receipt = $response->receipt(); + + $this->assertNotNull($receipt); + $this->assertEquals(SimpleXMLElement::class, get_class($receipt)); + $this->assertEquals($this->params['order_id'], $receipt->ReceiptId); + $this->assertObjectHasAttribute('TransID', $receipt); + $this->assertObjectHasAttribute('ReferenceNum', $receipt); + $this->assertObjectHasAttribute('Complete', $receipt); + } } \ No newline at end of file