function SearchPluginCollectionTest::testGet

Same name in other branches
  1. 9 core/modules/search/tests/src/Unit/SearchPluginCollectionTest.php \Drupal\Tests\search\Unit\SearchPluginCollectionTest::testGet()
  2. 8.9.x core/modules/search/tests/src/Unit/SearchPluginCollectionTest.php \Drupal\Tests\search\Unit\SearchPluginCollectionTest::testGet()
  3. 10 core/modules/search/tests/src/Unit/SearchPluginCollectionTest.php \Drupal\Tests\search\Unit\SearchPluginCollectionTest::testGet()

Tests the get() method.

File

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

Class

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

Namespace

Drupal\Tests\search\Unit

Code

public function testGet() : void {
    $plugin = $this->createMock('Drupal\\search\\Plugin\\SearchInterface');
    $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.