Merge branch 'master' of ssh://shish@marigold.shishnet.org/git/shimmie2
This commit is contained in:
commit
08cf14c479
17 changed files with 101 additions and 20 deletions
|
@ -21,7 +21,7 @@ class BanWordsTest extends ShimmieWebTestCase {
|
|||
$this->assert_title("Comment Blocked");
|
||||
|
||||
$this->get_page("post/view/$image_id");
|
||||
$this->set_field('comment', "kittens and viagra!");
|
||||
$this->set_field('comment', "kittens\n\n\n\nand viagra!");
|
||||
$this->click("Post Comment");
|
||||
$this->assert_title("Comment Blocked");
|
||||
|
||||
|
|
|
@ -3,6 +3,12 @@ class BulkAddTest extends ShimmieWebTestCase {
|
|||
function testBulkAdd() {
|
||||
$this->log_in_as_admin();
|
||||
|
||||
$this->get_page('admin');
|
||||
$this->assert_title("Admin Tools");
|
||||
$this->set_field('dir', "asdf");
|
||||
$this->click("Add");
|
||||
$this->assert_text("is not a directory");
|
||||
|
||||
$this->get_page('admin');
|
||||
$this->assert_title("Admin Tools");
|
||||
$this->set_field('dir', "contrib/simpletest");
|
||||
|
|
|
@ -9,6 +9,7 @@ class DowntimeTest extends SCoreWebTestCase {
|
|||
$this->assert_text("DOWNTIME MODE IS ON!");
|
||||
$this->log_out();
|
||||
|
||||
$this->get_page("post/list");
|
||||
$this->assert_text("brb, unit testing");
|
||||
|
||||
$this->log_in_as_admin();
|
||||
|
|
|
@ -10,6 +10,9 @@ class EmoticonTest extends ShimmieWebTestCase {
|
|||
$this->assert_no_text(":cool:"); # FIXME: test for working image link
|
||||
#$this->assert_text(":beans:"); # FIXME: this should be left as-is
|
||||
|
||||
$this->get_page("emote/list");
|
||||
$this->assert_text(":arrow:");
|
||||
|
||||
$this->log_out();
|
||||
$this->log_in_as_admin();
|
||||
$this->delete_image($image_id);
|
||||
|
|
|
@ -1,11 +1,22 @@
|
|||
<?php
|
||||
class RSSCommentsTest extends ShimmieWebTestCase {
|
||||
function testImageFeed() {
|
||||
$this->log_in_as_user();
|
||||
$image_id = $this->post_image("ext/simpletest/data/pbx_screenshot.jpg", "pbx");
|
||||
$this->get_page("post/view/$image_id");
|
||||
$this->set_field('comment', "Test Comment ASDFASDF");
|
||||
$this->click("Post Comment");
|
||||
$this->assert_text("ASDFASDF");
|
||||
$this->log_out();
|
||||
|
||||
$this->get_page('rss/comments');
|
||||
$this->assert_mime("application/rss+xml");
|
||||
$this->assert_no_text("Exception");
|
||||
$this->assert_text("ASDFASDF");
|
||||
|
||||
# FIXME: test that there are some comments here
|
||||
$this->log_in_as_admin();
|
||||
$this->delete_image($image_id);
|
||||
$this->log_out();
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -29,11 +29,6 @@ class RSS_Images extends SimpleExtension {
|
|||
|
||||
if($event->count_args() == 1) {
|
||||
$page_number = int_escape($event->get_arg(0));
|
||||
// compat hack, deprecate this later
|
||||
if($page_number == 0) {
|
||||
$search_terms = explode(' ', $event->get_arg(0));
|
||||
$page_number = 1;
|
||||
}
|
||||
}
|
||||
else if($event->count_args() == 2) {
|
||||
$search_terms = explode(' ', $event->get_arg(0));
|
||||
|
|
|
@ -5,10 +5,12 @@ class SiteDescriptionTest extends SCoreWebTestCase {
|
|||
$this->get_page('setup');
|
||||
$this->assert_title("Shimmie Setup");
|
||||
$this->set_field("_config_site_description", "A Shimmie testbed");
|
||||
$this->set_field("_config_site_keywords", "foo,bar,baz");
|
||||
$raw = $this->click("Save Settings");
|
||||
|
||||
$header = '<meta name="description" content="A Shimmie testbed">';
|
||||
$this->assertTrue(strpos($raw, $header) > 0);
|
||||
$this->assertTrue(strpos($raw, "foo") > 0);
|
||||
|
||||
$this->log_out();
|
||||
}
|
||||
|
|
|
@ -12,6 +12,10 @@ class TagHistoryTest extends ShimmieWebTestCase {
|
|||
$this->assert_text("new (Set by demo");
|
||||
$this->click("Revert");
|
||||
$this->assert_title("Image $image_id: pbx");
|
||||
|
||||
$this->get_page("tag_history");
|
||||
$this->click("Global Tag History");
|
||||
|
||||
$this->delete_image($image_id);
|
||||
$this->log_out();
|
||||
}
|
||||
|
|
|
@ -803,4 +803,25 @@ function _end_cache() {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\
|
||||
* Code coverage *
|
||||
\* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
function _start_debug() {
|
||||
if(function_exists("xdebug_start_code_coverage")) {
|
||||
#xdebug_start_code_coverage(XDEBUG_CC_UNUSED|XDEBUG_CC_DEAD_CODE);
|
||||
xdebug_start_code_coverage(XDEBUG_CC_UNUSED);
|
||||
}
|
||||
}
|
||||
|
||||
function _end_debug() {
|
||||
if(function_exists("xdebug_get_code_coverage")) {
|
||||
if(!file_exists("data/coverage")) mkdir("data/coverage");
|
||||
$n = 0;
|
||||
$t = time();
|
||||
while(file_exists("data/coverage/$t.$n.log")) $n++;
|
||||
file_put_contents("data/coverage/$t.$n.log", serialize(xdebug_get_code_coverage()));
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -64,6 +64,11 @@ class AliasEditorTest extends ShimmieWebTestCase {
|
|||
$this->assert_no_text("test1");
|
||||
|
||||
$this->log_out();
|
||||
|
||||
|
||||
$this->get_page('alias/list');
|
||||
$this->assert_title("Alias List");
|
||||
$this->assert_no_text("Add");
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -38,6 +38,18 @@ class BBCodeUnitTest extends UnitTestCase {
|
|||
"<ul><li>a<ul><li>a<li>b</ul><li>b</ul>");
|
||||
}
|
||||
|
||||
public function testSpoiler() {
|
||||
$this->assertEqual(
|
||||
$this->filter("[spoiler]ShishNet[/spoiler]"),
|
||||
"<span style=\"background-color:#000; color:#000;\">ShishNet</span>");
|
||||
$this->assertEqual(
|
||||
$this->strip("[spoiler]ShishNet[/spoiler]"),
|
||||
"FuvfuArg");
|
||||
#$this->assertEqual(
|
||||
# $this->filter("[spoiler]ShishNet"),
|
||||
# "[spoiler]ShishNet");
|
||||
}
|
||||
|
||||
public function testURL() {
|
||||
$this->assertEqual(
|
||||
$this->filter("[url]http://shishnet.org[/url]"),
|
||||
|
@ -56,5 +68,12 @@ class BBCodeUnitTest extends UnitTestCase {
|
|||
$bb->receive_event($tfe);
|
||||
return $tfe->formatted;
|
||||
}
|
||||
|
||||
private function strip($in) {
|
||||
$bb = new BBCode();
|
||||
$tfe = new TextFormattingEvent($in);
|
||||
$bb->receive_event($tfe);
|
||||
return $tfe->stripped;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -14,6 +14,8 @@ class TagEditTest extends ShimmieWebTestCase {
|
|||
$this->log_out();
|
||||
|
||||
$this->log_in_as_admin();
|
||||
$this->get_page("admin");
|
||||
$this->assert_text("Mass Tag Edit"); // just test it exists
|
||||
$this->delete_image($image_id);
|
||||
$this->log_out();
|
||||
|
||||
|
|
|
@ -3,6 +3,9 @@ class UploadTest extends ShimmieWebTestCase {
|
|||
function testUpload() {
|
||||
$this->log_in_as_user();
|
||||
|
||||
$this->get_page("upload");
|
||||
$this->assert_title("Upload");
|
||||
|
||||
$image_id_1 = $this->post_image("ext/simpletest/data/pbx_screenshot.jpg", "pbx computer screenshot");
|
||||
$this->assert_response(302);
|
||||
|
||||
|
|
|
@ -30,6 +30,9 @@ class UserPageTest extends SCoreWebTestCase {
|
|||
# FIXME: test user creation
|
||||
# FIXME: test adminifying
|
||||
# FIXME: test password reset
|
||||
|
||||
$this->get_page('user/list');
|
||||
$this->assert_text("demo");
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -2,12 +2,22 @@
|
|||
class ViewTest extends ShimmieWebTestCase {
|
||||
function testViewPage() {
|
||||
$this->log_in_as_user();
|
||||
$image_id = $this->post_image("ext/simpletest/data/pbx_screenshot.jpg", "test");
|
||||
$idp1 = $image_id + 1;
|
||||
$image_id_1 = $this->post_image("ext/simpletest/data/pbx_screenshot.jpg", "test");
|
||||
$image_id_2 = $this->post_image("ext/simpletest/data/bedroom_workshop.jpg", "test2");
|
||||
$idp1 = $image_id_2 + 1;
|
||||
$this->log_out();
|
||||
|
||||
$this->get_page("post/view/$image_id");
|
||||
$this->assert_title("Image $image_id: test");
|
||||
$this->get_page("post/view/$image_id_1");
|
||||
$this->assert_title("Image $image_id_1: test");
|
||||
|
||||
$this->click("Prev");
|
||||
$this->assert_title("Image $image_id_2: test2");
|
||||
|
||||
$this->click("Next");
|
||||
$this->assert_title("Image $image_id_1: test");
|
||||
|
||||
$this->click("Next");
|
||||
$this->assert_title("Image not found");
|
||||
|
||||
$this->get_page("post/view/$idp1");
|
||||
$this->assert_title('Image not found');
|
||||
|
@ -16,7 +26,8 @@ class ViewTest extends ShimmieWebTestCase {
|
|||
$this->assert_title('Image not found');
|
||||
|
||||
$this->log_in_as_admin();
|
||||
$this->delete_image($image_id);
|
||||
$this->delete_image($image_id_1);
|
||||
$this->delete_image($image_id_2);
|
||||
$this->log_out();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,13 +22,7 @@ class ViewImageTheme extends Themelet {
|
|||
}
|
||||
|
||||
|
||||
var $pin = null;
|
||||
|
||||
protected function build_pin(Image $image) {
|
||||
if(!is_null($this->pin)) {
|
||||
return $this->pin;
|
||||
}
|
||||
|
||||
global $database;
|
||||
|
||||
if(isset($_GET['search'])) {
|
||||
|
@ -44,8 +38,7 @@ class ViewImageTheme extends Themelet {
|
|||
$h_index = "<a href='".make_link()."'>Index</a>";
|
||||
$h_next = "<a href='".make_link("post/next/{$image->id}", $query)."'>Next</a>";
|
||||
|
||||
$this->pin = "$h_prev | $h_index | $h_next";
|
||||
return $this->pin;
|
||||
return "$h_prev | $h_index | $h_next";
|
||||
}
|
||||
|
||||
protected function build_navigation(Image $image) {
|
||||
|
|
|
@ -64,6 +64,7 @@ if(!file_exists("config.php")) {
|
|||
|
||||
require_once "config.php";
|
||||
require_once "core/util.inc.php";
|
||||
if(DEBUG) {_start_debug();}
|
||||
_version_check();
|
||||
_sanitise_environment();
|
||||
_start_cache();
|
||||
|
@ -147,4 +148,5 @@ catch(Exception $e) {
|
|||
</html>
|
||||
EOD;
|
||||
}
|
||||
if(DEBUG) {_end_debug();}
|
||||
?>
|
||||
|
|
Reference in a new issue