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 | public function testConvertGenericTag($name, $description, $resultName, $resultDescription) |
||
58 | |||
59 | /** |
||
60 | * Tests whether type information is stored when a tag is processed with compound type information. |
||
61 | * |
||
62 | * @covers ::convert |
||
63 | * @covers ::addTypes |
||
64 | */ |
||
65 | public function testWhetherTypesAreAddedWhenPresentAndTypeIsCompound() |
||
86 | |||
87 | /** |
||
88 | * Tests whether type information is stored when a tag is processed with information of a single type. |
||
89 | * |
||
90 | * @covers ::convert |
||
91 | * @covers ::addTypes |
||
92 | */ |
||
93 | public function testWhetherTypesAreAddedWhenPresentAndTypeIsSingular() |
||
109 | |||
110 | /** |
||
111 | * Tests whether the variable name is stored for tags containing variable names. |
||
112 | * |
||
113 | * @covers ::convert |
||
114 | * @covers ::addTypes |
||
115 | */ |
||
116 | public function testWhetherVariableNamesAreAddedWhenPresent() |
||
131 | |||
132 | /** |
||
133 | * Tests whether the version number is prepended to the description when version information is available. |
||
134 | * |
||
135 | * @covers ::convert |
||
136 | * @covers ::getDescription |
||
137 | * |
||
138 | * @todo this should be dealt with in a template and not in the code! This activity should be removed and the |
||
139 | * templates updated. |
||
140 | */ |
||
141 | public function testWhetherTheVersionIsPrependedToTheDescription() |
||
155 | |||
156 | /** |
||
157 | * Tests whether a reference to another element is stored with the tag when such is present. |
||
158 | * |
||
159 | * @covers ::convert |
||
160 | */ |
||
161 | public function testWhetherReferencesAreAddedWhenPresent() |
||
176 | |||
177 | /** |
||
178 | * Tests whether a link to a URL is stored with the tag when such is present. |
||
179 | * |
||
180 | * @covers ::convert |
||
181 | */ |
||
182 | public function testWhetherLinksAreAddedWhenPresent() |
||
197 | |||
198 | /** |
||
199 | * Tests whether a method name to another element is stored with the tag when such is present. |
||
200 | * |
||
201 | * @covers ::convert |
||
202 | */ |
||
203 | public function testWhetherMethodNamesAreAddedWhenPresent() |
||
218 | |||
219 | /** |
||
220 | * Provides a test name and description for the generic test. |
||
221 | * |
||
222 | * @see testConvertGenericTag |
||
223 | * |
||
224 | * @return string[][] |
||
225 | */ |
||
226 | public function provideTestGenericTag() |
||
233 | |||
234 | /** |
||
235 | * Creates an XML Element that can serve as parent. |
||
236 | * |
||
237 | * @return \DOMElement |
||
238 | */ |
||
239 | protected function prepareDocBlockXMLElement() |
||
248 | |||
249 | /** |
||
250 | * Creates a mock for the TagDescriptor class. |
||
251 | * |
||
252 | * @param string $name The name of the tag. |
||
253 | * @param string $description The description that is present in the tag. |
||
254 | * @param string $class The descriptor class that is to be mocked |
||
255 | * |
||
256 | * @return m\MockInterface|TagDescriptor |
||
257 | */ |
||
258 | protected function createTagDescriptorMock($name, $description, $class = 'TagDescriptor') |
||
267 | } |
||
268 |
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.