|
1
|
|
|
<?php |
|
2
|
|
|
namespace Tests\Unit; |
|
3
|
|
|
|
|
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
|
|
|
} |