$definitions =
$this->
getPluginDefinitions();
$this->pluginInstances
['apple'
] =
new ConfigurablePlugin(['id' => 'apple', 'key' => 'value'
], 'apple',
$definitions['apple'
]);
$this->pluginInstances
['banana'
] =
new ConfigurablePlugin(['id' => 'banana', 'key' => 'other_value'
], 'banana',
$definitions['banana'
]);
$create_count =
$create_count ?:
$this->
never();
$this->pluginManager->
expects($create_count) ->
method('createInstance'
) ->
willReturnCallback(function D
$id) { return $this->pluginInstances
[$id];
});
$this->defaultPluginCollection =
new DefaultSingleLazyPluginCollection($this->pluginManager, 'apple',
['id' => 'apple', 'key' => 'value'
]);
} /**
* Tests the get() method.
*/
public function testGet() { $this->
setupPluginCollection($this->
once());
$apple =
$this->pluginInstances
['apple'
];
$this->
assertSame($apple,
$this->defaultPluginCollection->
get('apple'
));
}