|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Chadicus\Marvel\Api\Entities; |
|
4
|
|
|
|
|
5
|
|
|
/** |
|
6
|
|
|
* @coversDefaultClass \Chadicus\Marvel\Api\Entities\Creator |
|
7
|
|
|
* @covers ::<protected> |
|
8
|
|
|
* |
|
9
|
|
|
*/ |
|
10
|
|
|
final class CreatorTest extends \PHPUnit_Framework_TestCase |
|
11
|
|
|
{ |
|
12
|
|
|
/** |
|
13
|
|
|
* Verifies basic behaviour of the Creator class |
|
14
|
|
|
* |
|
15
|
|
|
* @test |
|
16
|
|
|
* |
|
17
|
|
|
* @return void |
|
18
|
|
|
*/ |
|
19
|
|
|
public function basicUsage() |
|
20
|
|
|
{ |
|
21
|
|
|
$data = [ |
|
22
|
|
|
'id' => 0, |
|
23
|
|
|
'firstName' => 'a firstName', |
|
24
|
|
|
'middleName' => 'a middleName', |
|
25
|
|
|
'lastName' => 'a lastName', |
|
26
|
|
|
'suffix' => 'a suffix', |
|
27
|
|
|
'fullName' => 'a fullName', |
|
28
|
|
|
'modified' => 'Fri, 31 Jul 2015 19:45:00 -0400', |
|
29
|
|
|
'resourceURI' => 'a resourceURI', |
|
30
|
|
|
'urls' => [['type' => 'a type', 'url' => 'a url']], |
|
31
|
|
|
'thumbnail' => ['path' => 'an image path', 'extension' => 'an image extension'], |
|
32
|
|
|
'series' => ['available' => 2, 'returned' => 1, 'collectionURI' => 'a collection URI', 'items' => []], |
|
33
|
|
|
'stories' => ['available' => 5, 'returned' => 4, 'collectionURI' => 'a collection URI', 'items' => []], |
|
34
|
|
|
'comics' => ['available' => 9, 'returned' => 8, 'collectionURI' => 'a collection URI', 'items' => []], |
|
35
|
|
|
'events' => ['available' => 5, 'returned' => 4, 'collectionURI' => 'a collection URI', 'items' => []], |
|
36
|
|
|
]; |
|
37
|
|
|
|
|
38
|
|
|
$creator = new Creator($data); |
|
39
|
|
|
$this->assertSame($data['id'], $creator->id); |
|
40
|
|
|
$this->assertSame($data['firstName'], $creator->firstName); |
|
41
|
|
|
$this->assertSame($data['middleName'], $creator->middleName); |
|
42
|
|
|
$this->assertSame($data['lastName'], $creator->lastName); |
|
43
|
|
|
$this->assertSame($data['suffix'], $creator->suffix); |
|
44
|
|
|
$this->assertSame($data['fullName'], $creator->fullName); |
|
45
|
|
|
$this->assertSame($data['modified'], $creator->modified->format('r')); |
|
46
|
|
|
$this->assertSame($data['resourceURI'], $creator->resourceURI); |
|
47
|
|
|
$this->assertSame(count($data['urls']), count($creator->urls)); |
|
48
|
|
|
$this->assertSame($data['urls'][0]['type'], $creator->urls[0]->type); |
|
49
|
|
|
$this->assertSame($data['urls'][0]['url'], $creator->urls[0]->url); |
|
50
|
|
|
$this->assertSame($data['thumbnail']['path'], $creator->thumbnail->path); |
|
51
|
|
|
$this->assertSame($data['thumbnail']['extension'], $creator->thumbnail->extension); |
|
52
|
|
|
$this->assertSame($data['series']['available'], $creator->series->available); |
|
53
|
|
|
$this->assertSame($data['series']['returned'], $creator->series->returned); |
|
54
|
|
|
$this->assertSame($data['series']['collectionURI'], $creator->series->collectionURI); |
|
55
|
|
|
$this->assertSame($data['stories']['available'], $creator->stories->available); |
|
56
|
|
|
$this->assertSame($data['stories']['returned'], $creator->stories->returned); |
|
57
|
|
|
$this->assertSame($data['stories']['collectionURI'], $creator->stories->collectionURI); |
|
58
|
|
|
$this->assertSame($data['comics']['available'], $creator->comics->available); |
|
59
|
|
|
$this->assertSame($data['comics']['returned'], $creator->comics->returned); |
|
60
|
|
|
$this->assertSame($data['comics']['collectionURI'], $creator->comics->collectionURI); |
|
61
|
|
|
$this->assertSame($data['events']['available'], $creator->events->available); |
|
62
|
|
|
$this->assertSame($data['events']['returned'], $creator->events->returned); |
|
63
|
|
|
$this->assertSame($data['events']['collectionURI'], $creator->events->collectionURI); |
|
64
|
|
|
} |
|
65
|
|
|
} |
|
66
|
|
|
|