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

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

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