From 8b6fedd5f9a97b86f2f8a75a00903535698e5d31 Mon Sep 17 00:00:00 2001 From: Craig Paul Date: Fri, 21 Oct 2016 09:57:19 -0600 Subject: [PATCH] Adds instantiation tests for CreditCard --- src/CreditCard.php | 1 + tests/CreditCardTest.php | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 tests/CreditCardTest.php diff --git a/src/CreditCard.php b/src/CreditCard.php index 4e88856..3ddfe91 100644 --- a/src/CreditCard.php +++ b/src/CreditCard.php @@ -7,6 +7,7 @@ * * @property-read string $expiry * @property-read string $number + * @property-read int $crypt */ class CreditCard { diff --git a/tests/CreditCardTest.php b/tests/CreditCardTest.php new file mode 100644 index 0000000..5980f54 --- /dev/null +++ b/tests/CreditCardTest.php @@ -0,0 +1,27 @@ +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); + } +} \ No newline at end of file