You are here

public function RevisionUiTest::testRevisionUi in Lightning Core 8.3

Same name and namespace in other branches
  1. 8.5 tests/src/Functional/RevisionUiTest.php \Drupal\Tests\lightning_core\Functional\RevisionUiTest::testRevisionUi()
  2. 8.4 tests/src/Functional/RevisionUiTest.php \Drupal\Tests\lightning_core\Functional\RevisionUiTest::testRevisionUi()

Tests Lightning Core's integration with the core entity revision UI.

File

tests/src/Functional/RevisionUiTest.php, line 23

Class

RevisionUiTest
@group lightning_core

Namespace

Drupal\Tests\lightning_core\Functional

Code

public function testRevisionUi() {
  $assert_session = $this
    ->assertSession();
  $node_type = $this
    ->drupalCreateContentType()
    ->id();
  $node = $this
    ->drupalCreateNode([
    'type' => $node_type,
  ]);
  $account = $this
    ->drupalCreateUser([], NULL, TRUE);
  $this
    ->drupalLogin($account);
  $this
    ->drupalGet($node
    ->toUrl('edit-form'));
  $assert_session
    ->statusCodeEquals(200);
  $assert_session
    ->pageTextContains('Revision information');
  $assert_session
    ->fieldExists('Create new revision');
  $assert_session
    ->fieldExists('Revision log message');
  EntityFormMode::create([
    'id' => 'node.default',
    'label' => 'Default',
    'targetEntityType' => 'node',
    'third_party_settings' => [
      'lightning_core' => [
        'revision_ui' => FALSE,
      ],
    ],
  ])
    ->save();
  $this
    ->getSession()
    ->reload();
  $assert_session
    ->statusCodeEquals(200);
  $assert_session
    ->pageTextNotContains('Revision information');
  $assert_session
    ->fieldNotExists('Create new revision');
  $assert_session
    ->fieldNotExists('Revision log message');
}