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

Commit 7c27f4a

Browse files
committed
#83 - moved test to the CommonServiceLocatorBehaviorsTrait, as it is common to ServiceManager and AbstractPluginManager
1 parent 94c39cb commit 7c27f4a

File tree

2 files changed

+18
-14
lines changed

2 files changed

+18
-14
lines changed

test/CommonServiceLocatorBehaviorsTrait.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use Zend\ServiceManager\Exception\ContainerModificationsNotAllowedException;
1818
use Zend\ServiceManager\Exception\InvalidArgumentException;
1919
use Zend\ServiceManager\Exception\ServiceNotCreatedException;
20+
use Zend\ServiceManager\Exception\ServiceNotFoundException;
2021
use Zend\ServiceManager\Factory\FactoryInterface;
2122
use Zend\ServiceManager\Initializer\InitializerInterface;
2223
use Zend\ServiceManager\ServiceLocatorInterface;
@@ -783,4 +784,21 @@ public function testCanRetrieveParentContainerViaGetServiceLocatorWithDeprecatio
783784
$this->assertSame($this->creationContext, $container->getServiceLocator());
784785
restore_error_handler();
785786
}
787+
788+
/**
789+
* @group zendframework/zend-servicemanager#83
790+
*/
791+
public function testCrashesOnCyclicAliases()
792+
{
793+
$serviceManager = $this->createContainer([
794+
'aliases' => [
795+
'a' => 'b',
796+
'b' => 'a',
797+
],
798+
]);
799+
800+
$this->setExpectedException(ServiceNotFoundException::class);
801+
802+
$serviceManager->get('b');
803+
}
786804
}

test/ServiceManagerTest.php

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -237,18 +237,4 @@ public function testAliasToAnExplicitServiceShouldWork()
237237

238238
$this->assertSame($service, $alias);
239239
}
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-
}
254240
}

0 commit comments

Comments
 (0)