From 02d23c1b5d42626cd2425d5458ed739a36f65e9d Mon Sep 17 00:00:00 2001 From: Craig Paul Date: Tue, 25 Oct 2016 07:44:53 -0600 Subject: [PATCH] Removes static references from tests --- tests/ProcessorTest.php | 20 ++++++++++++++++++-- tests/ResponseTest.php | 12 ++++++++++-- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/tests/ProcessorTest.php b/tests/ProcessorTest.php index ff631bb..f4f637d 100644 --- a/tests/ProcessorTest.php +++ b/tests/ProcessorTest.php @@ -22,6 +22,13 @@ class ProcessorTest extends TestCase */ protected $params; + /** + * The Processor instance. + * + * @var \CraigPaul\Moneris\Processor + */ + protected $processor; + /** * The Transaction instance. * @@ -49,6 +56,15 @@ public function setUp() 'expdate' => '2012', ]; $this->transaction = new Transaction($this->gateway, $this->params); + $this->processor = new Processor(); + } + + /** @test */ + public function it_can_instantiate_via_the_constructor() + { + $processor = new Processor(); + + $this->assertEquals(Processor::class, get_class($processor)); } /** @test */ @@ -56,7 +72,7 @@ public function it_responds_to_an_invalid_transaction_with_the_proper_code_and_s { $transaction = new Transaction($this->gateway); - $response = Processor::process($transaction); + $response = $this->processor->process($transaction); $this->assertFalse($response->successful); $this->assertEquals(Response::INVALID_TRANSACTION_DATA, $response->status); @@ -65,7 +81,7 @@ public function it_responds_to_an_invalid_transaction_with_the_proper_code_and_s /** @test */ public function it_can_submit_a_proper_request_to_the_moneris_api() { - $response = Processor::process($this->transaction); + $response = $this->processor->process($this->transaction); $this->assertTrue($response->successful); } diff --git a/tests/ResponseTest.php b/tests/ResponseTest.php index 1050a7f..7013245 100644 --- a/tests/ResponseTest.php +++ b/tests/ResponseTest.php @@ -22,6 +22,13 @@ class ResponseTest extends TestCase */ protected $params; + /** + * The Processor instance. + * + * @var \CraigPaul\Moneris\Processor + */ + protected $processor; + /** * The Response instance. * @@ -56,6 +63,7 @@ public function setUp() 'expdate' => '2012', ]; $this->transaction = new Transaction($this->gateway, $this->params); + $this->processor = new Processor(); } /** @test */ @@ -83,7 +91,7 @@ public function it_can_instantiate_via_a_static_create_method() /** @test */ public function it_can_validate_an_api_response_from_a_proper_transaction() { - $response = Processor::process($this->transaction); + $response = $this->processor->process($this->transaction); $response = $response->validate(); @@ -93,7 +101,7 @@ public function it_can_validate_an_api_response_from_a_proper_transaction() /** @test */ public function it_can_receive_a_receipt_from_a_properly_processed_transaction() { - $response = Processor::process($this->transaction); + $response = $this->processor->process($this->transaction); /** @var \CraigPaul\Moneris\Response $response */ $response = $response->validate();