You are here

protected function DefaultSingleLazyPluginCollectionTest::setupPluginCollection in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/tests/Drupal/Tests/Core/Plugin/DefaultSingleLazyPluginCollectionTest.php \Drupal\Tests\Core\Plugin\DefaultSingleLazyPluginCollectionTest::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().

Overrides LazyPluginCollectionTestBase::setupPluginCollection

1 call to DefaultSingleLazyPluginCollectionTest::setupPluginCollection()
DefaultSingleLazyPluginCollectionTest::testGet in core/tests/Drupal/Tests/Core/Plugin/DefaultSingleLazyPluginCollectionTest.php
Tests the get() method.

File

core/tests/Drupal/Tests/Core/Plugin/DefaultSingleLazyPluginCollectionTest.php, line 21
Contains \Drupal\Tests\Core\Plugin\DefaultSingleLazyPluginCollectionTest.

Class

DefaultSingleLazyPluginCollectionTest
@coversDefaultClass \Drupal\Core\Plugin\DefaultSingleLazyPluginCollection @group Plugin

Namespace

Drupal\Tests\Core\Plugin

Code

protected function setupPluginCollection(\PHPUnit_Framework_MockObject_Matcher_InvokedRecorder $create_count = NULL) {
  $definitions = $this
    ->getPluginDefinitions();
  $this->pluginInstances['apple'] = $this
    ->getPluginMock('apple', $definitions['apple']);
  $create_count = $create_count ?: $this
    ->never();
  $this->pluginManager
    ->expects($create_count)
    ->method('createInstance')
    ->will($this
    ->returnValue($this->pluginInstances['apple']));
  $this->defaultPluginCollection = new DefaultSingleLazyPluginCollection($this->pluginManager, 'apple', array(
    'id' => 'apple',
    'key' => 'value',
  ));
}