Skip to content
This repository was archived by the owner on Feb 6, 2020. It is now read-only.

Commit 3d8bd24

Browse files
committed
#83 - cyclic dependencies should eagerly cause a crash to prevent silly mistakes with aliases
1 parent fb359fb commit 3d8bd24

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

test/CommonServiceLocatorBehaviorsTrait.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use stdClass;
1717
use Zend\ServiceManager\Exception\ContainerModificationsNotAllowedException;
1818
use Zend\ServiceManager\Exception\InvalidArgumentException;
19+
use Zend\ServiceManager\Exception\InvalidServiceException;
1920
use Zend\ServiceManager\Exception\ServiceNotCreatedException;
2021
use Zend\ServiceManager\Exception\ServiceNotFoundException;
2122
use Zend\ServiceManager\Factory\FactoryInterface;
@@ -790,15 +791,15 @@ public function testCanRetrieveParentContainerViaGetServiceLocatorWithDeprecatio
790791
*/
791792
public function testCrashesOnCyclicAliases()
792793
{
794+
$this->setExpectedException(InvalidServiceException::class);
795+
793796
$serviceManager = $this->createContainer([
794797
'aliases' => [
795798
'a' => 'b',
796799
'b' => 'a',
797800
],
798801
]);
799802

800-
$this->setExpectedException(ServiceNotFoundException::class);
801-
802803
$serviceManager->get('b');
803804
}
804805
}

0 commit comments

Comments
 (0)