public function EntityRevisionsTest::testSaveInHookEntityInsert in Drupal 9
Same name and namespace in other branches
- 8 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() {
// 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());
}