1515
1616use InvalidArgumentException ;
1717use Mockery as m ;
18+ use phpDocumentor \Reflection \Assets \CustomParam ;
19+ use phpDocumentor \Reflection \Assets \CustomServiceClass ;
20+ use phpDocumentor \Reflection \Assets \CustomServiceInterface ;
1821use phpDocumentor \Reflection \DocBlock \Tags \Author ;
1922use phpDocumentor \Reflection \DocBlock \Tags \Formatter ;
2023use phpDocumentor \Reflection \DocBlock \Tags \Formatter \PassthroughFormatter ;
@@ -169,13 +172,13 @@ public function testAddParameterToServiceLocator() : void
169172 {
170173 $ resolver = m::mock (FqsenResolver::class);
171174 $ tagFactory = new StandardTagFactory ($ resolver );
175+ $ tagFactory ->registerTagHandler ('spy ' , CustomParam::class);
176+
172177 $ tagFactory ->addParameter ('myParam ' , 'myValue ' );
178+ $ spy = $ tagFactory ->create ('@spy ' );
173179
174- $ this ->assertAttributeSame (
175- [FqsenResolver::class => $ resolver , 'myParam ' => 'myValue ' ],
176- 'serviceLocator ' ,
177- $ tagFactory
178- );
180+ $ this ->assertSame ($ resolver , $ spy ->fqsenResolver );
181+ $ this ->assertSame ('myValue ' , $ spy ->myParam );
179182 }
180183
181184 /**
@@ -190,12 +193,11 @@ public function testAddServiceToServiceLocator() : void
190193 $ resolver = m::mock (FqsenResolver::class);
191194 $ tagFactory = new StandardTagFactory ($ resolver );
192195 $ tagFactory ->addService ($ service );
196+ $ tagFactory ->registerTagHandler ('spy ' , CustomServiceClass::class);
193197
194- $ this ->assertAttributeSame (
195- [FqsenResolver::class => $ resolver , PassthroughFormatter::class => $ service ],
196- 'serviceLocator ' ,
197- $ tagFactory
198- );
198+ $ spy = $ tagFactory ->create ('@spy ' );
199+
200+ $ this ->assertSame ($ service , $ spy ->formatter );
199201 }
200202
201203 /**
@@ -211,12 +213,11 @@ public function testInjectConcreteServiceForInterfaceToServiceLocator() : void
211213 $ resolver = m::mock (FqsenResolver::class);
212214 $ tagFactory = new StandardTagFactory ($ resolver );
213215 $ tagFactory ->addService ($ service , $ interfaceName );
216+ $ tagFactory ->registerTagHandler ('spy ' , CustomServiceInterface::class);
214217
215- $ this ->assertAttributeSame (
216- [FqsenResolver::class => $ resolver , $ interfaceName => $ service ],
217- 'serviceLocator ' ,
218- $ tagFactory
219- );
218+ $ spy = $ tagFactory ->create ('@spy ' );
219+
220+ $ this ->assertSame ($ service , $ spy ->formatter );
220221 }
221222
222223 /**
0 commit comments