1 | <?php |
||
50 | class ItemTest extends \PHPUnit_Framework_TestCase |
||
51 | { |
||
52 | /** |
||
53 | * Public function test the item creation |
||
54 | * |
||
55 | * @param string|array $type Item type(s) |
||
56 | * @param array $properties Item properties |
||
57 | * @param $itemId Item id |
||
58 | * @param array $expectedTypes Expected item types |
||
59 | * @param array $expectedProperties Expected item properties |
||
60 | * @param string $expectedId Expected item id |
||
61 | * @dataProvider creationArgumentProvider |
||
62 | */ |
||
63 | public function testItemCreation( |
||
77 | |||
78 | /** |
||
79 | * Convert a property list to a plain array |
||
80 | * |
||
81 | * @param PropertyListInterface $propertyList Property list |
||
82 | * @return array Property list array |
||
83 | */ |
||
84 | protected function convertPropertyListToArray(PropertyListInterface $propertyList) |
||
92 | |||
93 | /** |
||
94 | * Data provider for item creation tests |
||
95 | * |
||
96 | * @return array Item creation arguments |
||
97 | */ |
||
98 | public function creationArgumentProvider() |
||
174 | |||
175 | /** |
||
176 | * Create a type object |
||
177 | * |
||
178 | * @param string $n Type name |
||
179 | * @param string $p Type profile |
||
180 | * @return object Type object |
||
181 | */ |
||
182 | protected function t($n, $p = '') |
||
186 | |||
187 | /** |
||
188 | * Create a property object |
||
189 | * |
||
190 | * @param string $n Property name |
||
191 | * @param mixed $s Property value(s) |
||
192 | * @param string $p Property profiles |
||
193 | * @return object Property object |
||
194 | */ |
||
195 | protected function p($n, $s, $p = '') |
||
200 | |||
201 | /** |
||
202 | * Create a string value |
||
203 | * |
||
204 | * @param string $s Value |
||
205 | * @return ValueInterface String value |
||
206 | */ |
||
207 | protected function s($s) |
||
211 | |||
212 | /** |
||
213 | * Test the item creation with an empty types list |
||
214 | * |
||
215 | * @expectedException \Jkphl\Micrometa\Domain\Exceptions\InvalidArgumentException |
||
216 | * @expectedExceptionCode 1490814631 |
||
217 | */ |
||
218 | public function testEmptyTypesList() |
||
222 | |||
223 | /** |
||
224 | * Test the item creation with an empty types list |
||
225 | * |
||
226 | * @expectedException \Jkphl\Micrometa\Domain\Exceptions\InvalidArgumentException |
||
227 | * @expectedExceptionCode 1488314667 |
||
228 | */ |
||
229 | public function testEmptyTypeName() |
||
233 | |||
234 | /** |
||
235 | * Test the item creation with an empty property name |
||
236 | * |
||
237 | * @expectedException \Jkphl\Micrometa\Domain\Exceptions\InvalidArgumentException |
||
238 | * @expectedExceptionCode 1488314921 |
||
239 | */ |
||
240 | public function testEmptyPropertyName() |
||
244 | |||
245 | /** |
||
246 | * Test empty property value list |
||
247 | * |
||
248 | * @expectedException \Jkphl\Micrometa\Domain\Exceptions\InvalidArgumentException |
||
249 | * @expectedExceptionCode 1490814554 |
||
250 | */ |
||
251 | public function testInvalidPropertyStructure() |
||
255 | |||
256 | /** |
||
257 | * Test the item creation with an invalid property value |
||
258 | * |
||
259 | * @expectedException \Jkphl\Micrometa\Domain\Exceptions\InvalidArgumentException |
||
260 | * @expectedExceptionCode 1488315339 |
||
261 | */ |
||
262 | public function testInvalidPropertyValue() |
||
266 | |||
267 | /** |
||
268 | * Test the item creation with an invalid property value |
||
269 | * |
||
270 | * @expectedException \Jkphl\Micrometa\Domain\Exceptions\OutOfBoundsException |
||
271 | * @expectedExceptionCode 1488315604 |
||
272 | */ |
||
273 | public function testUnknownPropertyName() |
||
278 | |||
279 | /** |
||
280 | * Test the item property getter |
||
281 | */ |
||
282 | public function testItemPropertyGetter() |
||
287 | } |
||
288 |
This check looks at variables that have been passed in as parameters and are passed out again to other methods.
If the outgoing method call has stricter type requirements than the method itself, an issue is raised.
An additional type check may prevent trouble.