| Total Complexity | 6 |
| Total Lines | 47 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 7 | class ProgramTest extends UnitTestCase |
||
| 8 | { |
||
| 9 | public function testInstantiation() |
||
| 10 | { |
||
| 11 | $this->assertInstanceOf('Lyal\Checkr\Entities\Resources\Program', $this->getProgram()); |
||
| 12 | } |
||
| 13 | |||
| 14 | public function testSetId() |
||
| 15 | { |
||
| 16 | $program = $this->getProgram(); |
||
| 17 | $program->id = 'e44aa283528e6fde7d542194'; |
||
| 18 | $this->assertSame('e44aa283528e6fde7d542194',$program->id); |
||
| 19 | } |
||
| 20 | |||
| 21 | public function testFields() |
||
| 22 | { |
||
| 23 | $values = [ |
||
| 24 | 'id' => '00166f9ff39ec7b453adfaec', |
||
| 25 | 'object' => 'program', |
||
| 26 | 'name' => 'Program A', |
||
| 27 | 'created_at' => '2017-08-07T16:51:09Z', |
||
| 28 | 'deleted_at' => NULL, |
||
| 29 | 'geo_ids' => |
||
| 30 | [ |
||
| 31 | 'cbc37748bc6a45b41af5c3f5', |
||
| 32 | ], |
||
| 33 | 'package_ids' => |
||
| 34 | [ |
||
| 35 | 'a57a0cd15965a585ff7d5d35', |
||
| 36 | ] |
||
| 37 | ]; |
||
| 38 | |||
| 39 | $program = $this->getProgram($values); |
||
| 40 | |||
| 41 | foreach ($values as $key => $value) { |
||
| 42 | if (is_array($value)) { |
||
| 43 | $value = collect($value); |
||
| 44 | } |
||
| 45 | |||
| 46 | $this->assertEquals($value, $program->{$key}); |
||
| 47 | } |
||
| 48 | |||
| 49 | } |
||
| 50 | |||
| 51 | protected function getProgram($values = NULL) |
||
| 52 | { |
||
| 53 | return new Program($values,$this->getClient()); |
||
| 54 | } |
||
| 55 | } |