function ConfigEntityStorageTest::testCreateWithPredefinedUuid

Same name and namespace in other branches
  1. 11.x core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityStorageTest.php \Drupal\Tests\Core\Config\Entity\ConfigEntityStorageTest::testCreateWithPredefinedUuid()
  2. 10 core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityStorageTest.php \Drupal\Tests\Core\Config\Entity\ConfigEntityStorageTest::testCreateWithPredefinedUuid()
  3. 9 core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityStorageTest.php \Drupal\Tests\Core\Config\Entity\ConfigEntityStorageTest::testCreateWithPredefinedUuid()
  4. 8.9.x core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityStorageTest.php \Drupal\Tests\Core\Config\Entity\ConfigEntityStorageTest::testCreateWithPredefinedUuid()

Tests create with predefined uuid.

@legacy-covers ::create @legacy-covers ::doCreate

File

core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityStorageTest.php, line 176

Class

ConfigEntityStorageTest
Tests Drupal\Core\Config\Entity\ConfigEntityStorage.

Namespace

Drupal\Tests\Core\Config\Entity

Code

public function testCreateWithPredefinedUuid() : void {
  $this->cacheTagsInvalidator
    ->invalidateTags(Argument::cetera())
    ->shouldNotBeCalled();
  $this->uuidService
    ->generate()
    ->shouldNotBeCalled();
  $entity = $this->entityStorage
    ->create([
    'id' => 'foo',
    'uuid' => 'baz',
  ]);
  $this->assertInstanceOf(EntityInterface::class, $entity);
  $this->assertSame('foo', $entity->id());
  $this->assertSame('baz', $entity->uuid());
  $this->moduleHandler
    ->invokeAll('test_entity_type_create', [
    $entity,
  ])
    ->shouldBeCalled();
  $this->moduleHandler
    ->invokeAll('entity_create', [
    $entity,
    'test_entity_type',
  ])
    ->shouldBeCalled();
}

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