diff --git a/contrib/ban_words/test.php b/contrib/ban_words/test.php index d0052f3d..04a1cd32 100644 --- a/contrib/ban_words/test.php +++ b/contrib/ban_words/test.php @@ -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"); diff --git a/contrib/bulk_add/test.php b/contrib/bulk_add/test.php index 1eb6c744..8c1a5dcb 100644 --- a/contrib/bulk_add/test.php +++ b/contrib/bulk_add/test.php @@ -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"); diff --git a/contrib/downtime/test.php b/contrib/downtime/test.php index 7d8d8b5d..868eeef6 100644 --- a/contrib/downtime/test.php +++ b/contrib/downtime/test.php @@ -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(); diff --git a/contrib/emoticons/test.php b/contrib/emoticons/test.php index 6e6bc236..3758ce3b 100644 --- a/contrib/emoticons/test.php +++ b/contrib/emoticons/test.php @@ -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); diff --git a/contrib/rss_comments/test.php b/contrib/rss_comments/test.php index e55cf7be..554f9d09 100644 --- a/contrib/rss_comments/test.php +++ b/contrib/rss_comments/test.php @@ -1,11 +1,22 @@ 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(); } } ?> diff --git a/contrib/rss_images/main.php b/contrib/rss_images/main.php index 76527e7d..e73ba947 100644 --- a/contrib/rss_images/main.php +++ b/contrib/rss_images/main.php @@ -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)); diff --git a/contrib/site_description/test.php b/contrib/site_description/test.php index 7ca0eb42..ee27e2fc 100644 --- a/contrib/site_description/test.php +++ b/contrib/site_description/test.php @@ -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 = ''; $this->assertTrue(strpos($raw, $header) > 0); + $this->assertTrue(strpos($raw, "foo") > 0); $this->log_out(); } diff --git a/contrib/tag_history/test.php b/contrib/tag_history/test.php index c3cc4788..2c45d6e2 100644 --- a/contrib/tag_history/test.php +++ b/contrib/tag_history/test.php @@ -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(); } diff --git a/core/util.inc.php b/core/util.inc.php index 9005f71c..c74231f5 100644 --- a/core/util.inc.php +++ b/core/util.inc.php @@ -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())); + } +} ?> diff --git a/ext/alias_editor/test.php b/ext/alias_editor/test.php index 68b30450..5c36dad7 100644 --- a/ext/alias_editor/test.php +++ b/ext/alias_editor/test.php @@ -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"); } } ?> diff --git a/ext/bbcode/test.php b/ext/bbcode/test.php index 99e1b40f..6951c5b6 100644 --- a/ext/bbcode/test.php +++ b/ext/bbcode/test.php @@ -38,6 +38,18 @@ class BBCodeUnitTest extends UnitTestCase { "