diff --git a/contrib/rating/test.php b/contrib/rating/test.php new file mode 100644 index 00000000..b76ba2fe --- /dev/null +++ b/contrib/rating/test.php @@ -0,0 +1,55 @@ +log_in_as_user(); + $image_id = $this->post_image("ext/simpletest/data/pbx_screenshot.jpg", "pbx"); + + # test for bug #735: user forced to set rating, can't + # set tags and leave unrated + $this->get_page("post/view/$image_id"); + $this->assertTitle("Image $image_id: pbx"); + $this->setField("tag_edit__tags", "new"); + $this->click("Set"); + $this->assertTitle("Image $image_id: new"); + + # set safe + $this->setField("rating", "s"); + $this->click("Set"); + $this->assertTitle("Image $image_id: new"); + + # search for it in various ways + $this->get_page("post/list/rating=Safe/1"); + $this->assertTitle("Image $image_id: new"); + + $this->get_page("post/list/rating=s/1"); + $this->assertTitle("Image $image_id: new"); + + $this->get_page("post/list/rating=sqe/1"); + $this->assertTitle("Image $image_id: new"); + + # test that search by tag still works + $this->get_page("post/list/new/1"); + $this->assertTitle("Image $image_id: new"); + + # searching for a different rating should return nothing + $this->get_page("post/list/rating=q/1"); + $this->assertText("No Images Found"); + + # now set explicit, for the next test + $this->get_page("post/view/$image_id"); + $this->setField("rating", "e"); + $this->click("Set"); + $this->assertTitle("Image $image_id: new"); + + $this->log_out(); + + # the explicit image shouldn't show up in anon's searches + $this->get_page("post/list/new/1"); + $this->assertText("No Images Found"); + + $this->log_in_as_admin(); + $this->delete_image($image_id); + $this->log_out(); + } +} +?>