You are here

public function vfsStreamWrapperFlockTestCase::canAquireEclusiveLockWithNonBlockingFlockCall 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::canAquireEclusiveLockWithNonBlockingFlockCall()

@test

File

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

Class

vfsStreamWrapperFlockTestCase
Test for flock() implementation.

Namespace

org\bovigo\vfs

Code

public function canAquireEclusiveLockWithNonBlockingFlockCall() {
  $file = vfsStream::newFile('foo.txt')
    ->at($this->root);
  $fp = fopen(vfsStream::url('root/foo.txt'), 'rb');
  $this
    ->assertTrue(flock($fp, LOCK_EX | LOCK_NB));
  $this
    ->assertTrue($file
    ->isLocked());
  $this
    ->assertFalse($file
    ->hasSharedLock());
  $this
    ->assertTrue($file
    ->hasExclusiveLock());
  fclose($fp);
}