Skip to content

Commit

Permalink
Add tests to Transaction model
Browse files Browse the repository at this point in the history
  • Loading branch information
Nuno Rafael Rocha committed Jul 23, 2015
1 parent 0a3a2d7 commit 2e3ceca
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions test/Bitreserve/Tests/Unit/Model/TransactionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,7 @@ public function shouldThrowAnErrorOnCancelWhenStatusIsPending()
/**
* @test
* @expectedException Bitreserve\Exception\LogicException
* @expectedExceptionMessage Origin `CardId` is missing from this transaction
*/
public function shouldThrowAnErrorOnCancelWhenCardIdIsNotDefined()
{
Expand All @@ -313,6 +314,45 @@ public function shouldThrowAnErrorOnCancelWhenCardIdIsNotDefined()
$transaction->cancel();
}

/**
* @test
* @expectedException Bitreserve\Exception\LogicException
* @expectedExceptionMessage Origin `CardId` is missing from this transaction
*/
public function shouldThrowAnErrorOnResendWhenCardIdIsNotDefined()
{
$data = array(
'id' => 'a97bb994-6e24-4a89-b653-e0a6d0bcf634',
);

$client = $this->getBitreserveClientMock();

$transaction = new Transaction($client, $data);
$transaction->resend();
}

/**
* @test
* @expectedException Bitreserve\Exception\LogicException
* @expectedExceptionMessage This transaction cannot be resent, because the current status is pending
*/
public function shouldThrowAnErrorOnResendWhenStatusIsNotWaiting()
{
$data = array(
'id' => 'a97bb994-6e24-4a89-b653-e0a6d0bcf634',
'origin' => array(
'CardId' => '91380a1f-c6f1-4d81-a204-8b40538c1f0d',
),
'signature' => '1d326154e7a68c64a650af9d3233d77b8a385ce0',
'status' => 'pending',
);

$client = $this->getBitreserveClientMock();

$transaction = new Transaction($client, $data);
$transaction->resend();
}

protected function getModelClass()
{
return 'Bitreserve\Model\Transaction';
Expand Down

0 comments on commit 2e3ceca

Please sign in to comment.