You are here

public function ModuleIntegrationTest::testContentLock in Thunder 6.1.x

Same name and namespace in other branches
  1. 8.5 tests/src/FunctionalJavascript/ModuleIntegrationTest.php \Drupal\Tests\thunder\FunctionalJavascript\ModuleIntegrationTest::testContentLock()
  2. 8.2 tests/src/FunctionalJavascript/ModuleIntegrationTest.php \Drupal\Tests\thunder\FunctionalJavascript\ModuleIntegrationTest::testContentLock()
  3. 8.3 tests/src/FunctionalJavascript/ModuleIntegrationTest.php \Drupal\Tests\thunder\FunctionalJavascript\ModuleIntegrationTest::testContentLock()
  4. 8.4 tests/src/FunctionalJavascript/ModuleIntegrationTest.php \Drupal\Tests\thunder\FunctionalJavascript\ModuleIntegrationTest::testContentLock()
  5. 6.2.x tests/src/FunctionalJavascript/ModuleIntegrationTest.php \Drupal\Tests\thunder\FunctionalJavascript\ModuleIntegrationTest::testContentLock()
  6. 6.0.x tests/src/FunctionalJavascript/ModuleIntegrationTest.php \Drupal\Tests\thunder\FunctionalJavascript\ModuleIntegrationTest::testContentLock()

Testing the content lock integration.

File

tests/src/FunctionalJavascript/ModuleIntegrationTest.php, line 207

Class

ModuleIntegrationTest
Testing of module integrations.

Namespace

Drupal\Tests\thunder\FunctionalJavascript

Code

public function testContentLock() {
  $node = $this
    ->loadNodeByUuid('0bd5c257-2231-450f-b4c2-ab156af7b78d');
  $this
    ->drupalGet($node
    ->toUrl('edit-form'));
  $this
    ->assertSession()
    ->pageTextContains('This content is now locked against simultaneous editing. This content will remain locked if you navigate away from this page without saving or unlocking it.');
  $page = $this
    ->getSession()
    ->getPage();
  $page
    ->find('xpath', '//*[@id="edit-unlock"]')
    ->click();
  $page
    ->find('xpath', '//*[@id="edit-submit"]')
    ->click();
  $this
    ->assertSession()
    ->pageTextContains('Lock broken. Anyone can now edit this content.');
  $this
    ->drupalGet($node
    ->toUrl('edit-form'));
  $loggedInUser = $this->loggedInUser
    ->label();
  $this
    ->drupalLogout();

  // Login with other user.
  $this
    ->logWithRole(static::$defaultUserRole);
  $this
    ->drupalGet($node
    ->toUrl('edit-form'));
  $this
    ->assertSession()
    ->pageTextContains('This content is being edited by the user ' . $loggedInUser . ' and is therefore locked to prevent other users changes.');
}