This repository was archived by the owner on Feb 6, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change 8
8
namespace ZendTest \ServiceManager ;
9
9
10
10
use DateTime ;
11
+ use Interop \Container \Exception \ContainerException ;
11
12
use PHPUnit \Framework \TestCase ;
12
13
use Psr \Container \ContainerInterface ;
13
14
use stdClass ;
15
+ use Zend \ServiceManager \Exception \ServiceNotCreatedException ;
16
+ use Zend \ServiceManager \Exception \ServiceNotFoundException ;
17
+ use Zend \ServiceManager \Factory \AbstractFactoryInterface ;
14
18
use Zend \ServiceManager \Factory \FactoryInterface ;
15
19
use Zend \ServiceManager \Factory \InvokableFactory ;
16
20
use Zend \ServiceManager \ServiceManager ;
@@ -268,6 +272,28 @@ public function testSetAliasShouldWorkWithRecursiveAlias()
268
272
self ::assertSame ($ service , $ headAlias );
269
273
}
270
274
275
+ public function testAbstractFactoryShouldBeCheckedForResolvedAliasesInsteadOfAliasNameName ()
276
+ {
277
+ $ abstractFactory = $ this ->createMock (AbstractFactoryInterface::class);
278
+
279
+ $ serviceManager = new SimpleServiceManager ([
280
+ 'aliases ' => [
281
+ 'Alias ' => 'ServiceName ' ,
282
+ ],
283
+ 'abstract_factories ' => [
284
+ $ abstractFactory ,
285
+ ],
286
+ ]);
287
+
288
+ $ abstractFactory
289
+ ->expects (self ::once ())
290
+ ->method ('canCreate ' )
291
+ ->with (self ::anything (), 'ServiceName ' )
292
+ ->willReturn (true );
293
+
294
+ $ this ->assertTrue ($ serviceManager ->has ('Alias ' ));
295
+ }
296
+
271
297
public static function sampleFactory ()
272
298
{
273
299
return new stdClass ();
You can’t perform that action at this time.
0 commit comments