PSR-2. I'm not a huge fan, but ugly consistency beats no consistency...

This commit is contained in:
Shish
2019-05-28 17:59:38 +01:00
parent 5ec3e89884
commit 34b05cca7c
295 changed files with 27094 additions and 24632 deletions

View File

@ -1,60 +1,61 @@
<?php
class NumericScoreTest extends ShimmiePHPUnitTestCase {
public function testNumericScore() {
$this->log_in_as_user();
$image_id = $this->post_image("tests/pbx_screenshot.jpg", "pbx");
$this->get_page("post/view/$image_id");
class NumericScoreTest extends ShimmiePHPUnitTestCase
{
public function testNumericScore()
{
$this->log_in_as_user();
$image_id = $this->post_image("tests/pbx_screenshot.jpg", "pbx");
$this->get_page("post/view/$image_id");
$this->markTestIncomplete();
$this->markTestIncomplete();
$this->assert_text("Current Score: 0");
$this->click("Vote Down");
$this->assert_text("Current Score: -1");
$this->click("Vote Up");
$this->assert_text("Current Score: 1");
# FIXME: "remove vote" button?
# FIXME: test that up and down are hidden if already voted up or down
$this->assert_text("Current Score: 0");
$this->click("Vote Down");
$this->assert_text("Current Score: -1");
$this->click("Vote Up");
$this->assert_text("Current Score: 1");
# FIXME: "remove vote" button?
# FIXME: test that up and down are hidden if already voted up or down
# test search by score
$this->get_page("post/list/score=1/1");
$this->assert_title("Image $image_id: pbx");
# test search by score
$this->get_page("post/list/score=1/1");
$this->assert_title("Image $image_id: pbx");
$this->get_page("post/list/score>0/1");
$this->assert_title("Image $image_id: pbx");
$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");
$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");
# test search by vote
$this->get_page("post/list/upvoted_by=test/1");
$this->assert_title("Image $image_id: pbx");
$this->assert_no_text("No Images Found");
# test search by vote
$this->get_page("post/list/upvoted_by=test/1");
$this->assert_title("Image $image_id: pbx");
$this->assert_no_text("No Images Found");
# and downvote
$this->get_page("post/list/downvoted_by=test/1");
$this->assert_text("No Images Found");
# and downvote
$this->get_page("post/list/downvoted_by=test/1");
$this->assert_text("No Images Found");
# 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");
# 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");
$this->log_out();
$this->log_out();
$this->log_in_as_admin();
$this->delete_image($image_id);
$this->log_out();
}
$this->log_in_as_admin();
$this->delete_image($image_id);
$this->log_out();
}
}