function 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().
13 calls to LazyPluginCollectionTestBase::setupPluginCollection()
- DefaultLazyPluginCollectionTest::testAddInstanceId in core/
tests/ Drupal/ Tests/ Core/ Plugin/ DefaultLazyPluginCollectionTest.php  - Tests add instance id.
 - DefaultLazyPluginCollectionTest::testClear in core/
tests/ Drupal/ Tests/ Core/ Plugin/ DefaultLazyPluginCollectionTest.php  - Tests clear.
 - DefaultLazyPluginCollectionTest::testConfigurableGetConfiguration in core/
tests/ Drupal/ Tests/ Core/ Plugin/ DefaultLazyPluginCollectionTest.php  - Tests configurable get configuration.
 - DefaultLazyPluginCollectionTest::testConfigurableSetConfiguration in core/
tests/ Drupal/ Tests/ Core/ Plugin/ DefaultLazyPluginCollectionTest.php  - Tests configurable set configuration.
 - DefaultLazyPluginCollectionTest::testCount in core/
tests/ Drupal/ Tests/ Core/ Plugin/ DefaultLazyPluginCollectionTest.php  - Tests 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 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.