This repository has been archived on 2024-09-05. You can view files and clone it, but cannot push or open issues or pull requests.
shimmie2/ext/upload/test.php

43 lines
1.4 KiB
PHP
Raw Normal View History

<?php
class UploadTest extends ShimmieWebTestCase {
function testUpload() {
$this->log_in_as_user();
2009-09-20 03:10:34 +00:00
$this->get_page("upload");
$this->assert_title("Upload");
$image_id_1 = $this->post_image("ext/simpletest/data/pbx_screenshot.jpg", "pbx computer screenshot");
2009-08-19 00:28:48 +00:00
$this->assert_response(302);
$image_id_2 = $this->post_image("ext/simpletest/data/pbx_screenshot.jpg", "pbx computer screenshot");
2009-08-19 00:28:48 +00:00
$this->assert_response(200);
$this->assert_title("Upload Status");
$this->assert_text("already has hash");
2009-07-16 19:20:53 +00:00
$image_id_3 = $this->post_image("index.php", "test");
2009-08-19 00:28:48 +00:00
$this->assert_response(200);
$this->assert_title("Upload Status");
$this->assert_text("File type not recognised");
2009-07-16 19:20:53 +00:00
/*
// FIXME: huge.dat is rejected for other reasons; manual testing shows that this works
file_put_contents("huge.dat", file_get_contents("ext/simpletest/data/pbx_screenshot.jpg") . str_repeat("U", 1024*1024*3));
$image_id_4 = $this->post_image("index.php", "test");
2009-08-19 00:28:48 +00:00
$this->assert_response(200);
$this->assert_title("Upload Status");
$this->assert_text("File too large");
2009-07-16 19:20:53 +00:00
unlink("huge.dat");
*/
$this->log_out();
$this->log_in_as_admin();
$this->delete_image($image_id_1);
$this->delete_image($image_id_2);
2009-07-16 19:20:53 +00:00
$this->delete_image($image_id_3); # if these were successfully rejected,
//$this->delete_image($image_id_4); # then delete_image is a no-op
$this->log_out();
}
}