function EntityRevisionsTest::testSaveInHookEntityInsert
Same name in other branches
- 9 core/tests/Drupal/KernelTests/Core/Entity/EntityRevisionsTest.php \Drupal\KernelTests\Core\Entity\EntityRevisionsTest::testSaveInHookEntityInsert()
- 8.9.x core/tests/Drupal/KernelTests/Core/Entity/EntityRevisionsTest.php \Drupal\KernelTests\Core\Entity\EntityRevisionsTest::testSaveInHookEntityInsert()
- 11.x core/tests/Drupal/KernelTests/Core/Entity/EntityRevisionsTest.php \Drupal\KernelTests\Core\Entity\EntityRevisionsTest::testSaveInHookEntityInsert()
Tests re-saving the entity in entity_test_entity_insert().
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Entity/ EntityRevisionsTest.php, line 162
Class
- EntityRevisionsTest
- Tests the loaded Revision of an entity.
Namespace
Drupal\KernelTests\Core\EntityCode
public function testSaveInHookEntityInsert() : void {
// Create an entity which will be saved again in entity_test_entity_insert().
$entity = EntityTestMulRev::create([
'name' => 'EntityLoadedRevisionTest',
]);
$entity->save();
$loadedRevisionId = \Drupal::state()->get('entity_test.loadedRevisionId');
$this->assertEquals($entity->getLoadedRevisionId(), $loadedRevisionId);
$this->assertEquals($entity->getRevisionId(), $entity->getLoadedRevisionId());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.