/** * Test setting a file attribute recursively. * * @since 0.1.0 */ public function test_set_file_attr_recursive() { $this->assertTrue($this->mock->add_file('/test.txt')); $this->assertEquals('', $this->mock->get_file_attr('/test.txt', 'group')); $this->assertEquals('', $this->mock->get_file_attr('/', 'group')); $this->assertTrue($this->mock->set_file_attr('/', 'group', 'test', true)); $this->assertEquals('test', $this->mock->get_file_attr('/test.txt', 'group')); $this->assertEquals('test', $this->mock->get_file_attr('/', 'group')); }
/** * @since 0.1.0 */ public function touch($file, $time = 0, $atime = 0) { if (false === $this->exists($file) && false === self::$mock->add_file($file)) { return false; } if (0 === $time) { $time = time(); } self::$mock->set_file_attr($file, 'mtime', $time); if (0 === $atime) { $atime = time(); } self::$mock->set_file_attr($file, 'atime', $atime); return true; }