/** * Test deleting a file. * * @since 0.1.0 */ public function test_delete_file() { $this->assertTrue($this->mock->add_file('/test.txt')); $this->assertTrue($this->mock->exists('/test.txt')); $this->assertTrue($this->mock->delete('/test.txt')); $this->assertFalse($this->mock->exists('/test.txt')); }
/** * Test deleting a directory recursively. * * @since 0.1.0 */ public function test_rmdir_recursive() { $this->assertTrue($this->mock_fs->add_file('/test', array('type' => 'dir'))); $this->assertTrue($this->mock_fs->add_file('/test/a.txt')); $this->assertTrue($this->fs->rmdir('/test', true)); $this->assertFalse($this->fs->exists('/test')); $this->assertFalse($this->fs->exists('/test/a.txt')); }
/** * @since 0.1.0 */ public function mkdir($path, $chmod = false, $chown = false, $chgrp = false) { if (!$chmod) { $chmod = FS_CHMOD_DIR; } $args = array('type' => 'dir', 'mode' => $chmod); if ($chown) { $args['owner'] = $chown; } if ($chgrp) { $args['group'] = $chgrp; } return self::$mock->add_file($path, $args); }