You are here

public function SearchPluginCollectionTest::testGetWithConfigurablePlugin in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/search/tests/src/Unit/SearchPluginCollectionTest.php \Drupal\Tests\search\Unit\SearchPluginCollectionTest::testGetWithConfigurablePlugin()

Tests the get() method with a configurable plugin.

File

core/modules/search/tests/src/Unit/SearchPluginCollectionTest.php, line 57

Class

SearchPluginCollectionTest
@coversDefaultClass \Drupal\search\Plugin\SearchPluginCollection @group search

Namespace

Drupal\Tests\search\Unit

Code

public function testGetWithConfigurablePlugin() {
  $plugin = $this
    ->createMock('Drupal\\search\\Plugin\\ConfigurableSearchPluginInterface');
  $plugin
    ->expects($this
    ->once())
    ->method('setSearchPageId')
    ->with('fruit_stand')
    ->will($this
    ->returnValue($plugin));
  $this->pluginManager
    ->expects($this
    ->once())
    ->method('createInstance')
    ->will($this
    ->returnValue($plugin));
  $this
    ->assertSame($plugin, $this->searchPluginCollection
    ->get('banana'));
}