public function LockUnitTest::testBackendLockReleaseAll

Tests backend release functionality.

File

drupal/core/modules/system/lib/Drupal/system/Tests/Lock/LockUnitTest.php, line 74
Contains \Drupal\system\Tests\Lock\LockUnitTest.

Class

LockUnitTest
Tests the lock system.

Namespace

Drupal\system\Tests\Lock

Code

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