You are here

protected function LazyPluginCollectionTestBase::getPluginMock in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/tests/Drupal/Tests/Core/Plugin/LazyPluginCollectionTestBase.php \Drupal\Tests\Core\Plugin\LazyPluginCollectionTestBase::getPluginMock()

Returns a mocked plugin object.

Parameters

string $plugin_id: The plugin ID.

array $definition: The plugin definition.

Return value

\Drupal\Component\Plugin\PluginInspectionInterface|\PHPUnit_Framework_MockObject_MockObject

2 calls to LazyPluginCollectionTestBase::getPluginMock()
DefaultSingleLazyPluginCollectionTest::setupPluginCollection in core/tests/Drupal/Tests/Core/Plugin/DefaultSingleLazyPluginCollectionTest.php
Sets up the default plugin collection.
LazyPluginCollectionTestBase::setupPluginCollection in core/tests/Drupal/Tests/Core/Plugin/LazyPluginCollectionTestBase.php
Sets up the default plugin collection.
1 method overrides LazyPluginCollectionTestBase::getPluginMock()
DefaultLazyPluginCollectionTest::getPluginMock in core/tests/Drupal/Tests/Core/Plugin/DefaultLazyPluginCollectionTest.php
Returns a mocked plugin object.

File

core/tests/Drupal/Tests/Core/Plugin/LazyPluginCollectionTestBase.php, line 108
Contains \Drupal\Tests\Core\Plugin\LazyPluginCollectionTestBase.

Class

LazyPluginCollectionTestBase
Provides a base class for plugin collection tests.

Namespace

Drupal\Tests\Core\Plugin

Code

protected function getPluginMock($plugin_id, array $definition) {

  // Create a mock plugin instance.
  $mock = $this
    ->getMock('Drupal\\Component\\Plugin\\PluginInspectionInterface');
  $mock
    ->expects($this
    ->any())
    ->method('getPluginId')
    ->will($this
    ->returnValue($plugin_id));
  return $mock;
}