Skip to content

Commit

Permalink
Merge pull request #75 from driehle/feature/test-case-invokables-prec…
Browse files Browse the repository at this point in the history
…edence-3.5.x

backported testConfigureInvokablesTakePrecedenceOverFactories to 3.5.x
  • Loading branch information
Ocramius authored Jan 17, 2021
2 parents 4beccc1 + 32e1e85 commit 1182c5f
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions test/CommonServiceLocatorBehaviorsTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,29 @@ public function testConfigureCanOverridePreviousSettings()
$newServiceManager->get(DateTime::class);
}

public function testConfigureInvokablesTakePrecedenceOverFactories()
{
$firstFactory = $this->getMockBuilder(FactoryInterface::class)
->getMock();

$serviceManager = $this->createContainer([
'aliases' => [
'custom_alias' => DateTime::class,
],
'factories' => [
DateTime::class => $firstFactory,
],
'invokables' => [
'custom_alias' => stdClass::class,
],
]);

$firstFactory->expects($this->never())->method('__invoke');

$object = $serviceManager->get('custom_alias');
$this->assertInstanceOf(stdClass::class, $object);
}

/**
* @group has
*/
Expand Down

0 comments on commit 1182c5f

Please sign in to comment.