function testMoveToWithRename() { $d = new Dir("/test/move_source/my_dir/"); $d->touch(); $f = new File("/test/move_source/my_dir/afile.txt"); $f->touch(); $f->setContent("abc"); $target_dir = new Dir("/test/move_target/"); $dt = new Dir("/test/move_target/moved_dir/"); $this->assertFalse($dt->exists(), "La directory nella directory target esiste già!!"); $d->moveTo($target_dir, "moved_dir"); $this->assertFalse($d->exists(), "La directory non è stata spostata!!"); $this->assertTrue($dt->exists(), "La directory nella directory target non esiste!!"); $ft = new File("/test/move_target/moved_dir/afile.txt"); $this->assertEquals("abc", $ft->getContent(), "Il contenuto del file spostato non corrisponde!!"); $dt->delete(); }
/** * Execute the command. * * @return void */ public function handle() { $lang = $this->getNameArgument(); // $target = new Dir("/resources/lang/" . $lang); if ($target->exists()) { $hide_dir = new Dir("/storage/app/hidden_langs"); if (!$hide_dir->exists()) { $this->info("Hidden languages storage dir created."); $hide_dir->touch(); } $target->moveTo($hide_dir); $this->info("Language " . $lang . " hidden succesfully."); } else { $this->error("Language " . $lang . " not found."); } }
/** * Execute the command. * * @return void */ public function handle() { $lang = $this->getNameArgument(); // $target = new Dir("/storage/app/hidden_langs/" . $lang); if ($target->exists()) { $show_dir = new Dir("/resources/lang/"); $target->moveTo($show_dir); $this->info("Language " . $lang . " reenabled succesfully."); $check_dir_delete_if_empty = new Dir("/storage/app/hidden_langs"); if ($check_dir_delete_if_empty->isEmpty()) { $check_dir_delete_if_empty->delete(); $this->info("Hidden languages storage dir deleted (empty)."); } } else { $this->error("Language " . $lang . " not found."); } }