You are here

public function vfsStreamWrapperQuotaTestCase::truncateToMoreThanQotaWritesOnlyUpToQuota in Zircon Profile 8

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

@test @group issue_33

File

vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/vfsStreamWrapperQuotaTestCase.php, line 143

Class

vfsStreamWrapperQuotaTestCase
Test for quota related functionality of org\bovigo\vfs\vfsStreamWrapper.

Namespace

org\bovigo\vfs

Code

public function truncateToMoreThanQotaWritesOnlyUpToQuota() {
  if (version_compare(PHP_VERSION, '5.4.0', '<')) {
    $this
      ->markTestSkipped('Requires PHP 5.4');
  }
  if (strstr(PHP_VERSION, 'hiphop') !== false) {
    $this
      ->markTestSkipped('Not supported on hhvm');
  }
  $fp = fopen(vfsStream::url('root/file.txt'), 'w+');
  $this
    ->assertTrue(ftruncate($fp, 11));
  fclose($fp);
  $this
    ->assertEquals(10, $this->root
    ->getChild('file.txt')
    ->size());
  $this
    ->assertEquals("\0\0\0\0\0\0\0\0\0\0", $this->root
    ->getChild('file.txt')
    ->getContent());
}