2009-07-20 05:51:36 +00:00
|
|
|
<?php
|
2015-09-20 21:40:04 +00:00
|
|
|
class NumericScoreTest extends ShimmiePHPUnitTestCase {
|
2009-07-20 05:51:36 +00:00
|
|
|
function testNumericScore() {
|
|
|
|
$this->log_in_as_user();
|
2015-08-09 11:14:28 +00:00
|
|
|
$image_id = $this->post_image("tests/pbx_screenshot.jpg", "pbx");
|
2009-07-20 05:51:36 +00:00
|
|
|
$this->get_page("post/view/$image_id");
|
2015-09-20 21:40:04 +00:00
|
|
|
|
2015-09-21 09:05:32 +00:00
|
|
|
$this->markTestIncomplete();
|
2015-09-20 21:40:04 +00:00
|
|
|
|
2009-08-19 00:28:48 +00:00
|
|
|
$this->assert_text("Current Score: 0");
|
2009-07-20 05:51:36 +00:00
|
|
|
$this->click("Vote Down");
|
2009-08-19 00:28:48 +00:00
|
|
|
$this->assert_text("Current Score: -1");
|
2009-07-20 05:51:36 +00:00
|
|
|
$this->click("Vote Up");
|
2009-08-19 00:28:48 +00:00
|
|
|
$this->assert_text("Current Score: 1");
|
2009-07-20 05:51:36 +00:00
|
|
|
# FIXME: "remove vote" button?
|
|
|
|
# FIXME: test that up and down are hidden if already voted up or down
|
2009-08-13 16:48:28 +00:00
|
|
|
|
2009-08-13 18:26:23 +00:00
|
|
|
# test search by score
|
2009-08-13 16:48:28 +00:00
|
|
|
$this->get_page("post/list/score=1/1");
|
2009-08-19 00:28:48 +00:00
|
|
|
$this->assert_title("Image $image_id: pbx");
|
2009-08-13 18:26:23 +00:00
|
|
|
|
2010-05-13 09:44:47 +00:00
|
|
|
$this->get_page("post/list/score>0/1");
|
|
|
|
$this->assert_title("Image $image_id: pbx");
|
|
|
|
|
|
|
|
$this->get_page("post/list/score>-5/1");
|
|
|
|
$this->assert_title("Image $image_id: pbx");
|
|
|
|
|
|
|
|
$this->get_page("post/list/-score>5/1");
|
|
|
|
$this->assert_title("Image $image_id: pbx");
|
|
|
|
|
|
|
|
$this->get_page("post/list/-score<-5/1");
|
|
|
|
$this->assert_title("Image $image_id: pbx");
|
|
|
|
|
2009-08-13 18:26:23 +00:00
|
|
|
# test search by vote
|
2009-08-16 19:19:09 +00:00
|
|
|
$this->get_page("post/list/upvoted_by=test/1");
|
2009-08-19 00:28:48 +00:00
|
|
|
$this->assert_title("Image $image_id: pbx");
|
|
|
|
$this->assert_no_text("No Images Found");
|
2009-08-13 18:26:23 +00:00
|
|
|
|
2009-08-13 18:27:20 +00:00
|
|
|
# and downvote
|
2009-08-16 19:19:09 +00:00
|
|
|
$this->get_page("post/list/downvoted_by=test/1");
|
2009-08-19 00:28:48 +00:00
|
|
|
$this->assert_text("No Images Found");
|
2010-03-22 14:42:23 +00:00
|
|
|
|
|
|
|
# test errors
|
|
|
|
$this->get_page("post/list/upvoted_by=asdfasdf/1");
|
|
|
|
$this->assert_text("No Images Found");
|
|
|
|
$this->get_page("post/list/downvoted_by=asdfasdf/1");
|
|
|
|
$this->assert_text("No Images Found");
|
|
|
|
$this->get_page("post/list/upvoted_by_id=0/1");
|
|
|
|
$this->assert_text("No Images Found");
|
|
|
|
$this->get_page("post/list/downvoted_by_id=0/1");
|
|
|
|
$this->assert_text("No Images Found");
|
|
|
|
|
2009-07-20 05:51:36 +00:00
|
|
|
$this->log_out();
|
|
|
|
|
|
|
|
$this->log_in_as_admin();
|
|
|
|
$this->delete_image($image_id);
|
|
|
|
$this->log_out();
|
|
|
|
}
|
|
|
|
}
|
2014-04-26 02:54:51 +00:00
|
|
|
|