You are here

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

@test @group issue_7

File

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

Class

vfsStreamWrapperFileTimesTestCase
Test for org\bovigo\vfs\vfsStreamWrapper.

Namespace

org\bovigo\vfs

Code

public function renameFileChangesAttributeAndModificationTimeOfAffectedDirectories() {
  $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
    ->assertLessThanOrEqual(time(), filemtime($this->barUrl));
  $this
    ->assertLessThanOrEqual(time(), filectime($this->barUrl));
  $this
    ->assertEquals(100, fileatime($this->barUrl));
  $this
    ->assertFileTimesEqualStreamTimes($this->barUrl, $source);
  $this
    ->assertLessThanOrEqual(time(), filemtime(vfsStream::url('root/target')));
  $this
    ->assertLessThanOrEqual(time(), filectime(vfsStream::url('root/target')));
  $this
    ->assertEquals(200, fileatime(vfsStream::url('root/target')));
  $this
    ->assertFileTimesEqualStreamTimes(vfsStream::url('root/target'), $target);
}