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
class IcoHandlerTest { // extends ShimmiePHPUnitTestCase {
class IcoHandlerTest extends ShimmiePHPUnitTestCase {
function testIcoHander() {
$this->log_in_as_user();
$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("get_ico/$image_id"); // test for no crash
@ -12,3 +10,4 @@ class IcoHandlerTest { // extends ShimmiePHPUnitTestCase {
# FIXME: test that it gets displayed properly
}
}

View file

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

View file

@ -4,10 +4,10 @@ class RegenThumbTest {
$this->log_in_as_admin();
$image_id = $this->post_image("tests/pbx_screenshot.jpg", "pbx computer screenshot");
$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->delete_image($image_id);
$this->log_out();
# FIXME: test that the thumb's modified time has been updated
}

View file

@ -109,10 +109,10 @@ abstract class ShimmiePHPUnitTestCase extends PHPUnit_Framework_TestCase {
*/
protected function post_image($filename, $tags) {
$dae = new DataUploadEvent($filename, array(
"filename"=>$filename,
"extension"=>'jpg', // fixme
"tags"=>$tags,
"source"=>null,
"filename" => $filename,
"extension" => pathinfo($filename, PATHINFO_EXTENSION),
"tags" => $tags,
"source" => null,
));
send_event($dae);
$this->images[] = $dae->image_id;