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 +15
-7
lines changed Expand file tree Collapse file tree 1 file changed +15
-7
lines changed Original file line number Diff line number Diff line change 12
12
use DateTime ;
13
13
use PHPUnit_Framework_TestCase as TestCase ;
14
14
use stdClass ;
15
- use Zend \ServiceManager \Exception \InvalidArgumentException ;
16
- use Zend \ServiceManager \Exception \ServiceNotCreatedException ;
15
+ use Zend \ServiceManager \Exception \ServiceNotFoundException ;
17
16
use Zend \ServiceManager \Factory \FactoryInterface ;
18
- use Zend \ServiceManager \Initializer \InitializerInterface ;
19
- use Zend \ServiceManager \ServiceLocatorInterface ;
20
17
use Zend \ServiceManager \Factory \InvokableFactory ;
21
18
use Zend \ServiceManager \ServiceManager ;
22
- use ZendTest \ServiceManager \TestAsset \FailingAbstractFactory ;
23
- use ZendTest \ServiceManager \TestAsset \FailingFactory ;
24
19
use ZendTest \ServiceManager \TestAsset \InvokableObject ;
25
- use ZendTest \ServiceManager \TestAsset \SimpleAbstractFactory ;
26
20
use ZendTest \ServiceManager \TestAsset \SimpleServiceManager ;
27
21
28
22
/**
@@ -243,4 +237,18 @@ public function testAliasToAnExplicitServiceShouldWork()
243
237
244
238
$ this ->assertSame ($ service , $ alias );
245
239
}
240
+
241
+ public function testCrashesOnCyclicAliases ()
242
+ {
243
+ $ serviceManager = new ServiceManager ([
244
+ 'aliases ' => [
245
+ 'a ' => 'b ' ,
246
+ 'b ' => 'a ' ,
247
+ ],
248
+ ]);
249
+
250
+ $ this ->setExpectedException (ServiceNotFoundException::class);
251
+
252
+ $ serviceManager ->get ('b ' );
253
+ }
246
254
}
You can’t perform that action at this time.
0 commit comments