本文整理汇总了PHP中Storage::get_default_storage_root方法的典型用法代码示例。如果您正苦于以下问题:PHP Storage::get_default_storage_root方法的具体用法?PHP Storage::get_default_storage_root怎么用?PHP Storage::get_default_storage_root使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Storage
的用法示例。
在下文中一共展示了Storage::get_default_storage_root方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testProps
function testProps()
{
$storage_test_root = "/" . FRAMEWORK_CORE_PATH . "tests/io/storage_dir/";
Storage::set_storage_root($storage_test_root);
$test_file = new File("/" . FRAMEWORK_CORE_PATH . "tests/io/file_props_test.php");
$this->assertFalse($test_file->hasStoredProps(), "Il file ha delle proprieta' con lo storage vuoto!!");
$storage = $test_file->getStoredProps();
$storage->add("test", array("hello" => 1, "world" => "good"));
$this->assertTrue($test_file->hasStoredProps(), "Il file storage delle proprieta' non e' stato creato!!");
$file_path = $test_file->getPath();
$sum = md5($file_path);
$store_subdir = "_" . substr($sum, 0, 1);
$storage_test_root_dir = new Dir($storage_test_root);
$real_store_dir = $storage_test_root_dir->getSingleSubdir();
$all_dirs = $real_store_dir->listFiles();
$props_file_dir = $all_dirs[0];
$this->assertEqual($props_file_dir->getName(), $store_subdir, "La directory creata non corrisponde!!");
$final_stored_path = new File($real_store_dir->getPath() . $props_file_dir->getName() . DS . $sum . ".ini");
$this->assertTrue($final_stored_path->exists(), "Il file finale delle props non e' stato trovato!!");
$test_file->deleteStoredProps();
$this->assertFalse($test_file->hasStoredProps(), "Il file delle proprieta' non e' stato eliminato!!");
$all_files = $real_store_dir->listFiles();
foreach ($all_files as $f) {
$f->delete(true);
}
Storage::set_storage_root(Storage::get_default_storage_root());
}
示例2: testGetAllInstalledModules
function testGetAllInstalledModules()
{
ModuleUtils::set_modules_path(FRAMEWORK_CORE_PATH . "tests/base/fakeroot/modules/");
Storage::set_storage_root(DS . FRAMEWORK_CORE_PATH . "tests/modules/test_installed_modules_storage/");
$all_installed_modules = InstalledModules::get_all_installed_modules();
$this->assertEqual(count($all_installed_modules), 2, "Il numero di moduli installati non corrisponde!!");
Storage::set_storage_root(Storage::get_default_storage_root());
}
示例3: testCreateStorageOnWrite
function testCreateStorageOnWrite()
{
Storage::set_storage_root(DS . FRAMEWORK_CORE_PATH . "tests/io/storage_dir/");
$d = new Dir(DS . FRAMEWORK_CORE_PATH . "tests/io/storage_dir/");
foreach ($d->listFiles() as $f) {
$f->delete(true);
}
$this->assertFalse($d->hasSingleSubdir(), "Lo storage e' gia' presente!!");
$storage = Storage::getPropertiesStorage("boh", "ciccia");
$this->assertFalse($storage->exists(), "Lo storage esiste gia'!!");
$test_props = array("test" => "value", "hello" => "world");
$storage->add("category", $test_props);
$this->assertTrue($storage->exists(), "Lo storage non e' stato creato!!");
$storage->delete();
$this->assertFalse($storage->exists(), "Lo storage non e' stato eliminato!!");
$properties = $storage->readAll();
//readAll
$this->assertTrue($storage->exists(), "Lo storage non e' stato creato per una lettura!!");
$this->assertFalse($properties === null, "Il risultato ritornato e' ===null !!");
$this->assertTrue(is_array($properties), "Il metodo non ha ritornato un array con uno storage inesistente!!");
$this->assertTrue(count($properties) == 0, "L'array ritornato da una lettura di storage vuoto non e' vuoto!!");
$storage->delete();
$storage->remove("blah");
//remove
$this->assertTrue($storage->exists(), "Lo storage non e' stato creato per una cancellazione!!");
$storage->delete();
$storage->saveAll(array());
//saveAll
$this->assertTrue($storage->exists(), "Lo storage non e' stato creato per una cancellazione!!");
$storage->delete();
$this->assertFalse($storage->exists(), "Lo storage non e' stato eliminato!!");
foreach ($d->listFiles() as $f) {
$f->delete(true);
}
Storage::set_storage_root(Storage::get_default_storage_root());
}