/** * @covers ../../../src/Library/Helper/Directory::remove() */ public function test_remove() { $this->checkNoArg('remove'); \Library\Helper\File::touch(self::$tmp_file); $logs = array(); $this->assertTrue(\Library\Helper\Directory::remove(self::$tmp_dir, $logs)); $this->assertEmpty($logs); }
echo '=> ' . var_export(Library\Helper\File::formatFilename($str), 1); ?> </pre> <h4 id="dirhelper">Library\Helper\Directory</h4> <pre class="code" data-language="php"> <?php $logs = array(); $dir = __DIR__ . '/tmp/tmp_tmp'; echo '$logs = array();' . "\n"; echo '$dir = __DIR__."/tmp/tmp_tmp";' . "\n"; \Library\Helper\Directory::ensureExists($dir); \Library\Helper\File::touch($dir . '/test1'); \Library\Helper\File::touch($dir . '/test2'); \Library\Helper\File::touch($dir . '/test/test1'); \Library\Helper\File::touch($dir . '/test/test2'); \Library\Helper\Directory::chmod($dir, 777, true, 766, $logs); \Library\Helper\Directory::remove($dir, $logs); echo "\n"; echo '\\Library\\Helper\\Directory::ensureExists($dir);' . "\n"; echo '\\Library\\Helper\\File::touch($dir."/test1");' . "\n"; echo '\\Library\\Helper\\File::touch($dir."/test2");' . "\n"; echo '\\Library\\Helper\\File::touch($dir."/test/test1");' . "\n"; echo '\\Library\\Helper\\File::touch($dir."/test/test2");' . "\n"; echo '\\Library\\Helper\\Directory::chmod($dir, 777, true, 766, $logs);' . "\n"; echo '\\Library\\Helper\\Directory::remove($dir, $logs);' . "\n"; echo "\n"; echo 'var_export($logs);' . "\n"; var_export($logs); ?> </pre>
/** * @covers ../../../src/Library/Helper/File::write() */ public function test_write() { $this->checkNoArg('remove'); \Library\Helper\Directory::ensureExists(self::$tmp_dir); \Library\Helper\File::touch(self::$tmp_file); $logs = array(); $this->assertTrue(\Library\Helper\File::write(self::$tmp_file, $this->lorem_ipsum)); $this->assertEmpty($logs); $ctt = trim(file_get_contents(self::$tmp_file)); $this->assertEquals($this->lorem_ipsum, $ctt); }