예제 #1
0
파일: test.php 프로젝트: Joe7/gallery3
 static function random_tag()
 {
     $tag = ORM::factory("tag");
     $tag->name = random::string(6);
     // Reload so that ORM coerces all fields into strings.
     return $tag->save()->reload();
 }
예제 #2
0
 public function change_album_test()
 {
     $controller = new Albums_Controller();
     $album = test::random_album();
     // Randomize to avoid conflicts.
     $new_name = "new_name_" . random::string(6);
     $_POST["name"] = $new_name;
     $_POST["title"] = "new title";
     $_POST["description"] = "new description";
     $_POST["column"] = "weight";
     $_POST["direction"] = "ASC";
     $_POST["csrf"] = access::csrf_token();
     $_POST["slug"] = "new-name";
     access::allow(identity::everybody(), "edit", item::root());
     ob_start();
     $controller->update($album->id);
     $album->reload();
     $results = ob_get_contents();
     ob_end_clean();
     $this->assert_equal(json_encode(array("result" => "success")), $results);
     $this->assert_equal($new_name, $album->name);
     $this->assert_equal("new title", $album->title);
     $this->assert_equal("new description", $album->description);
 }