org\bovigo\vfs\vfsStreamWrapperFlockTestCase::canNotAquireExclusiveLockIfAlreadyExclusivelyLockedOnOtherFileHandler PHP Метод

canNotAquireExclusiveLockIfAlreadyExclusivelyLockedOnOtherFileHandler() публичный Метод

См. также: https://github.com/mikey179/vfsStream/issues/40
    public function canNotAquireExclusiveLockIfAlreadyExclusivelyLockedOnOtherFileHandler()
    {
        $file = vfsStream::newFile('foo.txt')->at($this->root);
        $fp1 = fopen(vfsStream::url('root/foo.txt'), 'rb');
        $fp2 = fopen(vfsStream::url('root/foo.txt'), 'rb');
        $file->lock($fp1, LOCK_EX);
        $this->assertFalse(flock($fp2, LOCK_EX + LOCK_NB));
        $this->assertTrue($file->isLocked());
        $this->assertFalse($file->hasSharedLock());
        $this->assertTrue($file->hasExclusiveLock());
        $this->assertTrue($file->hasExclusiveLock($fp1));
        $this->assertFalse($file->hasExclusiveLock($fp2));
        fclose($fp1);
        fclose($fp2);
    }