objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); $this->model = $this->objectManager->create(\Magento\Framework\Lock\Backend\Database::class); } public function testLockAndUnlock() { $name = 'test_lock'; $this->assertFalse($this->model->isLocked($name)); $this->assertTrue($this->model->lock($name)); $this->assertTrue($this->model->isLocked($name)); $this->assertTrue($this->model->unlock($name)); $this->assertFalse($this->model->isLocked($name)); } public function testUnlockWithoutExistingLock() { $name = 'test_lock'; $this->assertFalse($this->model->isLocked($name)); $this->assertFalse($this->model->unlock($name)); } }