| @@ 13-55 (lines=43) @@ | ||
| 10 | * Date: 10/23/17 |
|
| 11 | * Time: 4:58 PM |
|
| 12 | */ |
|
| 13 | class InvitationTest extends UnitTestCase |
|
| 14 | { |
|
| 15 | public function testInstantiation() |
|
| 16 | { |
|
| 17 | $this->assertInstanceOf('Lyal\Checkr\Entities\Resources\Invitation', $this->getInvitation()); |
|
| 18 | } |
|
| 19 | ||
| 20 | public function testSetId() |
|
| 21 | { |
|
| 22 | $invitation = $this->getInvitation(); |
|
| 23 | $invitation->id = 'e44aa283528e6fde7d542194'; |
|
| 24 | $this->assertSame('e44aa283528e6fde7d542194',$invitation->id); |
|
| 25 | } |
|
| 26 | ||
| 27 | public function testFields() |
|
| 28 | { |
|
| 29 | $values = [ |
|
| 30 | 'id' => 'e44aa283528e6fde7d542194', |
|
| 31 | 'status' => 'pending', |
|
| 32 | 'uri' => '/v1/invitations/e44aa283528e6fde7d542194', |
|
| 33 | 'invitation_url' => 'https://www.checkr.com/invitation', |
|
| 34 | 'completed_at' => NULL, |
|
| 35 | 'deleted_at' => NULL, |
|
| 36 | 'expires_at' => '2015-05-21T17:45:34Z', |
|
| 37 | 'package' => 'package', |
|
| 38 | 'object' => 'invitation', |
|
| 39 | 'created_at' => '2015-05-14T17:45:34Z', |
|
| 40 | 'candidate_id' => 'e44aa283528e6fde7d542194', |
|
| 41 | ]; |
|
| 42 | ||
| 43 | $invitation = $this->getInvitation($values); |
|
| 44 | ||
| 45 | foreach ($values as $key => $value) { |
|
| 46 | $this->assertEquals($value, $invitation->{$key}); |
|
| 47 | } |
|
| 48 | ||
| 49 | } |
|
| 50 | ||
| 51 | protected function getInvitation($values = NULL) |
|
| 52 | { |
|
| 53 | return new Invitation($values,$this->getClient()); |
|
| 54 | } |
|
| 55 | } |
|
| @@ 7-49 (lines=43) @@ | ||
| 4 | use Lyal\Checkr\Entities\Resources\Subscription; |
|
| 5 | use Tests\UnitTestCase; |
|
| 6 | ||
| 7 | class SubscriptionTest extends UnitTestCase |
|
| 8 | { |
|
| 9 | public function testInstantiation() |
|
| 10 | { |
|
| 11 | $this->assertInstanceOf('Lyal\Checkr\Entities\Resources\Subscription', $this->getSubscription()); |
|
| 12 | } |
|
| 13 | ||
| 14 | public function testSetId() |
|
| 15 | { |
|
| 16 | $subscription = $this->getSubscription(); |
|
| 17 | $subscription->id = 'e44aa283528e6fde7d542194'; |
|
| 18 | $this->assertSame('e44aa283528e6fde7d542194',$subscription->id); |
|
| 19 | } |
|
| 20 | ||
| 21 | public function testFields() |
|
| 22 | { |
|
| 23 | $values = [ |
|
| 24 | 'id' => '4722c07dd9a10c3985ae432a', |
|
| 25 | 'object' => 'subscription', |
|
| 26 | 'uri' => '/v1/subscriptions/4722c07dd9a10c3985ae432a', |
|
| 27 | 'status' => 'active', |
|
| 28 | 'created_at' => '2014-01-18T12:34:00Z', |
|
| 29 | 'canceled_at' => NULL, |
|
| 30 | 'package' => 'driver_pro', |
|
| 31 | 'interval_count' => 1, |
|
| 32 | 'interval_unit' => 'month', |
|
| 33 | 'start_date' => '2014-06-10', |
|
| 34 | 'candidate_id' => 'e44aa283528e6fde7d542194', |
|
| 35 | ]; |
|
| 36 | ||
| 37 | $subscription = $this->getSubscription($values); |
|
| 38 | ||
| 39 | foreach ($values as $key => $value) { |
|
| 40 | $this->assertEquals($value, $subscription->{$key}); |
|
| 41 | } |
|
| 42 | ||
| 43 | } |
|
| 44 | ||
| 45 | protected function getSubscription($values = NULL) |
|
| 46 | { |
|
| 47 | return new Subscription($values,$this->getClient()); |
|
| 48 | } |
|
| 49 | } |
|