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

Commit

Permalink
Merge pull request #5390 from stefanotorresi/test/abstract-factories
Browse files Browse the repository at this point in the history
Add regression test for #5237
  • Loading branch information
weierophinney committed Nov 1, 2013
2 parents cc7d0b7 + d9329c0 commit 33a31b2
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tests/ZendTest/ServiceManager/ServiceManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,27 @@ public function testCallingANonExistingServiceFromAnAbstractServiceDoesNotMakeTh
$this->assertInstanceOf('stdClass', $service);
}

public function testMultipleAbstractFactoriesWithOneLookingForANonExistingServiceDuringCanCreate()
{
$abstractFactory = new TestAsset\TrollAbstractFactory;
$anotherAbstractFactory = $this->getMock('Zend\ServiceManager\AbstractFactoryInterface');
$anotherAbstractFactory
->expects($this->exactly(2))
->method('canCreateServiceWithName')
->with(
$this->serviceManager,
$this->logicalOr('somethingthatcanbecreated', 'nonexistingservice'),
$this->logicalOr('SomethingThatCanBeCreated', 'NonExistingService')
)
->will($this->returnValue(false));

$this->serviceManager->addAbstractFactory($abstractFactory);
$this->serviceManager->addAbstractFactory($anotherAbstractFactory);

$this->assertTrue($this->serviceManager->has('SomethingThatCanBeCreated'));
$this->assertFalse($abstractFactory->inexistingServiceCheckResult);
}

public function testWaitingAbstractFactory()
{
$abstractFactory = new TestAsset\WaitingAbstractFactory;
Expand Down

0 comments on commit 33a31b2

Please sign in to comment.