function RevisionVersionHistoryTest::testDescriptionRevLogNullValues

Same name in other branches
  1. 11.x core/tests/Drupal/FunctionalTests/Entity/RevisionVersionHistoryTest.php \Drupal\FunctionalTests\Entity\RevisionVersionHistoryTest::testDescriptionRevLogNullValues()

Test description with entity implementing revision log, with empty values.

@covers ::getRevisionDescription

File

core/tests/Drupal/FunctionalTests/Entity/RevisionVersionHistoryTest.php, line 119

Class

RevisionVersionHistoryTest
Tests version history page.

Namespace

Drupal\FunctionalTests\Entity

Code

public function testDescriptionRevLogNullValues() : void {
    $entity = EntityTestWithRevisionLog::create([
        'type' => 'entity_test_revlog',
    ]);
    $entity->setName('view all revisions')
        ->save();
    // Check entity values are still null after saving; they did not receive
    // values from currentUser or some other global context.
    $this->assertNull($entity->getRevisionUser());
    $this->assertNull($entity->getRevisionUserId());
    $this->assertNull($entity->getRevisionLogMessage());
    $this->drupalGet($entity->toUrl('version-history'));
    $this->assertSession()
        ->elementTextContains('css', 'table tbody tr:nth-child(1)', 'by Anonymous (not verified)');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.