minmal rating tests
This commit is contained in:
parent
afa1f4a583
commit
9af0c260c3
55
contrib/rating/test.php
Normal file
55
contrib/rating/test.php
Normal file
@ -0,0 +1,55 @@
|
||||
<?php
|
||||
class RatingTest extends ShimmieWebTestCase {
|
||||
function testRating() {
|
||||
$this->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();
|
||||
}
|
||||
}
|
||||
?>
|
Loading…
x
Reference in New Issue
Block a user