diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityOriginalRevisionTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityOriginalRevisionTest.php index 1694dad..9e15d78 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityOriginalRevisionTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityOriginalRevisionTest.php @@ -28,7 +28,11 @@ protected function setUp() { } - public function testPreviousProperty() { + /** + * Tests the original revision id is set and returned at the right point in + * the entity process. + */ + public function testOriginalRevisionId() { // Create a basic EntityTestMulRev entity and save it. $entity = EntityTestMulRev::create(); $entity->save(); @@ -37,17 +41,17 @@ public function testPreviousProperty() { $loaded = EntityTestMulRev::load($entity->id()); $loaded->setNewRevision(TRUE); - // Before saving the original revision ID should be the same as the created - // entity, not the same as the loaded entity (which won't have a revision id - // yet). + // Before saving, the original revision ID should be the same as the created + // entity, not the same as the loaded entity (which do not have a revision + // id yet). $this->assertEquals($entity->getRevisionId(), $loaded->getOriginalRevisionId()); $this->assertNotEquals($loaded->getRevisionId(), $loaded->getOriginalRevisionId()); - $this->assertTrue($loaded->getRevisionId() === NULL); + $this->assertSame(NULL, $loaded->getRevisionId()); $loaded->save(); - // In hook_update the original revision id was stored in state. This should - // be the same as we had before calling $loaded->save(). + // In entity_test_update the original revision id was stored in state. This + // should be the same as we had before calling $loaded->save(). /** @var \Drupal\Core\Entity\ContentEntityInterface $loaded_original */ $originalRevisionId = \Drupal::state()->get('entity_test.originalRevisionId'); $this->assertEquals($entity->getRevisionId(), $originalRevisionId); @@ -68,8 +72,9 @@ public function testPreviousProperty() { $loaded->save(); - // After saving the original revision id set in hook_update, and returned - // from the entity should be the same and the entity's revision id. + // After saving, the original revision id set in entity_test and returned + // from the entity should be the same and the entity's revision id because + // a new revision wasn't created, the existing revision was updated. $originalRevisionId2 = \Drupal::state()->get('entity_test.originalRevisionId'); $this->assertEquals($loaded->getRevisionId(), $originalRevisionId2); $this->assertEquals($loaded->getRevisionId(), $loaded->getOriginalRevisionId());