public function LockTest::testBackendLockReleaseAll in Drupal 10
Same name and namespace in other branches
- 8 core/tests/Drupal/KernelTests/Core/Lock/LockTest.php \Drupal\KernelTests\Core\Lock\LockTest::testBackendLockReleaseAll()
- 9 core/tests/Drupal/KernelTests/Core/Lock/LockTest.php \Drupal\KernelTests\Core\Lock\LockTest::testBackendLockReleaseAll()
Tests backend release functionality.
File
- core/
tests/ Drupal/ KernelTests/ Core/ Lock/ LockTest.php, line 70
Class
- LockTest
- Tests the Database lock backend.
Namespace
Drupal\KernelTests\Core\LockCode
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.');
}