function PluginManagerBaseTest::testGetInstance

Same name and namespace in other branches
  1. 9 core/tests/Drupal/Tests/Component/Plugin/PluginManagerBaseTest.php \Drupal\Tests\Component\Plugin\PluginManagerBaseTest::testGetInstance()
  2. 8.9.x core/tests/Drupal/Tests/Component/Plugin/PluginManagerBaseTest.php \Drupal\Tests\Component\Plugin\PluginManagerBaseTest::testGetInstance()
  3. 11.x core/tests/Drupal/Tests/Component/Plugin/PluginManagerBaseTest.php \Drupal\Tests\Component\Plugin\PluginManagerBaseTest::testGetInstance()

@covers ::getInstance

File

core/tests/Drupal/Tests/Component/Plugin/PluginManagerBaseTest.php, line 99

Class

PluginManagerBaseTest
@coversDefaultClass \Drupal\Component\Plugin\PluginManagerBase[[api-linebreak]] @group Plugin

Namespace

Drupal\Tests\Component\Plugin

Code

public function testGetInstance() : void {
  $options = [
    'foo' => 'F00',
    'bar' => 'bAr',
  ];
  $instance = new \stdClass();
  $mapper = $this->prophesize(MapperInterface::class);
  $mapper->getInstance($options)
    ->shouldBeCalledTimes(1)
    ->willReturn($instance);
  $manager = new StubPluginManagerBaseWithMapper($mapper->reveal());
  $this->assertEquals($instance, $manager->getInstance($options));
}

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