You are here

public function vfsStreamWrapperFileTimesTestCase::openFileWithTruncateChangesAttributeAndModificationTime in Zircon Profile 8

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

@test @group issue_7 @group issue_26

File

vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/vfsStreamWrapperFileTimesTestCase.php, line 111

Class

vfsStreamWrapperFileTimesTestCase
Test for org\bovigo\vfs\vfsStreamWrapper.

Namespace

org\bovigo\vfs

Code

public function openFileWithTruncateChangesAttributeAndModificationTime() {
  $file = vfsStream::newFile('foo.txt')
    ->withContent('test')
    ->at(vfsStreamWrapper::getRoot())
    ->lastModified(100)
    ->lastAccessed(100)
    ->lastAttributeModified(100);
  fclose(fopen($this->fooUrl, 'wb'));
  $this
    ->assertGreaterThan(time() - 2, filemtime($this->fooUrl));
  $this
    ->assertGreaterThan(time() - 2, fileatime($this->fooUrl));
  $this
    ->assertLessThanOrEqual(time(), filemtime($this->fooUrl));
  $this
    ->assertLessThanOrEqual(time(), fileatime($this->fooUrl));
  $this
    ->assertEquals(100, filectime($this->fooUrl));
  $this
    ->assertFileTimesEqualStreamTimes($this->fooUrl, $file);
}