/** * {@inheritdoc} * */ public function setUp() { $this->defaultPluginResolver = $this->getMock(DefaultPluginResolverInterface::class); $this->pluginId = $this->randomMachineName(); $this->selectablePluginManager = $this->getMock(PluginManagerInterface::class); $this->selectablePluginType = $this->getMock(PluginTypeInterface::class); $this->selectablePluginType->expects($this->any())->method('getPluginManager')->willReturn($this->selectablePluginManager); $this->selectedPlugin = $this->getMock(PluginInspectionInterface::class); }
/** * @covers ::getDefinitions * @covers ::processDecoratedDefinitions */ public function testGetDefinitions() { $decorated_plugin_id_a = $this->randomMachineName(); $decorated_plugin_definition_a = ['id' => $decorated_plugin_id_a]; $decorated_plugin_id_b = $this->randomMachineName(); $decorated_plugin_definition_b = ['id' => $decorated_plugin_id_b]; $decorated_plugin_definitions = [$decorated_plugin_id_a => $decorated_plugin_definition_a, $decorated_plugin_id_b => $decorated_plugin_definition_b]; $this->pluginManager->expects($this->once())->method('getDefinitions')->willReturn($decorated_plugin_definitions); $typed_plugin_definition_a = $this->getMock(PluginDefinitionInterface::class); $typed_plugin_definition_b = $this->getMock(PluginDefinitionInterface::class); $map = [[$decorated_plugin_definition_a, $typed_plugin_definition_a], [$decorated_plugin_definition_b, $typed_plugin_definition_b]]; $this->pluginType->expects($this->atLeastOnce())->method('ensureTypedPluginDefinition')->willReturnMap($map); $expected_plugin_definitions = [$decorated_plugin_id_a => $typed_plugin_definition_a, $decorated_plugin_id_b => $typed_plugin_definition_b]; $this->assertSame($expected_plugin_definitions, $this->sut->getDefinitions()); }