function LazyPluginCollectionTestBase::setupPluginCollection
Same name in other branches
- 9 core/tests/Drupal/Tests/Core/Plugin/LazyPluginCollectionTestBase.php \Drupal\Tests\Core\Plugin\LazyPluginCollectionTestBase::setupPluginCollection()
- 8.9.x core/tests/Drupal/Tests/Core/Plugin/LazyPluginCollectionTestBase.php \Drupal\Tests\Core\Plugin\LazyPluginCollectionTestBase::setupPluginCollection()
- 11.x core/tests/Drupal/Tests/Core/Plugin/LazyPluginCollectionTestBase.php \Drupal\Tests\Core\Plugin\LazyPluginCollectionTestBase::setupPluginCollection()
Sets up the default plugin collection.
Parameters
\PHPUnit\Framework\MockObject\Rule\InvocationOrder|null $create_count: (optional) The number of times that createInstance() is expected to be called. For example, $this->any(), $this->once(), $this->exactly(6). Defaults to $this->never().
14 calls to LazyPluginCollectionTestBase::setupPluginCollection()
- DefaultLazyPluginCollectionTest::testAddInstanceId in core/
tests/ Drupal/ Tests/ Core/ Plugin/ DefaultLazyPluginCollectionTest.php - @covers ::addInstanceId
- DefaultLazyPluginCollectionTest::testClear in core/
tests/ Drupal/ Tests/ Core/ Plugin/ DefaultLazyPluginCollectionTest.php - @covers ::clear
- DefaultLazyPluginCollectionTest::testConfigurableGetConfiguration in core/
tests/ Drupal/ Tests/ Core/ Plugin/ DefaultLazyPluginCollectionTest.php - @covers ::getConfiguration
- DefaultLazyPluginCollectionTest::testConfigurableSetConfiguration in core/
tests/ Drupal/ Tests/ Core/ Plugin/ DefaultLazyPluginCollectionTest.php - @covers ::setConfiguration
- DefaultLazyPluginCollectionTest::testConfigurableSetConfigurationToNull in core/
tests/ Drupal/ Tests/ Core/ Plugin/ DefaultLazyPluginCollectionTest.php - @covers ::setConfiguration @group legacy
1 method overrides LazyPluginCollectionTestBase::setupPluginCollection()
- DefaultSingleLazyPluginCollectionTest::setupPluginCollection in core/
tests/ Drupal/ Tests/ Core/ Plugin/ DefaultSingleLazyPluginCollectionTest.php - Sets up the default plugin collection.
File
-
core/
tests/ Drupal/ Tests/ Core/ Plugin/ LazyPluginCollectionTestBase.php, line 69
Class
- LazyPluginCollectionTestBase
- Provides a base class for plugin collection tests.
Namespace
Drupal\Tests\Core\PluginCode
protected function setupPluginCollection(?InvocationOrder $create_count = NULL) {
$this->pluginInstances = [];
$map = [];
foreach ($this->getPluginDefinitions() as $plugin_id => $definition) {
// Create a mock plugin instance.
$this->pluginInstances[$plugin_id] = $this->getPluginMock($plugin_id, $definition);
$map[] = [
$plugin_id,
$this->config[$plugin_id],
$this->pluginInstances[$plugin_id],
];
}
$create_count = $create_count ?: $this->never();
$this->pluginManager
->expects($create_count)
->method('createInstance')
->willReturnCallback([
$this,
'returnPluginMap',
]);
$this->defaultPluginCollection = new DefaultLazyPluginCollection($this->pluginManager, $this->config);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.