function LazyPluginCollectionTestBase::setupPluginCollection
Same name in other branches
- 9 core/tests/Drupal/Tests/Core/Plugin/LazyPluginCollectionTestBase.php \Drupal\Tests\Core\Plugin\LazyPluginCollectionTestBase::setupPluginCollection()
- 10 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\Matcher\InvokedRecorder|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().
13 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::testCount in core/
tests/ Drupal/ Tests/ Core/ Plugin/ DefaultLazyPluginCollectionTest.php - @covers ::count
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 62
Class
- LazyPluginCollectionTestBase
- Provides a base class for plugin collection tests.
Namespace
Drupal\Tests\Core\PluginCode
protected function setupPluginCollection(InvokedRecorder $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')
->will($this->returnCallback([
$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.