Skip to content
This repository has been archived by the owner on Oct 30, 2020. It is now read-only.

Commit

Permalink
Removes static references from tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Craig Paul committed Oct 25, 2016
1 parent ebf3791 commit 02d23c1
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 4 deletions.
20 changes: 18 additions & 2 deletions tests/ProcessorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ class ProcessorTest extends TestCase
*/
protected $params;

/**
* The Processor instance.
*
* @var \CraigPaul\Moneris\Processor
*/
protected $processor;

/**
* The Transaction instance.
*
Expand Down Expand Up @@ -49,14 +56,23 @@ 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 */
public function it_responds_to_an_invalid_transaction_with_the_proper_code_and_status()
{
$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);
Expand All @@ -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);
}
Expand Down
12 changes: 10 additions & 2 deletions tests/ResponseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ class ResponseTest extends TestCase
*/
protected $params;

/**
* The Processor instance.
*
* @var \CraigPaul\Moneris\Processor
*/
protected $processor;

/**
* The Response instance.
*
Expand Down Expand Up @@ -56,6 +63,7 @@ public function setUp()
'expdate' => '2012',
];
$this->transaction = new Transaction($this->gateway, $this->params);
$this->processor = new Processor();
}

/** @test */
Expand Down Expand Up @@ -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();

Expand All @@ -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();
Expand Down

0 comments on commit 02d23c1

Please sign in to comment.