This repository has been archived on 2024-09-05. You can view files and clone it, but cannot push or open issues or pull requests.
shimmie2/ext/rating/test.php

55 lines
1.5 KiB
PHP
Raw Normal View History

2009-08-13 20:42:48 +00:00
<?php
2015-09-20 21:40:04 +00:00
class RatingTest extends ShimmiePHPUnitTestCase {
2015-09-26 10:17:13 +00:00
public function testRating() {
2009-08-13 20:42:48 +00:00
$this->log_in_as_user();
2015-08-09 11:14:28 +00:00
$image_id = $this->post_image("tests/pbx_screenshot.jpg", "pbx");
2009-08-13 20:42:48 +00:00
# test for bug #735: user forced to set rating, can't
# set tags and leave unrated
$this->get_page("post/view/$image_id");
2009-08-19 00:28:48 +00:00
$this->assert_title("Image $image_id: pbx");
2015-09-20 21:40:04 +00:00
$this->markTestIncomplete();
2015-09-20 21:40:04 +00:00
2009-08-19 00:28:48 +00:00
$this->set_field("tag_edit__tags", "new");
2009-08-13 20:42:48 +00:00
$this->click("Set");
2009-08-19 00:28:48 +00:00
$this->assert_title("Image $image_id: new");
2009-08-13 20:42:48 +00:00
# set safe
2009-08-19 00:28:48 +00:00
$this->set_field("rating", "s");
2009-08-13 20:42:48 +00:00
$this->click("Set");
2009-08-19 00:28:48 +00:00
$this->assert_title("Image $image_id: new");
2009-08-13 20:42:48 +00:00
# search for it in various ways
$this->get_page("post/list/rating=Safe/1");
2009-08-19 00:28:48 +00:00
$this->assert_title("Image $image_id: new");
2009-08-13 20:42:48 +00:00
$this->get_page("post/list/rating=s/1");
2009-08-19 00:28:48 +00:00
$this->assert_title("Image $image_id: new");
2009-08-13 20:42:48 +00:00
$this->get_page("post/list/rating=sqe/1");
2009-08-19 00:28:48 +00:00
$this->assert_title("Image $image_id: new");
2009-08-13 20:42:48 +00:00
# test that search by tag still works
$this->get_page("post/list/new/1");
2009-08-19 00:28:48 +00:00
$this->assert_title("Image $image_id: new");
2009-08-13 20:42:48 +00:00
# searching for a different rating should return nothing
$this->get_page("post/list/rating=q/1");
2009-08-19 00:28:48 +00:00
$this->assert_text("No Images Found");
2009-08-13 20:42:48 +00:00
# now set explicit, for the next test
$this->get_page("post/view/$image_id");
2009-08-19 00:28:48 +00:00
$this->set_field("rating", "e");
2009-08-13 20:42:48 +00:00
$this->click("Set");
2009-08-19 00:28:48 +00:00
$this->assert_title("Image $image_id: new");
2009-08-13 20:42:48 +00:00
$this->log_out();
# the explicit image shouldn't show up in anon's searches
$this->get_page("post/list/new/1");
2009-08-19 00:28:48 +00:00
$this->assert_text("No Images Found");
2009-08-13 20:42:48 +00:00
}
}