Skip to content

Commit

Permalink
backported testConfigureCanOverridePreviousSettings to 3.5.x
Browse files Browse the repository at this point in the history
Signed-off-by: Dennis Riehle <webmaster@riehle-web.com>
  • Loading branch information
driehle committed Jan 17, 2021
1 parent 4beccc1 commit 4607de7
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 4607de7

Please sign in to comment.