function SearchPluginCollectionTest::testGet

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

Class

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

Namespace

Drupal\Tests\search\Unit

Code

public function testGet() {
    $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.