function EntityRepositoryTest::assertEntityType

Same name and namespace in other branches
  1. 9 core/tests/Drupal/KernelTests/Core/Entity/EntityRepositoryTest.php \Drupal\KernelTests\Core\Entity\EntityRepositoryTest::assertEntityType()
  2. 10 core/tests/Drupal/KernelTests/Core/Entity/EntityRepositoryTest.php \Drupal\KernelTests\Core\Entity\EntityRepositoryTest::assertEntityType()
  3. 11.x core/tests/Drupal/KernelTests/Core/Entity/EntityRepositoryTest.php \Drupal\KernelTests\Core\Entity\EntityRepositoryTest::assertEntityType()

Asserts that the entity has the expected entity type ID

Parameters

object|null $entity: An entity object or NULL.

string $expected_entity_type_id: The expected entity type ID.

1 call to EntityRepositoryTest::assertEntityType()
EntityRepositoryTest::testGetActive in core/tests/Drupal/KernelTests/Core/Entity/EntityRepositoryTest.php
Tests retrieving active variants.

File

core/tests/Drupal/KernelTests/Core/Entity/EntityRepositoryTest.php, line 304

Class

EntityRepositoryTest
Tests the entity repository.

Namespace

Drupal\KernelTests\Core\Entity

Code

protected function assertEntityType($entity, $expected_entity_type_id) {
    $this->assertInstanceOf(EntityTest::class, $entity);
    $this->assertEquals($expected_entity_type_id, $entity->getEntityTypeId());
}

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