You are here

public function PluginManagerBaseTest::testGetInstance in Drupal 9

Same name and namespace in other branches
  1. 8 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 101

Class

PluginManagerBaseTest
@coversDefaultClass \Drupal\Component\Plugin\PluginManagerBase @group Plugin

Namespace

Drupal\Tests\Component\Plugin

Code

public function testGetInstance() {
  $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));
}