[ 'dependencies.config.php' => 'url()); $this->assertInstanceOf(Container::class, $container); } public function testCreateReturnsObject(): void { $root = vfsStream::setup('friendica', null, [ 'static' => [ 'dependencies.config.php' => <<< PHP [ 'instanceOf' => \Psr\Log\NullLogger::class, ], ]; PHP, ], ]); $container = Container::fromBasePath($root->url()); $this->assertInstanceOf(NullLogger::class, $container->create(LoggerInterface::class)); } public function testFromDiceReturnsContainer(): void { $dice = $this->createMock(Dice::class); $dice->expects($this->never())->method('create'); $container = Container::fromDice($dice); $this->assertInstanceOf(Container::class, $container); } public function testCreateFromContainer(): void { $dice = $this->createMock(Dice::class); $dice->expects($this->once())->method('create')->with(LoggerInterface::class)->willReturn(new NullLogger()); $container = Container::fromDice($dice); $this->assertInstanceOf(NullLogger::class, $container->create(LoggerInterface::class)); } public function testAddRuleFromContainer(): void { $dice = $this->createMock(Dice::class); $dice->expects($this->once())->method('addRule')->with(LoggerInterface::class, ['constructParams' => ['console']])->willReturn($dice); $container = Container::fromDice($dice); $container->addRule(LoggerInterface::class, ['constructParams' => ['console']]); } }