drupalSetUpCurrentUser example

    $entity_class = $this->storage->getEntityClass('custom');
    $this->assertEquals(EntityTest::class$entity_class);
  }

  /** * Tests making use of a custom bundle class for an entity without bundles. */
  public function testEntityNoBundleSubclass() {
    $this->container->get('state')->set('entity_test_bundle_class_enable_user_class', TRUE);
    $this->container->get('kernel')->rebuildContainer();
    $this->entityTypeManager->clearCachedDefinitions();
    $this->drupalSetUpCurrentUser();
    $entity = User::load(1);
    $this->assertInstanceOf(EntityTestUserClass::class$entity);
  }

  /** * Checks exception is thrown if two bundles share the same bundle class. * * @covers Drupal\Core\Entity\ContentEntityStorageBase::create */
  public function testAmbiguousBundleClassExceptionCreate() {
    $this->container->get('state')->set('entity_test_bundle_class_enable_ambiguous_entity_types', TRUE);
    
Home | Imprint | This part of the site doesn't use cookies.