more tests

This commit is contained in:
Shish 2015-09-20 21:20:28 +01:00
parent 2600ef042b
commit 13dfb8861f
4 changed files with 14 additions and 15 deletions

View File

@ -1,10 +1,8 @@
<?php <?php
class IcoHandlerTest { // extends ShimmiePHPUnitTestCase { class IcoHandlerTest extends ShimmiePHPUnitTestCase {
function testIcoHander() { function testIcoHander() {
$this->log_in_as_user(); $this->log_in_as_user();
$image_id = $this->post_image("lib/static/favicon.ico", "shimmie favicon"); $image_id = $this->post_image("lib/static/favicon.ico", "shimmie favicon");
$this->assert_response(302);
$this->get_page("post/view/$image_id"); // test for no crash $this->get_page("post/view/$image_id"); // test for no crash
$this->get_page("get_ico/$image_id"); // test for no crash $this->get_page("get_ico/$image_id"); // test for no crash
@ -12,3 +10,4 @@ class IcoHandlerTest { // extends ShimmiePHPUnitTestCase {
# FIXME: test that it gets displayed properly # FIXME: test that it gets displayed properly
} }
} }

View File

@ -1,14 +1,14 @@
<?php <?php
class SVGHandlerTest { // extends ShimmiePHPUnitTestCase { class SVGHandlerTest extends ShimmiePHPUnitTestCase {
function testSVGHander() { function testSVGHander() {
$this->log_in_as_user(); $this->log_in_as_user();
$image_id = $this->post_image("tests/test.svg", "something"); $image_id = $this->post_image("tests/test.svg", "something");
$this->assert_response(302); $this->get_page("post/view/$image_id"); // test for no crash
$this->get_page("get_svg/$image_id"); // test for no crash
$raw = $this->get_page("get_svg/$image_id"); $this->assert_content("www.w3.org");
$this->assertTrue(strpos($raw, "www.w3.org") > 0);
# FIXME: test that the thumb works # FIXME: test that the thumb works
# FIXME: test that it gets displayed properly # FIXME: test that it gets displayed properly
} }
} }

View File

@ -4,10 +4,10 @@ class RegenThumbTest {
$this->log_in_as_admin(); $this->log_in_as_admin();
$image_id = $this->post_image("tests/pbx_screenshot.jpg", "pbx computer screenshot"); $image_id = $this->post_image("tests/pbx_screenshot.jpg", "pbx computer screenshot");
$this->get_page("post/view/$image_id"); $this->get_page("post/view/$image_id");
$this->click("Regenerate");
$_POST['image_id'] = $image_id;
$this->get_page("regen_thumb");
$this->assert_title("Thumbnail Regenerated"); $this->assert_title("Thumbnail Regenerated");
$this->delete_image($image_id);
$this->log_out();
# FIXME: test that the thumb's modified time has been updated # FIXME: test that the thumb's modified time has been updated
} }

View File

@ -110,7 +110,7 @@ abstract class ShimmiePHPUnitTestCase extends PHPUnit_Framework_TestCase {
protected function post_image($filename, $tags) { protected function post_image($filename, $tags) {
$dae = new DataUploadEvent($filename, array( $dae = new DataUploadEvent($filename, array(
"filename" => $filename, "filename" => $filename,
"extension"=>'jpg', // fixme "extension" => pathinfo($filename, PATHINFO_EXTENSION),
"tags" => $tags, "tags" => $tags,
"source" => null, "source" => null,
)); ));