You are here

public function ModuleIntegrationTest::testContentLock in Thunder 8.2

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

Testing the content lock integration.

File

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

Class

ModuleIntegrationTest
Testing of module integrations.

Namespace

Drupal\Tests\thunder\FunctionalJavascript

Code

public function testContentLock() {
  $this
    ->drupalGet('node/6/edit');
  $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/6/edit');
  $loggedInUser = $this->loggedInUser
    ->label();
  $this
    ->drupalLogout();

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