You are here

public function ParamConverterManagerTest::testGetConverter in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 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 43
Contains \Drupal\Tests\Core\ParamConverter\ParamConverterManagerTest.

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));
}