public function EntityApiTest::testUpdateWithRevisionId in Drupal 10
Same name and namespace in other branches
- 8 core/tests/Drupal/KernelTests/Core/Entity/EntityApiTest.php \Drupal\KernelTests\Core\Entity\EntityApiTest::testUpdateWithRevisionId()
- 9 core/tests/Drupal/KernelTests/Core/Entity/EntityApiTest.php \Drupal\KernelTests\Core\Entity\EntityApiTest::testUpdateWithRevisionId()
Tests that resaving a revision with a different revision ID throws an exception.
File
- core/
tests/ Drupal/ KernelTests/ Core/ Entity/ EntityApiTest.php, line 251
Class
- EntityApiTest
- Tests basic CRUD functionality.
Namespace
Drupal\KernelTests\Core\EntityCode
public function testUpdateWithRevisionId() {
$storage = \Drupal::entityTypeManager()
->getStorage('entity_test_mulrev');
// Create a new entity.
/** @var \Drupal\entity_test\Entity\EntityTestMulRev $entity */
$entity = $storage
->create([
'name' => 'revision_test',
]);
$entity
->save();
$this
->expectException(EntityStorageException::class);
$this
->expectExceptionMessage("Update existing 'entity_test_mulrev' entity revision while changing the revision ID is not supported.");
$entity->revision_id = 60;
$entity
->save();
}