From 6fa73e59615a7382fd4bf3de2442ad5e6fb5ac1b Mon Sep 17 00:00:00 2001 From: Craig Paul Date: Tue, 25 Oct 2016 19:43:15 -0600 Subject: [PATCH] Updates customer tests to match new preparable setting --- tests/CustomerTest.php | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/tests/CustomerTest.php b/tests/CustomerTest.php index f2d16d3..fbe3786 100644 --- a/tests/CustomerTest.php +++ b/tests/CustomerTest.php @@ -10,10 +10,7 @@ public function it_can_instantiate_via_the_constructor() $customer = new Customer(); $this->assertEquals(Customer::class, get_class($customer)); - $this->assertObjectHasAttribute('id', $customer); - $this->assertObjectHasAttribute('email', $customer); - $this->assertObjectHasAttribute('phone', $customer); - $this->assertObjectHasAttribute('note', $customer); + $this->assertObjectHasAttribute('data', $customer); } /** @test */ @@ -22,9 +19,23 @@ public function it_can_instantiate_via_a_static_create_method() $customer = Customer::create(); $this->assertEquals(Customer::class, get_class($customer)); - $this->assertObjectHasAttribute('id', $customer); - $this->assertObjectHasAttribute('email', $customer); - $this->assertObjectHasAttribute('phone', $customer); - $this->assertObjectHasAttribute('note', $customer); + $this->assertObjectHasAttribute('data', $customer); + } + + /** @test */ + public function it_can_access_customer_data_that_exists_on_the_class() + { + $params = [ + 'id' => uniqid('customer-', true), + 'email' => 'example@email.com', + 'phone' => '555-555-5555', + 'note' => 'Customer note', + ]; + $customer = Customer::create($params); + + $this->assertEquals($params['id'], $customer->id); + $this->assertEquals($params['email'], $customer->email); + $this->assertEquals($params['phone'], $customer->phone); + $this->assertEquals($params['note'], $customer->note); } } \ No newline at end of file