You are here

public function ParamConverterManagerTest::testGetConverter in Drupal 9

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/Core/ParamConverter/ParamConverterManagerTest.php \Drupal\Tests\Core\ParamConverter\ParamConverterManagerTest::testGetConverter()

Tests \Drupal\Core\ParamConverter\ParamConverterManager::getConverter().

@dataProvider providerTestGetConverter

@covers ::getConverter

File

core/tests/Drupal/Tests/Core/ParamConverter/ParamConverterManagerTest.php, line 39

Class

ParamConverterManagerTest
@coversDefaultClass \Drupal\Core\ParamConverter\ParamConverterManager @group ParamConverter

Namespace

Drupal\Tests\Core\ParamConverter

Code

public function testGetConverter($name, $class) {
  $converter = $this
    ->getMockBuilder('Drupal\\Core\\ParamConverter\\ParamConverterInterface')
    ->setMockClassName($class)
    ->getMock();
  $this->manager
    ->addConverter($converter, $name);
  $this
    ->assertInstanceOf($class, $this->manager
    ->getConverter($name));

  // Assert that a second call to getConverter() does not use the container.
  $this
    ->assertInstanceOf($class, $this->manager
    ->getConverter($name));
}