function BundleClassTest::testNoAmbiguousBundleClassExceptionSharingEntityClass

Same name in other branches
  1. 11.x core/tests/Drupal/KernelTests/Core/Entity/BundleClassTest.php \Drupal\KernelTests\Core\Entity\BundleClassTest::testNoAmbiguousBundleClassExceptionSharingEntityClass()

Checks that no exception is thrown when two bundles share an entity class.

@covers Drupal\Core\Entity\EntityTypeRepository::getEntityTypeFromClass

File

core/tests/Drupal/KernelTests/Core/Entity/BundleClassTest.php, line 255

Class

BundleClassTest
Tests entity bundle classes.

Namespace

Drupal\KernelTests\Core\Entity

Code

public function testNoAmbiguousBundleClassExceptionSharingEntityClass() : void {
    $shared_type_a = $this->container
        ->get('entity_type.repository')
        ->getEntityTypeFromClass(SharedEntityTestBundleClassA::class);
    $shared_type_b = $this->container
        ->get('entity_type.repository')
        ->getEntityTypeFromClass(SharedEntityTestBundleClassB::class);
    $this->assertSame('shared_type', $shared_type_a);
    $this->assertSame('shared_type', $shared_type_b);
}

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