You are here

public function vfsStreamWrapperFlockTestCase::canNotRemoveSharedLockAcquiredOnOtherFileHandler in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/vfsStreamWrapperFlockTestCase.php \org\bovigo\vfs\vfsStreamWrapperFlockTestCase::canNotRemoveSharedLockAcquiredOnOtherFileHandler()

@test @group issue_40

See also

https://github.com/mikey179/vfsStream/issues/40

File

vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/vfsStreamWrapperFlockTestCase.php, line 170

Class

vfsStreamWrapperFlockTestCase
Test for flock() implementation.

Namespace

org\bovigo\vfs

Code

public function canNotRemoveSharedLockAcquiredOnOtherFileHandler() {
  $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_SH);
  $this
    ->assertTrue(flock($fp2, LOCK_UN));
  $this
    ->assertTrue($file
    ->isLocked());
  $this
    ->assertTrue($file
    ->hasSharedLock());
  $this
    ->assertFalse($file
    ->hasExclusiveLock());
  fclose($fp1);
  fclose($fp2);
}