コード例 #1
0
ファイル: DirTest.php プロジェクト: mbcraft/piol
 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();
 }
コード例 #2
0
ファイル: HideLang.php プロジェクト: mbcraft/laravelutils
 /**
  * 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.");
     }
 }
コード例 #3
0
ファイル: ShowLang.php プロジェクト: mbcraft/laravelutils
 /**
  * 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.");
     }
 }