function EntityTypeManagerTest::testHasHandler

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

Tests the hasHandler() method.

@covers ::hasHandler

@dataProvider providerTestHasHandler

File

core/tests/Drupal/Tests/Core/Entity/EntityTypeManagerTest.php, line 138

Class

EntityTypeManagerTest
@coversDefaultClass \Drupal\Core\Entity\EntityTypeManager[[api-linebreak]] @group Entity

Namespace

Drupal\Tests\Core\Entity

Code

public function testHasHandler($entity_type_id, $expected) : void {
  $apple = $this->prophesize(EntityTypeInterface::class);
  $apple->hasHandlerClass('storage')
    ->willReturn(TRUE);
  $banana = $this->prophesize(EntityTypeInterface::class);
  $banana->hasHandlerClass('storage')
    ->willReturn(FALSE);
  $this->setUpEntityTypeDefinitions([
    'apple' => $apple,
    'banana' => $banana,
  ]);
  $entity_type = $this->entityTypeManager
    ->hasHandler($entity_type_id, 'storage');
  $this->assertSame($expected, $entity_type);
}

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