@@ 45-64 (lines=20) @@ | ||
42 | $this->assertEquals('mendel',$rules['@author'][0][0]); |
|
43 | } |
|
44 | ||
45 | public function testDirectFields() |
|
46 | { |
|
47 | $helper = new MetaDataHelper(); |
|
48 | $fields = $helper->fieldsRules(dummy\DummyModel::class); |
|
49 | ||
50 | $this->assertIsArray($fields); |
|
51 | $this->assertCount(2, $fields); |
|
52 | $this->assertArrayHasKey('name', $fields); |
|
53 | $this->assertArrayHasKey('age', $fields); |
|
54 | ||
55 | $this->assertIsArray($fields['name']); |
|
56 | $this->assertCount(1, $fields['name']); |
|
57 | $this->assertArrayHasKey('@var', $fields['name']); |
|
58 | $this->assertEquals([['string','name']],$fields['name']['@var']); |
|
59 | ||
60 | $this->assertIsArray($fields['age']); |
|
61 | $this->assertCount(1, $fields['age']); |
|
62 | $this->assertArrayHasKey('@var', $fields['age']); |
|
63 | $this->assertEquals([['int','age']],$fields['age']['@var']); |
|
64 | } |
|
65 | ||
66 | public function testDirectMethods() |
|
67 | { |
|
@@ 85-104 (lines=20) @@ | ||
82 | $this->assertEquals([['array']],$methods['dehydrate']['@return']); |
|
83 | } |
|
84 | ||
85 | public function testExtendedFields() |
|
86 | { |
|
87 | $helper = new MetaDataHelper(); |
|
88 | $fields = $helper->fieldsRules(dummy\DummyExtendedModel::class); |
|
89 | ||
90 | $this->assertIsArray($fields); |
|
91 | $this->assertCount(2, $fields); |
|
92 | $this->assertArrayHasKey('name', $fields); |
|
93 | $this->assertArrayHasKey('age', $fields); |
|
94 | ||
95 | $this->assertIsArray($fields['name']); |
|
96 | $this->assertCount(1, $fields['name']); |
|
97 | $this->assertArrayHasKey('@var', $fields['name']); |
|
98 | $this->assertEquals([['string','name']],$fields['name']['@var']); |
|
99 | ||
100 | $this->assertIsArray($fields['age']); |
|
101 | $this->assertCount(1, $fields['age']); |
|
102 | $this->assertArrayHasKey('@var', $fields['age']); |
|
103 | $this->assertEquals([['int','age']],$fields['age']['@var']); |
|
104 | } |
|
105 | } |
|
106 |