1 | <?php |
||
11 | final class AbstractEntityTest extends \PHPUnit_Framework_TestCase |
||
12 | { |
||
13 | /** |
||
14 | * Verify basic functionality of fromArrays() |
||
15 | * |
||
16 | * @test |
||
17 | * @covers ::fromArrays |
||
18 | * @covers ::__construct |
||
19 | * @covers ::__call |
||
20 | * @covers ::__get |
||
21 | * |
||
22 | * @return void |
||
23 | */ |
||
24 | public function basicUsage() |
||
32 | |||
33 | /** |
||
34 | * Verify behavior of __get() with invalid property name. |
||
35 | * |
||
36 | * @test |
||
37 | * @covers ::__get |
||
38 | * @expectedException \Chadicus\Spl\Exceptions\UndefinedPropertyException |
||
39 | * @expectedExceptionMessage Undefined Property Chadicus\Marvel\Api\Entities\SimpleEntity::$foo |
||
40 | * |
||
41 | * @return void |
||
42 | */ |
||
43 | public function getUndefined() |
||
47 | |||
48 | /** |
||
49 | * Verify behavior of __call() with a non-get method call. |
||
50 | * |
||
51 | * @test |
||
52 | * @covers ::__call |
||
53 | * @expectedException \BadMethodCallException |
||
54 | * @expectedExceptionMessage Chadicus\Marvel\Api\Entities\SimpleEntity::doSomething() does not exist |
||
55 | * |
||
56 | * @return void |
||
57 | */ |
||
58 | public function callNonGet() |
||
62 | |||
63 | /** |
||
64 | * Verify behavior of __call() with a un defined property. |
||
65 | * |
||
66 | * @test |
||
67 | * @covers ::__call |
||
68 | * @expectedException \BadMethodCallException |
||
69 | * @expectedExceptionMessage Chadicus\Marvel\Api\Entities\SimpleEntity::getFoo() does not exist |
||
70 | * |
||
71 | * @return void |
||
72 | */ |
||
73 | public function callUndefined() |
||
77 | |||
78 | /** |
||
79 | * Verify basic behavior of fromArray(). |
||
80 | * |
||
81 | * @test |
||
82 | * @covers ::fromArray |
||
83 | * |
||
84 | * @return void |
||
85 | */ |
||
86 | public function fromArray() |
||
91 | |||
92 | /** |
||
93 | * Verify basic behavior of offsetExists(). |
||
94 | * |
||
95 | * @test |
||
96 | * @covers ::offsetExists |
||
97 | * |
||
98 | * @return void |
||
99 | */ |
||
100 | public function offsetExists() |
||
106 | |||
107 | /** |
||
108 | * Verify basic behavior of offsetGet(). |
||
109 | * |
||
110 | * @test |
||
111 | * @covers ::offsetGet |
||
112 | * |
||
113 | * @return void |
||
114 | */ |
||
115 | public function offsetGet() |
||
120 | |||
121 | /** |
||
122 | * Verify basic behavior of offsetSet(). |
||
123 | * |
||
124 | * @test |
||
125 | * @covers ::offsetSet |
||
126 | * @expectedException \Chadicus\Spl\Exceptions\NotAllowedException |
||
127 | * @expectedExceptionMessage Chadicus\Marvel\Api\Entities\SimpleEntity::$field is read-only |
||
128 | * |
||
129 | * @return void |
||
130 | */ |
||
131 | public function offsetSet() |
||
136 | |||
137 | /** |
||
138 | * Verify basic behavior of offsetUnset(). |
||
139 | * |
||
140 | * @test |
||
141 | * @covers ::offsetUnset |
||
142 | * @expectedException \Chadicus\Spl\Exceptions\NotAllowedException |
||
143 | * @expectedExceptionMessage Chadicus\Marvel\Api\Entities\SimpleEntity::$field is read-only |
||
144 | * |
||
145 | * @return void |
||
146 | */ |
||
147 | public function offsetUnset() |
||
152 | } |
||
153 |
Since your code implements the magic getter
_get
, this function will be called for any read access on an undefined variable. You can add the@property
annotation to your class or interface to document the existence of this variable.If the property has read access only, you can use the @property-read annotation instead.
Of course, you may also just have mistyped another name, in which case you should fix the error.
See also the PhpDoc documentation for @property.