public function LockFunctionalTest::testBackendLockReleaseAll

Tests backend release functionality.

File

drupal/core/modules/system/lib/Drupal/system/Tests/Lock/LockFunctionalTest.php, line 62
Definition of Drupal\system\Tests\Lock\LockFunctionalTest.

Class

LockFunctionalTest
Tests the lock system.

Namespace

Drupal\system\Tests\Lock

Code

public function testBackendLockReleaseAll() {
  $backend = lock();
  $success = $backend
    ->acquire('lock_a');
  $this
    ->assertTrue($success, 'Could acquire first lock.');
  $success = $backend
    ->acquire('lock_b');
  $this
    ->assertTrue($success, 'Could acquire second lock.');
  $backend
    ->releaseAll();
  $is_free = $backend
    ->lockMayBeAvailable('lock_a');
  $this
    ->assertTrue($is_free, 'First lock has been released.');
  $is_free = $backend
    ->lockMayBeAvailable('lock_b');
  $this
    ->assertTrue($is_free, 'Second lock has been released.');
}