You are here

public function vfsStreamWrapperFileTimesTestCase::renameFileDoesNotChangeFileTimesOfFileItself 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::renameFileDoesNotChangeFileTimesOfFileItself()

@test @group issue_7

File

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

Class

vfsStreamWrapperFileTimesTestCase
Test for org\bovigo\vfs\vfsStreamWrapper.

Namespace

org\bovigo\vfs

Code

public function renameFileDoesNotChangeFileTimesOfFileItself() {
  $target = vfsStream::newDirectory('target')
    ->at(vfsStreamWrapper::getRoot())
    ->lastModified(200)
    ->lastAccessed(200)
    ->lastAttributeModified(200);
  $source = vfsStream::newDirectory('bar')
    ->at(vfsStreamWrapper::getRoot());
  $file = vfsStream::newFile('baz.txt')
    ->at($source)
    ->lastModified(300)
    ->lastAccessed(300)
    ->lastAttributeModified(300);
  $source
    ->lastModified(100)
    ->lastAccessed(100)
    ->lastAttributeModified(100);
  rename($this->bazUrl, vfsStream::url('root/target/baz.txt'));
  $this
    ->assertEquals(300, filemtime(vfsStream::url('root/target/baz.txt')));
  $this
    ->assertEquals(300, filectime(vfsStream::url('root/target/baz.txt')));
  $this
    ->assertEquals(300, fileatime(vfsStream::url('root/target/baz.txt')));
  $this
    ->assertFileTimesEqualStreamTimes(vfsStream::url('root/target/baz.txt'), $file);
}