function SearchPluginCollectionTest::testGetWithConfigurablePlugin

Same name in other branches
  1. 9 core/modules/search/tests/src/Unit/SearchPluginCollectionTest.php \Drupal\Tests\search\Unit\SearchPluginCollectionTest::testGetWithConfigurablePlugin()
  2. 8.9.x core/modules/search/tests/src/Unit/SearchPluginCollectionTest.php \Drupal\Tests\search\Unit\SearchPluginCollectionTest::testGetWithConfigurablePlugin()
  3. 11.x 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 61

Class

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

Namespace

Drupal\Tests\search\Unit

Code

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.