1 | <?php |
||
27 | class TagConverterTest extends \Mockery\Adapter\Phpunit\MockeryTestCase |
||
28 | { |
||
29 | const TEST_LINENUMBER = 100; |
||
30 | |||
31 | /** |
||
32 | * Tests whether the information common to all tags is stored on an XML element. |
||
33 | * |
||
34 | * @param string $name Name of the tag as provided by the Descriptor. |
||
35 | * @param string $description Description for the tag as provided by the Descriptor. |
||
36 | * @param string $resultName Expected resulting name in the XML Element. |
||
37 | * @param string $resultDescription Expected resulting description in the XML Element. |
||
38 | * |
||
39 | * @dataProvider provideTestGenericTag |
||
40 | * @covers ::convert |
||
41 | * @covers ::getDescription |
||
42 | * |
||
43 | * @return void |
||
44 | */ |
||
45 | public function testConvertGenericTag($name, $description, $resultName, $resultDescription) |
||
60 | |||
61 | /** |
||
62 | * Tests whether type information is stored when a tag is processed with compound type information. |
||
63 | * |
||
64 | * @covers ::convert |
||
65 | * @covers ::addTypes |
||
66 | * |
||
67 | * @return void |
||
68 | */ |
||
69 | public function testWhetherTypesAreAddedWhenPresentAndTypeIsCompound() |
||
90 | |||
91 | /** |
||
92 | * Tests whether type information is stored when a tag is processed with information of a single type. |
||
93 | * |
||
94 | * @covers ::convert |
||
95 | * @covers ::addTypes |
||
96 | * |
||
97 | * @return void |
||
98 | */ |
||
99 | public function testWhetherTypesAreAddedWhenPresentAndTypeIsSingular() |
||
115 | |||
116 | /** |
||
117 | * Tests whether the variable name is stored for tags containing variable names. |
||
118 | * |
||
119 | * @covers ::convert |
||
120 | * @covers ::addTypes |
||
121 | * |
||
122 | * @return void |
||
123 | */ |
||
124 | public function testWhetherVariableNamesAreAddedWhenPresent() |
||
139 | |||
140 | /** |
||
141 | * Tests whether the version number is prepended to the description when version information is available. |
||
142 | * |
||
143 | * @covers ::convert |
||
144 | * @covers ::getDescription |
||
145 | * |
||
146 | * @todo this should be dealt with in a template and not in the code! This activity should be removed and the |
||
147 | * templates updated. |
||
148 | * |
||
149 | * @return void |
||
150 | */ |
||
151 | public function testWhetherTheVersionIsPrependedToTheDescription() |
||
165 | |||
166 | /** |
||
167 | * Tests whether a reference to another element is stored with the tag when such is present. |
||
168 | * |
||
169 | * @covers ::convert |
||
170 | * |
||
171 | * @return void |
||
172 | */ |
||
173 | public function testWhetherReferencesAreAddedWhenPresent() |
||
188 | |||
189 | /** |
||
190 | * Tests whether a link to a URL is stored with the tag when such is present. |
||
191 | * |
||
192 | * @covers ::convert |
||
193 | * |
||
194 | * @return void |
||
195 | */ |
||
196 | public function testWhetherLinksAreAddedWhenPresent() |
||
211 | |||
212 | /** |
||
213 | * Tests whether a method name to another element is stored with the tag when such is present. |
||
214 | * |
||
215 | * @covers ::convert |
||
216 | * |
||
217 | * @return void |
||
218 | */ |
||
219 | public function testWhetherMethodNamesAreAddedWhenPresent() |
||
234 | |||
235 | /** |
||
236 | * Provides a test name and description for the generic test. |
||
237 | * |
||
238 | * @see testConvertGenericTag |
||
239 | * |
||
240 | * @return string[][] |
||
241 | */ |
||
242 | public function provideTestGenericTag() |
||
249 | |||
250 | /** |
||
251 | * Creates an XML Element that can serve as parent. |
||
252 | * |
||
253 | * @return \DOMElement |
||
254 | */ |
||
255 | protected function prepareDocBlockXMLElement() |
||
264 | |||
265 | /** |
||
266 | * Creates a mock for the TagDescriptor class. |
||
267 | * |
||
268 | * @param string $name The name of the tag. |
||
269 | * @param string $description The description that is present in the tag. |
||
270 | * @param string $class The descriptor class that is to be mocked |
||
271 | * |
||
272 | * @return m\MockInterface|TagDescriptor |
||
273 | */ |
||
274 | protected function createTagDescriptorMock($name, $description, $class = 'TagDescriptor') |
||
283 | } |
||
284 |
If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:
If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.