You are here

public function ContentEntityStorageBaseTest::testReCreate in Drupal 9

Same name and namespace in other branches
  1. 8 core/tests/Drupal/KernelTests/Core/Entity/ContentEntityStorageBaseTest.php \Drupal\KernelTests\Core\Entity\ContentEntityStorageBaseTest::testReCreate()

@covers ::create

File

core/tests/Drupal/KernelTests/Core/Entity/ContentEntityStorageBaseTest.php, line 55

Class

ContentEntityStorageBaseTest
@coversDefaultClass \Drupal\Core\Entity\ContentEntityStorageBase

Namespace

Drupal\KernelTests\Core\Entity

Code

public function testReCreate() {
  $storage = $this->container
    ->get('entity_type.manager')
    ->getStorage('entity_test');
  $values = $storage
    ->create([
    'type' => 'test_bundle',
  ])
    ->toArray();
  $entity = $storage
    ->create($values);
  $this
    ->assertEquals('test_bundle', $entity
    ->bundle());
}