/** * @covers Kotchasan\File::makeDirectory * @todo Implement testMakeDirectory(). */ public function testFile() { $this->object->makeDirectory('temp/'); $this->object->makeDirectory('temp/test/'); $f = fopen('temp/test/index.php', 'w'); fclose($f); $this->object->copyDirectory('temp/test/', 'temp/'); $result = array(); $this->object->listFiles('temp/test/', $result); $this->object->removeDirectory('temp/'); $this->assertEquals(array('temp/test/index.php'), $result); }
<?php // ลบไฟล์ session_start(); // header header("content-type: text/html; charset=UTF-8"); // ตัวแปรที่จำเป็นสำหรับ Framework ใช้ระบุ root folder define('APP_PATH', str_replace(array('\\', 'ckeditor/filemanager/browser/default'), array('/', ''), dirname(__FILE__))); // load Kotchasan include APP_PATH . 'core/load.php'; // inint Kotchasan Framework Kotchasan::createWebApplication(); if (\Input::isReferer() && \Login::isAdmin()) { if (isset($_POST['did'])) { \File::removeDirectory(ROOT_PATH . $_POST['did']); } elseif (isset($_POST['fid'])) { @unlink(ROOT_PATH . $_POST['fid']); } } else { echo 'Do not delete!'; }