function ParamConverterManagerTest::testGetConverter

Same name in other branches
  1. 8.9.x core/tests/Drupal/Tests/Core/ParamConverter/ParamConverterManagerTest.php \Drupal\Tests\Core\ParamConverter\ParamConverterManagerTest::testGetConverter()
  2. 10 core/tests/Drupal/Tests/Core/ParamConverter/ParamConverterManagerTest.php \Drupal\Tests\Core\ParamConverter\ParamConverterManagerTest::testGetConverter()
  3. 11.x 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));
}

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