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

Commit 8bf0fbc

Browse files
committed
Merge branch 'feature/#216-enhancement-speed-up-servicemanager-has' into develop
2 parents 59d699b + 45d573a commit 8bf0fbc

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

test/ServiceManagerTest.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,13 @@
88
namespace ZendTest\ServiceManager;
99

1010
use DateTime;
11+
use Interop\Container\Exception\ContainerException;
1112
use PHPUnit\Framework\TestCase;
1213
use Psr\Container\ContainerInterface;
1314
use stdClass;
15+
use Zend\ServiceManager\Exception\ServiceNotCreatedException;
16+
use Zend\ServiceManager\Exception\ServiceNotFoundException;
17+
use Zend\ServiceManager\Factory\AbstractFactoryInterface;
1418
use Zend\ServiceManager\Factory\FactoryInterface;
1519
use Zend\ServiceManager\Factory\InvokableFactory;
1620
use Zend\ServiceManager\ServiceManager;
@@ -268,6 +272,28 @@ public function testSetAliasShouldWorkWithRecursiveAlias()
268272
self::assertSame($service, $headAlias);
269273
}
270274

275+
public function testAbstractFactoryShouldBeCheckedForResolvedAliasesInsteadOfAliasNameName()
276+
{
277+
$abstractFactory = $this->createMock(AbstractFactoryInterface::class);
278+
279+
$serviceManager = new SimpleServiceManager([
280+
'aliases' => [
281+
'Alias' => 'ServiceName',
282+
],
283+
'abstract_factories' => [
284+
$abstractFactory,
285+
],
286+
]);
287+
288+
$abstractFactory
289+
->expects(self::once())
290+
->method('canCreate')
291+
->with(self::anything(), 'ServiceName')
292+
->willReturn(true);
293+
294+
$this->assertTrue($serviceManager->has('Alias'));
295+
}
296+
271297
public static function sampleFactory()
272298
{
273299
return new stdClass();

0 commit comments

Comments
 (0)