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

Commit

Permalink
Adds instantiation tests for CreditCard
Browse files Browse the repository at this point in the history
  • Loading branch information
Craig Paul committed Oct 21, 2016
1 parent 9b45366 commit 8b6fedd
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/CreditCard.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*
* @property-read string $expiry
* @property-read string $number
* @property-read int $crypt
*/
class CreditCard
{
Expand Down
27 changes: 27 additions & 0 deletions tests/CreditCardTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

use CraigPaul\Moneris\Crypt;
use CraigPaul\Moneris\CreditCard;

class CreditCardTest extends TestCase
{
/** @test */
public function it_can_instantiate_via_the_constructor()
{
$card = new CreditCard($this->visa, '2012', Crypt::SSL_ENABLED_MERCHANT);

$this->assertEquals(CreditCard::class, get_class($card));
$this->assertObjectHasAttribute('number', $card);
$this->assertObjectHasAttribute('expiry', $card);
}

/** @test */
public function it_can_instantiate_via_a_static_create_method()
{
$card = CreditCard::create($this->visa, '2012', Crypt::SSL_ENABLED_MERCHANT);

$this->assertEquals(CreditCard::class, get_class($card));
$this->assertObjectHasAttribute('number', $card);
$this->assertObjectHasAttribute('expiry', $card);
}
}

0 comments on commit 8b6fedd

Please sign in to comment.