public function testOpenWhenFileOpened() { $filepath = '/tmp/LockFile/test.lock'; $this->assertEquals(false, file_exists($filepath)); touch($filepath); $lockFile = new LockFile($filepath); $lockFile->lock(LOCK_EX); $target = new LockFile($filepath); $this->assertEquals(true, $target->getFileInfo()->isFile()); }
/** * Unlock file for another thread. * * @return bool */ public function unlock() { $out = $this->file->lock(LOCK_UN); $this->lock = !$out; return $out; }