You are here

public function PrefetchCacheTest::testPrefetchCacheNormalLocking in Content locking (anti-concurrent editing) 8.2

Same name and namespace in other branches
  1. 8 tests/src/FunctionalJavascript/Integration/PrefetchCacheTest.php \Drupal\Tests\content_lock\FunctionalJavascript\Integration\PrefetchCacheTest::testPrefetchCacheNormalLocking()

Test the prefetch cache integration without JS locking.

File

tests/src/FunctionalJavascript/Integration/PrefetchCacheTest.php, line 73

Class

PrefetchCacheTest
Class PrefetchCacheTest.

Namespace

Drupal\Tests\content_lock\FunctionalJavascript\Integration

Code

public function testPrefetchCacheNormalLocking() {
  $page = $this
    ->getSession()
    ->getPage();
  $this
    ->drupalLogin($this->admin);
  $this
    ->drupalGet('admin/config/content/content_lock');
  $this
    ->click('#edit-entity-types-entity-test-mul-changed');
  $page
    ->pressButton('Save configuration');
  $lockService = \Drupal::service('content_lock');
  $this
    ->drupalLogin($this->user1);
  $this
    ->drupalGet($this->entity
    ->toUrl());

  // Wait a while to give prefetch_cache time to access all pages.
  sleep(3);

  // Without JS locking a lock should be created for the entity.
  $this
    ->assertNotFalse($lockService
    ->fetchLock($this->entity
    ->id(), $this->entity
    ->language()
    ->getId(), NULL, 'entity_test_mul_changed'));
}