factory = new AuthenticationPluginManagerFactory(); } /** * @test * @dataProvider provideConfigs */ public function serviceIsProperlyCreatedWithExpectedPlugins(?array $config, array $expectedPlugins): void { $instance = ($this->factory)(new ServiceManager(['services' => [ 'config' => $config, ]])); $this->assertEquals($expectedPlugins, $this->getPlugins($instance)); } private function getPlugins(AuthenticationPluginManager $pluginManager): array { return (fn () => $this->services)->call($pluginManager); } public function provideConfigs(): iterable { yield [null, []]; yield [[], []]; yield [['auth' => []], []]; yield [['auth' => [ 'plugins' => [], ]], []]; yield [['auth' => [ 'plugins' => [ 'services' => $plugins = [ 'foo' => $this->prophesize(AuthenticationPluginInterface::class)->reveal(), 'bar' => $this->prophesize(AuthenticationPluginInterface::class)->reveal(), ], ], ]], $plugins]; } }