function EntityConverterTest::testApplies

Same name and namespace in other branches
  1. 9 core/tests/Drupal/Tests/Core/ParamConverter/EntityConverterTest.php \Drupal\Tests\Core\ParamConverter\EntityConverterTest::testApplies()
  2. 8.9.x core/tests/Drupal/Tests/Core/ParamConverter/EntityConverterTest.php \Drupal\Tests\Core\ParamConverter\EntityConverterTest::testApplies()
  3. 10 core/tests/Drupal/Tests/Core/ParamConverter/EntityConverterTest.php \Drupal\Tests\Core\ParamConverter\EntityConverterTest::testApplies()

Tests the applies() method.

@dataProvider providerTestApplies

@covers ::applies

File

core/tests/Drupal/Tests/Core/ParamConverter/EntityConverterTest.php, line 151

Class

EntityConverterTest
@coversDefaultClass <a href="/api/drupal/core%21lib%21Drupal%21Core%21ParamConverter%21EntityConverter.php/class/EntityConverter/11.x" title="Parameter converter for upcasting entity IDs to full objects." class="local">\Drupal\Core\ParamConverter\EntityConverter</a> @group ParamConverter @group Entity

Namespace

Drupal\Tests\Core\ParamConverter

Code

public function testApplies(array $definition, $name, Route $route, $applies) : void {
    $this->entityTypeManager
        ->expects($this->any())
        ->method('hasDefinition')
        ->willReturnCallback(function ($entity_type) {
        return 'entity_test' == $entity_type;
    });
    $this->assertEquals($applies, $this->entityConverter
        ->applies($definition, $name, $route));
}

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