diff options
Diffstat (limited to 'modules/gallery/tests/Photos_Controller_Test.php')
-rw-r--r-- | modules/gallery/tests/Photos_Controller_Test.php | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/modules/gallery/tests/Photos_Controller_Test.php b/modules/gallery/tests/Photos_Controller_Test.php index 0159b420..624e6878 100644 --- a/modules/gallery/tests/Photos_Controller_Test.php +++ b/modules/gallery/tests/Photos_Controller_Test.php @@ -19,11 +19,12 @@ */ class Photos_Controller_Test extends Unit_Test_Case { public function setup() { - $this->_post = $_POST; + $this->_save = array($_POST, $_SERVER); + $_SERVER["HTTP_REFERER"] = "HTTP_REFERER"; } public function teardown() { - $_POST = $this->_post; + list($_POST, $_SERVER) = $this->_save; } public function change_photo_test() { @@ -31,7 +32,7 @@ class Photos_Controller_Test extends Unit_Test_Case { $root = ORM::factory("item", 1); $photo = photo::create( $root, MODPATH . "gallery/tests/test.jpg", "test.jpeg", - "test", "test", user::active(), "slug"); + "test", "test", identity::active_user()->id, "slug"); $orig_name = $photo->name; $_POST["filename"] = "test.jpeg"; @@ -40,14 +41,15 @@ class Photos_Controller_Test extends Unit_Test_Case { $_POST["description"] = "new description"; $_POST["slug"] = "new-slug"; $_POST["csrf"] = access::csrf_token(); - access::allow(group::everybody(), "edit", $root); + access::allow(identity::everybody(), "edit", $root); ob_start(); $controller->_update($photo); $results = ob_get_contents(); ob_end_clean(); - $this->assert_equal(json_encode(array("result" => "success")), $results); + $this->assert_equal( + json_encode(array("result" => "success", "location" => "HTTP_REFERER")), $results); $this->assert_equal("new-slug", $photo->slug); $this->assert_equal("new title", $photo->title); $this->assert_equal("new description", $photo->description); @@ -64,7 +66,7 @@ class Photos_Controller_Test extends Unit_Test_Case { $_POST["name"] = "new name"; $_POST["title"] = "new title"; $_POST["description"] = "new description"; - access::allow(group::everybody(), "edit", $root); + access::allow(identity::everybody(), "edit", $root); try { $controller->_update($photo); |