function ConfigEntityStorageTest::testCreate
Same name in other branches
- 9 core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityStorageTest.php \Drupal\Tests\Core\Config\Entity\ConfigEntityStorageTest::testCreate()
- 8.9.x core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityStorageTest.php \Drupal\Tests\Core\Config\Entity\ConfigEntityStorageTest::testCreate()
- 10 core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityStorageTest.php \Drupal\Tests\Core\Config\Entity\ConfigEntityStorageTest::testCreate()
@covers ::create @covers ::doCreate
Return value
\Drupal\Core\Entity\EntityInterface
File
-
core/
tests/ Drupal/ Tests/ Core/ Config/ Entity/ ConfigEntityStorageTest.php, line 202
Class
- ConfigEntityStorageTest
- @coversDefaultClass \Drupal\Core\Config\Entity\ConfigEntityStorage @group Config
Namespace
Drupal\Tests\Core\Config\EntityCode
public function testCreate() {
$this->cacheTagsInvalidator
->invalidateTags(Argument::cetera())
->shouldNotBeCalled();
$entity = $this->getMockEntity();
$entity->set('id', 'foo');
$entity->set('langcode', 'hu');
$entity->set('uuid', 'bar');
$entity->setOriginalId('foo');
$entity->enforceIsNew();
$this->moduleHandler
->invokeAll('test_entity_type_create', [
$entity,
])
->shouldBeCalled();
$this->moduleHandler
->invokeAll('entity_create', [
$entity,
'test_entity_type',
])
->shouldBeCalled();
$this->uuidService
->generate()
->willReturn('bar');
$entity = $this->entityStorage
->create([
'id' => 'foo',
]);
$this->assertInstanceOf(EntityInterface::class, $entity);
$this->assertSame('foo', $entity->id());
$this->assertSame('bar', $entity->uuid());
return $entity;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.