2008-10-11 07:09:42 +00:00
|
|
|
<?php
|
2015-09-12 11:24:18 +00:00
|
|
|
class ViewTest extends ShimmiePHPUnitTestCase {
|
2015-09-26 10:17:13 +00:00
|
|
|
public function setUp() {
|
2015-09-24 22:16:38 +00:00
|
|
|
parent::setUp();
|
|
|
|
// FIXME: upload images
|
|
|
|
}
|
|
|
|
|
2015-09-26 10:17:13 +00:00
|
|
|
public function testViewPage() {
|
2009-07-15 01:42:18 +00:00
|
|
|
$this->log_in_as_user();
|
2015-08-09 11:14:28 +00:00
|
|
|
$image_id_1 = $this->post_image("tests/pbx_screenshot.jpg", "test");
|
|
|
|
$image_id_2 = $this->post_image("tests/bedroom_workshop.jpg", "test2");
|
|
|
|
$image_id_3 = $this->post_image("tests/favicon.png", "test");
|
2010-03-08 18:25:23 +00:00
|
|
|
$idp1 = $image_id_3 + 1;
|
2008-10-11 07:09:42 +00:00
|
|
|
|
2012-03-09 22:08:55 +00:00
|
|
|
$this->get_page("post/view/$image_id_1");
|
|
|
|
$this->assert_title("Image $image_id_1: test");
|
2015-09-24 22:16:38 +00:00
|
|
|
}
|
|
|
|
|
2015-09-26 10:17:13 +00:00
|
|
|
public function testPrevNext() {
|
2015-09-24 22:16:38 +00:00
|
|
|
$this->markTestIncomplete();
|
|
|
|
|
|
|
|
$this->log_in_as_user();
|
|
|
|
$image_id_1 = $this->post_image("tests/pbx_screenshot.jpg", "test");
|
|
|
|
$image_id_2 = $this->post_image("tests/bedroom_workshop.jpg", "test2");
|
|
|
|
$image_id_3 = $this->post_image("tests/favicon.png", "test");
|
2009-09-19 19:19:09 +00:00
|
|
|
|
|
|
|
$this->click("Prev");
|
2012-03-09 22:08:55 +00:00
|
|
|
$this->assert_title("Image $image_id_2: test2");
|
2009-09-19 19:19:09 +00:00
|
|
|
|
|
|
|
$this->click("Next");
|
2012-03-09 22:08:55 +00:00
|
|
|
$this->assert_title("Image $image_id_1: test");
|
2009-09-19 19:19:09 +00:00
|
|
|
|
|
|
|
$this->click("Next");
|
2012-03-09 22:08:55 +00:00
|
|
|
$this->assert_title("Image not found");
|
2015-09-24 22:16:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public function testView404() {
|
|
|
|
$this->log_in_as_user();
|
|
|
|
$image_id_1 = $this->post_image("tests/pbx_screenshot.jpg", "test");
|
|
|
|
$image_id_2 = $this->post_image("tests/bedroom_workshop.jpg", "test2");
|
|
|
|
$image_id_3 = $this->post_image("tests/favicon.png", "test");
|
|
|
|
$idp1 = $image_id_3 + 1;
|
2009-07-15 01:42:18 +00:00
|
|
|
|
2012-03-09 22:08:55 +00:00
|
|
|
$this->get_page("post/view/$idp1");
|
|
|
|
$this->assert_title('Image not found');
|
2008-10-11 07:09:42 +00:00
|
|
|
|
2012-03-09 22:08:55 +00:00
|
|
|
$this->get_page('post/view/-1');
|
|
|
|
$this->assert_title('Image not found');
|
2015-09-24 22:16:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public function testNextSearchResult() {
|
|
|
|
$this->markTestIncomplete();
|
|
|
|
|
|
|
|
$this->log_in_as_user();
|
|
|
|
$image_id_1 = $this->post_image("tests/pbx_screenshot.jpg", "test");
|
|
|
|
$image_id_2 = $this->post_image("tests/bedroom_workshop.jpg", "test2");
|
|
|
|
$image_id_3 = $this->post_image("tests/favicon.png", "test");
|
2009-07-15 01:42:18 +00:00
|
|
|
|
2015-09-24 22:16:38 +00:00
|
|
|
// FIXME: this assumes Nice URLs.
|
2010-03-08 18:25:23 +00:00
|
|
|
# note: skips image #2
|
2012-03-09 18:56:06 +00:00
|
|
|
$this->get_page("post/view/$image_id_1?search=test"); // FIXME: assumes niceurls
|
2010-03-08 18:29:53 +00:00
|
|
|
$this->click("Prev");
|
2010-03-08 18:25:23 +00:00
|
|
|
$this->assert_title("Image $image_id_3: test");
|
2008-10-11 07:09:42 +00:00
|
|
|
}
|
|
|
|
}
|
2014-04-26 02:54:51 +00:00
|
|
|
|