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

Commit

Permalink
Merge pull request #71 from scottaubrey/release-2.7
Browse files Browse the repository at this point in the history
Broken use case using Alias of Alias
  • Loading branch information
weierophinney committed Jan 19, 2016
2 parents c8d74ce + d01978a commit 962e268
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/ServiceManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ protected function resolveAlias($cName)
}

$stack[$cName] = $cName;
$cName = $this->aliases[$cName];
$cName = $this->aliases[$this->canonicalizeName($cName)];
}

return $cName;
Expand Down
11 changes: 11 additions & 0 deletions test/ServiceManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,17 @@ public function testGetWithAlias()
$this->assertEquals('bar', $this->serviceManager->get('baz'));
}

/**
* @covers Zend\ServiceManager\ServiceManager::get
*/
public function testGetWithAliasofAliasWithCanonicalizedName()
{
$this->serviceManager->setService('Foo', 'Bar');
$this->serviceManager->setAlias('Baz', 'Foo');
$this->serviceManager->setAlias('Qux', 'Baz');
$this->assertEquals('Bar', $this->serviceManager->get('Qux'));
}

/**
* @covers Zend\ServiceManager\ServiceManager::get
*/
Expand Down

0 comments on commit 962e268

Please sign in to comment.