@@ -123,6 +123,26 @@ public function testAddWithoutNamespace($fixture, $expected)
123123 $ this ->assertSame ($ expected , $ collection ->getArrayCopy ());
124124 }
125125
126+ /**
127+ * @param string $fixture
128+ * @param array $expected
129+ *
130+ * @dataProvider provideTypesToExpandWithPropertyOrMethod
131+ * @covers phpDocumentor\Reflection\DocBlock\Type\Collection::add
132+ *
133+ * @return void
134+ */
135+ public function testAddMethodsAndProperties ($ fixture , $ expected )
136+ {
137+ $ collection = new Collection (
138+ array (),
139+ new Context (null , array ('LinkDescriptor ' => '\phpDocumentor\LinkDescriptor ' ))
140+ );
141+ $ collection ->add ($ fixture );
142+
143+ $ this ->assertSame ($ expected , $ collection ->getArrayCopy ());
144+ }
145+
126146 /**
127147 * @covers phpDocumentor\Reflection\DocBlock\Type\Collection::add
128148 * @expectedException InvalidArgumentException
@@ -177,6 +197,14 @@ public function provideTypesToExpand($method, $namespace = '\My\Space\\')
177197 'DocBlock[]|int[] ' ,
178198 array ($ namespace .'DocBlock[] ' , 'int[] ' )
179199 ),
200+ array (
201+ 'LinkDescriptor::setLink() ' ,
202+ array ($ namespace .'LinkDescriptor::setLink() ' )
203+ ),
204+ array (
205+ 'Alias\LinkDescriptor::setLink() ' ,
206+ array ('\My\Space\Aliasing\LinkDescriptor::setLink() ' )
207+ ),
180208 );
181209 }
182210
@@ -192,4 +220,34 @@ public function provideTypesToExpandWithoutNamespace($method)
192220 {
193221 return $ this ->provideTypesToExpand ($ method , '\\' );
194222 }
223+
224+ /**
225+ * Returns the method and property types and their expected values to test
226+ * the retrieval of types.
227+ *
228+ * @param string $method Name of the method consuming this data provider.
229+ *
230+ * @return string[]
231+ */
232+ public function provideTypesToExpandWithPropertyOrMethod ($ method )
233+ {
234+ return array (
235+ array (
236+ 'LinkDescriptor::setLink() ' ,
237+ array ('\phpDocumentor\LinkDescriptor::setLink() ' )
238+ ),
239+ array (
240+ 'phpDocumentor\LinkDescriptor::setLink() ' ,
241+ array ('\phpDocumentor\LinkDescriptor::setLink() ' )
242+ ),
243+ array (
244+ 'LinkDescriptor::$link ' ,
245+ array ('\phpDocumentor\LinkDescriptor::$link ' )
246+ ),
247+ array (
248+ 'phpDocumentor\LinkDescriptor::$link ' ,
249+ array ('\phpDocumentor\LinkDescriptor::$link ' )
250+ ),
251+ );
252+ }
195253}
0 commit comments