Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Revert "Merge branch 'ZF-3347' of git://github.com/Deserved/zf2 into …

…hotfix/3424"

This reverts commit b9d1977, reversing
changes made to 054f7a0.

Reverts #3424 due to BC breaks reported in #3576

Conflicts:
	tests/ZendTest/ServiceManager/ServiceManagerTest.php
  • Loading branch information...
commit 2a2cfcb0ee9f1850ac70e0b9f00d86669005b1d6 1 parent 71a5bd8
Matthew Weier O'Phinney weierophinney authored
8 library/Zend/ServiceManager/ServiceManager.php
View
@@ -222,7 +222,7 @@ public function setInvokableClass($name, $invokableClass, $shared = null)
{
$cName = $this->canonicalizeName($name);
- if ($this->has(array($cName, $name), false, false)) {
+ if ($this->has(array($cName, $name), false)) {
if ($this->allowOverride === false) {
throw new Exception\InvalidServiceNameException(sprintf(
'A service by the name or alias "%s" already exists and cannot be overridden; please use an alternate name',
@@ -262,7 +262,7 @@ public function setFactory($name, $factory, $shared = null)
);
}
- if ($this->has(array($cName, $name), false, false)) {
+ if ($this->has(array($cName, $name), false)) {
if ($this->allowOverride === false) {
throw new Exception\InvalidServiceNameException(sprintf(
'A service by the name or alias "%s" already exists and cannot be overridden, please use an alternate name',
@@ -359,7 +359,7 @@ public function setService($name, $service, $shared = null)
{
$cName = $this->canonicalizeName($name);
- if ($this->has($cName, false, false)) {
+ if ($this->has($cName, false)) {
if ($this->allowOverride === false) {
throw new Exception\InvalidServiceNameException(sprintf(
'%s: A service by the name "%s" or alias already exists and cannot be overridden, please use an alternate name.',
@@ -640,7 +640,7 @@ public function setAlias($alias, $nameOrAlias)
throw new Exception\InvalidServiceNameException('Invalid service name alias');
}
- if ($this->allowOverride === false && $this->has(array($cAlias, $alias), false, false)) {
+ if ($this->allowOverride === false && $this->has(array($cAlias, $alias), false)) {
throw new Exception\InvalidServiceNameException(sprintf(
'An alias by the name "%s" or "%s" already exists',
$cAlias,
90 tests/ZendTest/ServiceManager/ServiceManagerTest.php
View
@@ -716,94 +716,4 @@ public function testRetrieveServiceFromPeeringServiceManagerIfretrieveFromPeerin
$this->assertEquals($serviceManagerChild->get($foo1), $boo2);
$this->assertEquals($this->serviceManager->get($foo1), $boo2);
}
-
- /**
- * @covers Zend\ServiceManager\ServiceManager::setService
- * @covers Zend\ServiceManager\ServiceManager::get
- * @covers Zend\ServiceManager\ServiceManager::createScopedServiceManager
- */
- public function testParentServiceManagerCanCreateServiceWithSameNameThatAlreadyUsedByChildServiceManager()
- {
- $foo1 = "foo1";
- $boo1 = "boo1";
- $boo2 = "boo2";
-
- $this->serviceManager->setService($foo1, $boo1);
- $this->assertEquals($this->serviceManager->get($foo1), $boo1);
-
- $serviceManagerParent = $this->serviceManager->createScopedServiceManager();
-
- $this->assertContains($this->serviceManager, $this->readAttribute($serviceManagerParent, 'peeringServiceManagers'));
-
- $serviceManagerParent->setService($foo1, $boo2);
- $this->assertEquals($serviceManagerParent->get($foo1), $boo2);
- }
-
- /**
- * @covers Zend\ServiceManager\ServiceManager::setInvokableClass
- * @covers Zend\ServiceManager\ServiceManager::get
- * @covers Zend\ServiceManager\ServiceManager::createScopedServiceManager
- */
- public function testParentServiceManagerCanCreateInvokableServiceWithSameNameThatAlreadyUsedByChildServiceManager()
- {
- $foo1 = "foo1";
- $boo1 = "ZendTest\ServiceManager\TestAsset\Foo";
- $boo2 = "\stdClass";
-
- $this->serviceManager->setInvokableClass($foo1, $boo1);
- $this->assertInstanceOf($boo1, $this->serviceManager->get($foo1));
-
- $serviceManagerParent = $this->serviceManager->createScopedServiceManager();
-
- $this->assertContains($this->serviceManager, $this->readAttribute($serviceManagerParent, 'peeringServiceManagers'));
-
- $serviceManagerParent->setInvokableClass($foo1, $boo2);
- $this->assertInstanceOf($boo2, $serviceManagerParent->get($foo1));
- }
-
- /**
- * @covers Zend\ServiceManager\ServiceManager::setFactory
- * @covers Zend\ServiceManager\ServiceManager::get
- * @covers Zend\ServiceManager\ServiceManager::createScopedServiceManager
- */
- public function testParentServiceManagerCanCreateFactoryServiceWithSameNameThatAlreadyUsedByChildServiceManager()
- {
- $foo1 = "foo1";
- $boo1 = "ZendTest\ServiceManager\TestAsset\FooFactory";
- $boo1_returns = "ZendTest\ServiceManager\TestAsset\Foo";
- $boo2 = function() { return new \stdClass(); };
-
- $this->serviceManager->setFactory($foo1, $boo1);
- $this->assertInstanceOf($boo1_returns, $this->serviceManager->get($foo1));
-
- $serviceManagerParent = $this->serviceManager->createScopedServiceManager();
-
- $this->assertContains($this->serviceManager, $this->readAttribute($serviceManagerParent, 'peeringServiceManagers'));
-
- $serviceManagerParent->setFactory($foo1, $boo2);
- $this->assertTrue($serviceManagerParent->get($foo1) instanceof \stdClass);
- }
-
- /**
- * @covers Zend\ServiceManager\ServiceManager::setAlias
- * @covers Zend\ServiceManager\ServiceManager::hasAlias
- * @covers Zend\ServiceManager\ServiceManager::createScopedServiceManager
- */
- public function testParentServiceManagerCanCreateAliasWithSameNameThatAlreadyUsedByChildServiceManager()
- {
- $foo1 = "foo1";
- $boo1 = "boo1";
- $boo2 = "boo2";
-
- $this->serviceManager->setAlias($foo1, $boo1);
- $this->assertTrue($this->serviceManager->hasAlias($foo1));
-
- $serviceManagerParent = $this->serviceManager->createScopedServiceManager();
-
- $this->assertFalse($serviceManagerParent->hasAlias($foo1));
- $this->assertContains($this->serviceManager, $this->readAttribute($serviceManagerParent, 'peeringServiceManagers'));
-
- $serviceManagerParent->setAlias($foo1, $boo2);
- $this->assertTrue($serviceManagerParent->hasAlias($foo1));
- }
}
Please sign in to comment.
Something went wrong with that request. Please try again.