You are here

protected function LazyPluginCollectionTestBase::getPluginMock in Drupal 9

Same name and namespace in other branches
  1. 8 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

1 call to LazyPluginCollectionTestBase::getPluginMock()
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 104

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
    ->createMock('Drupal\\Component\\Plugin\\PluginInspectionInterface');
  $mock
    ->expects($this
    ->any())
    ->method('getPluginId')
    ->will($this
    ->returnValue($plugin_id));
  return $mock;
}