consistent naming for test functions

This commit is contained in:
Shish 2009-08-19 01:28:48 +01:00
parent 62afcfe38c
commit 1946e3c943
40 changed files with 325 additions and 325 deletions

View file

@ -3,7 +3,7 @@ class BanWordsTest extends ShimmieWebTestCase {
function testWordBan() { function testWordBan() {
$this->log_in_as_admin(); $this->log_in_as_admin();
$this->get_page("setup"); $this->get_page("setup");
$this->setField("_config_banned_words", "viagra\nporn\n/http:.*\.cn\//"); $this->set_field("_config_banned_words", "viagra\nporn\n/http:.*\.cn\//");
$this->click("Save Settings"); $this->click("Save Settings");
$this->log_out(); $this->log_out();
@ -11,30 +11,30 @@ class BanWordsTest extends ShimmieWebTestCase {
$image_id = $this->post_image("ext/simpletest/data/pbx_screenshot.jpg", "pbx computer screenshot"); $image_id = $this->post_image("ext/simpletest/data/pbx_screenshot.jpg", "pbx computer screenshot");
$this->get_page("post/view/$image_id"); $this->get_page("post/view/$image_id");
$this->setField('comment', "kittens and viagra"); $this->set_field('comment', "kittens and viagra");
$this->click("Post Comment"); $this->click("Post Comment");
$this->assertTitle("Comment Blocked"); $this->assert_title("Comment Blocked");
$this->get_page("post/view/$image_id"); $this->get_page("post/view/$image_id");
$this->setField('comment', "kittens and ViagrA"); $this->set_field('comment', "kittens and ViagrA");
$this->click("Post Comment"); $this->click("Post Comment");
$this->assertTitle("Comment Blocked"); $this->assert_title("Comment Blocked");
$this->get_page("post/view/$image_id"); $this->get_page("post/view/$image_id");
$this->setField('comment', "kittens and viagra!"); $this->set_field('comment', "kittens and viagra!");
$this->click("Post Comment"); $this->click("Post Comment");
$this->assertTitle("Comment Blocked"); $this->assert_title("Comment Blocked");
$this->get_page("post/view/$image_id"); $this->get_page("post/view/$image_id");
$this->setField('comment', "some link to http://something.cn/"); $this->set_field('comment', "some link to http://something.cn/");
$this->click("Post Comment"); $this->click("Post Comment");
$this->assertTitle("Comment Blocked"); $this->assert_title("Comment Blocked");
$this->get_page('comment/list'); $this->get_page('comment/list');
$this->assertTitle('Comments'); $this->assert_title('Comments');
$this->assertNoText('viagra'); $this->assert_no_text('viagra');
$this->assertNoText('ViagrA'); $this->assert_no_text('ViagrA');
$this->assertNoText('http://something.cn/'); $this->assert_no_text('http://something.cn/');
$this->log_out(); $this->log_out();
$this->log_in_as_admin(); $this->log_in_as_admin();

View file

@ -4,18 +4,18 @@ class BulkAddTest extends ShimmieWebTestCase {
$this->log_in_as_admin(); $this->log_in_as_admin();
$this->get_page('admin'); $this->get_page('admin');
$this->assertTitle("Admin Tools"); $this->assert_title("Admin Tools");
$this->setField('dir', "contrib/simpletest"); $this->set_field('dir', "contrib/simpletest");
$this->click("Add"); $this->click("Add");
# FIXME: test that the output here makes sense, no "adding foo.php ... ok" # FIXME: test that the output here makes sense, no "adding foo.php ... ok"
$this->get_page("post/list/hash=17fc89f372ed3636e28bd25cc7f3bac1/1"); $this->get_page("post/list/hash=17fc89f372ed3636e28bd25cc7f3bac1/1");
$this->assertTitle(new PatternExpectation("/^Image \d+: data/")); $this->assert_title(new PatternExpectation("/^Image \d+: data/"));
$this->click("Delete"); $this->click("Delete");
$this->get_page("post/list/hash=feb01bab5698a11dd87416724c7a89e3/1"); $this->get_page("post/list/hash=feb01bab5698a11dd87416724c7a89e3/1");
$this->assertTitle(new PatternExpectation("/^Image \d+: data/")); $this->assert_title(new PatternExpectation("/^Image \d+: data/"));
$this->click("Delete"); $this->click("Delete");
$this->log_out(); $this->log_out();

View file

@ -3,19 +3,19 @@ class DowntimeTest extends SCoreWebTestCase {
function testDowntime() { function testDowntime() {
$this->log_in_as_admin(); $this->log_in_as_admin();
$this->get_page("setup"); $this->get_page("setup");
$this->setField("_config_downtime", true); $this->set_field("_config_downtime", true);
$this->setField("_config_downtime_message", "brb, unit testing"); $this->set_field("_config_downtime_message", "brb, unit testing");
$this->click("Save Settings"); $this->click("Save Settings");
$this->assertText("DOWNTIME MODE IS ON!"); $this->assert_text("DOWNTIME MODE IS ON!");
$this->log_out(); $this->log_out();
$this->assertText("brb, unit testing"); $this->assert_text("brb, unit testing");
$this->log_in_as_admin(); $this->log_in_as_admin();
$this->get_page("setup"); $this->get_page("setup");
$this->setField("_config_downtime", false); $this->set_field("_config_downtime", false);
$this->click("Save Settings"); $this->click("Save Settings");
$this->assertNoText("DOWNTIME MODE IS ON!"); $this->assert_no_text("DOWNTIME MODE IS ON!");
$this->log_out(); $this->log_out();
} }
} }

View file

@ -5,10 +5,10 @@ class EmoticonTest extends ShimmieWebTestCase {
$image_id = $this->post_image("ext/simpletest/data/pbx_screenshot.jpg", "pbx computer screenshot"); $image_id = $this->post_image("ext/simpletest/data/pbx_screenshot.jpg", "pbx computer screenshot");
$this->get_page("post/view/$image_id"); $this->get_page("post/view/$image_id");
$this->setField('comment', ":cool: :beans:"); $this->set_field('comment', ":cool: :beans:");
$this->click("Post Comment"); $this->click("Post Comment");
$this->assertNoText(":cool:"); # FIXME: test for working image link $this->assert_no_text(":cool:"); # FIXME: test for working image link
#$this->assertText(":beans:"); # FIXME: this should be left as-is #$this->assert_text(":beans:"); # FIXME: this should be left as-is
$this->log_out(); $this->log_out();
$this->log_in_as_admin(); $this->log_in_as_admin();

View file

@ -3,7 +3,7 @@ class ETTest extends ShimmieWebTestCase {
function testET() { function testET() {
$this->log_in_as_admin(); $this->log_in_as_admin();
$this->get_page("system_info"); $this->get_page("system_info");
$this->assertTitle("System Info"); $this->assert_title("System Info");
$this->log_out(); $this->log_out();
} }
} }

View file

@ -5,23 +5,23 @@ class FavoritesTest extends ShimmieWebTestCase {
$image_id = $this->post_image("ext/simpletest/data/pbx_screenshot.jpg", "test"); $image_id = $this->post_image("ext/simpletest/data/pbx_screenshot.jpg", "test");
$this->get_page("post/view/$image_id"); $this->get_page("post/view/$image_id");
$this->assertTitle("Image $image_id: test"); $this->assert_title("Image $image_id: test");
$this->assertNoText("Favorited By"); $this->assert_no_text("Favorited By");
$this->click("Favorite"); $this->click("Favorite");
$this->assertText("Favorited By"); $this->assert_text("Favorited By");
$this->get_page("post/list/favorited_by=test/1"); $this->get_page("post/list/favorited_by=test/1");
$this->assertTitle("Image $image_id: test"); $this->assert_title("Image $image_id: test");
$this->assertText("Favorited By"); $this->assert_text("Favorited By");
$this->get_page("user/test"); $this->get_page("user/test");
$this->assertText("Images favorited: 1"); $this->assert_text("Images favorited: 1");
$this->click("Images favorited"); $this->click("Images favorited");
$this->assertTitle("Image $image_id: test"); $this->assert_title("Image $image_id: test");
$this->click("Un-Favorite"); $this->click("Un-Favorite");
$this->assertNoText("Favorited By"); $this->assert_no_text("Favorited By");
$this->log_out(); $this->log_out();

View file

@ -9,16 +9,16 @@ class FeaturedTest extends ShimmieWebTestCase {
$this->log_in_as_admin(); $this->log_in_as_admin();
$this->get_page("post/view/$image_id"); $this->get_page("post/view/$image_id");
$this->assertTitle("Image $image_id: pbx"); $this->assert_title("Image $image_id: pbx");
$this->click("Feature This"); $this->click("Feature This");
$this->get_page("post/list"); $this->get_page("post/list");
$this->assertText("Featured Image"); $this->assert_text("Featured Image");
$this->delete_image($image_id); $this->delete_image($image_id);
$this->log_out(); $this->log_out();
# after deletion, there should be no feature # after deletion, there should be no feature
$this->get_page("post/list"); $this->get_page("post/list");
$this->assertNoText("Featured Image"); $this->assert_no_text("Featured Image");
# FIXME: test changing from one feature to another # FIXME: test changing from one feature to another
} }

View file

@ -3,7 +3,7 @@ class IcoHandlerTest extends ShimmieWebTestCase {
function testPixelHander() { function testPixelHander() {
$this->log_in_as_user(); $this->log_in_as_user();
$image_id = $this->post_image("favicon.ico", "shimmie favicon"); $image_id = $this->post_image("favicon.ico", "shimmie favicon");
$this->assertResponse(302); $this->assert_response(302);
$this->log_out(); $this->log_out();
$this->log_in_as_admin(); $this->log_in_as_admin();

View file

@ -18,7 +18,7 @@ class SVGHandlerTest extends ShimmieWebTestCase {
$this->log_in_as_user(); $this->log_in_as_user();
$image_id = $this->post_image("favicon.ico", "shimmie favicon"); $image_id = $this->post_image("favicon.ico", "shimmie favicon");
$this->assertResponse(302); $this->assert_response(302);
$this->log_out(); $this->log_out();
$this->log_in_as_admin(); $this->log_in_as_admin();

View file

@ -2,8 +2,8 @@
class HomeTest extends ShimmieWebTestCase { class HomeTest extends ShimmieWebTestCase {
function testHomePage() { function testHomePage() {
$this->get_page('home'); $this->get_page('home');
$this->assertTitle('Shimmie'); $this->assert_title('Shimmie');
$this->assertText('Shimmie'); $this->assert_text('Shimmie');
# FIXME: test search box # FIXME: test search box
} }

View file

@ -2,21 +2,21 @@
class IPBanTest extends SCoreWebTestCase { class IPBanTest extends SCoreWebTestCase {
function testIPBan() { function testIPBan() {
$this->get_page('ip_ban/list'); $this->get_page('ip_ban/list');
$this->assertResponse(403); $this->assert_response(403);
$this->assertTitle("Permission Denied"); $this->assert_title("Permission Denied");
$this->log_in_as_admin(); $this->log_in_as_admin();
$this->get_page('ip_ban/list'); $this->get_page('ip_ban/list');
$this->assertNoText("42.42.42.42"); $this->assert_no_text("42.42.42.42");
$this->setField('ip', '42.42.42.42'); $this->set_field('ip', '42.42.42.42');
$this->setField('reason', 'unit testing'); $this->set_field('reason', 'unit testing');
$this->setField('end', '1 week'); $this->set_field('end', '1 week');
$this->click("Ban"); $this->click("Ban");
$this->assertText("42.42.42.42"); $this->assert_text("42.42.42.42");
$this->click("Remove"); // FIXME: remove which ban? :S $this->click("Remove"); // FIXME: remove which ban? :S
$this->assertNoText("42.42.42.42"); $this->assert_no_text("42.42.42.42");
$this->log_out(); $this->log_out();

View file

@ -11,7 +11,7 @@ class LinkImageTest extends ShimmieWebTestCase {
preg_match("#value='(http://.*(/|%2F)post(/|%2F)view(/|%2F)[0-9]+)'#", $raw, $matches); preg_match("#value='(http://.*(/|%2F)post(/|%2F)view(/|%2F)[0-9]+)'#", $raw, $matches);
$this->assertTrue(count($matches) > 0); $this->assertTrue(count($matches) > 0);
$this->get($matches[1]); $this->get($matches[1]);
$this->assertTitle("Image $image_id: pie"); $this->assert_title("Image $image_id: pie");
$this->log_out(); $this->log_out();

View file

@ -4,20 +4,20 @@ class NewsTest extends SCoreWebTestCase {
$this->log_in_as_admin(); $this->log_in_as_admin();
$this->get_page("setup"); $this->get_page("setup");
$this->setField("_config_news_text", "kittens"); $this->set_field("_config_news_text", "kittens");
$this->click("Save Settings"); $this->click("Save Settings");
$this->get_page("post/list"); $this->get_page("post/list");
$this->assertText("Note"); $this->assert_text("Note");
$this->assertText("kittens"); $this->assert_text("kittens");
$this->get_page("setup"); $this->get_page("setup");
$this->setField("_config_news_text", ""); $this->set_field("_config_news_text", "");
$this->click("Save Settings"); $this->click("Save Settings");
$this->get_page("post/list"); $this->get_page("post/list");
$this->assertNoText("Note"); $this->assert_no_text("Note");
$this->assertNoText("kittens"); $this->assert_no_text("kittens");
$this->log_out(); $this->log_out();
} }

View file

@ -4,26 +4,26 @@ class NumericScoreTest extends ShimmieWebTestCase {
$this->log_in_as_user(); $this->log_in_as_user();
$image_id = $this->post_image("ext/simpletest/data/pbx_screenshot.jpg", "pbx"); $image_id = $this->post_image("ext/simpletest/data/pbx_screenshot.jpg", "pbx");
$this->get_page("post/view/$image_id"); $this->get_page("post/view/$image_id");
$this->assertText("Current Score: 0"); $this->assert_text("Current Score: 0");
$this->click("Vote Down"); $this->click("Vote Down");
$this->assertText("Current Score: -1"); $this->assert_text("Current Score: -1");
$this->click("Vote Up"); $this->click("Vote Up");
$this->assertText("Current Score: 1"); $this->assert_text("Current Score: 1");
# FIXME: "remove vote" button? # FIXME: "remove vote" button?
# FIXME: test that up and down are hidden if already voted up or down # FIXME: test that up and down are hidden if already voted up or down
# test search by score # test search by score
$this->get_page("post/list/score=1/1"); $this->get_page("post/list/score=1/1");
$this->assertTitle("Image $image_id: pbx"); $this->assert_title("Image $image_id: pbx");
# test search by vote # test search by vote
$this->get_page("post/list/upvoted_by=test/1"); $this->get_page("post/list/upvoted_by=test/1");
$this->assertTitle("Image $image_id: pbx"); $this->assert_title("Image $image_id: pbx");
$this->assertNoText("No Images Found"); $this->assert_no_text("No Images Found");
# and downvote # and downvote
$this->get_page("post/list/downvoted_by=test/1"); $this->get_page("post/list/downvoted_by=test/1");
$this->assertText("No Images Found"); $this->assert_text("No Images Found");
$this->log_out(); $this->log_out();
$this->log_in_as_admin(); $this->log_in_as_admin();

View file

@ -3,41 +3,41 @@ class PMTest extends SCoreWebTestCase {
function testPM() { function testPM() {
$this->log_in_as_admin(); $this->log_in_as_admin();
$this->get_page("user/test"); $this->get_page("user/test");
$this->setField('subject', "message demo to test"); $this->set_field('subject', "message demo to test");
$this->setField('message', "message contents"); $this->set_field('message', "message contents");
$this->click("Send"); $this->click("Send");
$this->log_out(); $this->log_out();
$this->log_in_as_user(); $this->log_in_as_user();
$this->get_page("user"); $this->get_page("user");
$this->assertText("message demo to test"); $this->assert_text("message demo to test");
$this->click("message demo to test"); $this->click("message demo to test");
$this->assertText("message contents"); $this->assert_text("message contents");
$this->back(); $this->back();
$this->click("Delete"); $this->click("Delete");
$this->assertNoText("message demo to test"); $this->assert_no_text("message demo to test");
$this->log_out(); $this->log_out();
} }
function testAdminAccess() { function testAdminAccess() {
$this->log_in_as_admin(); $this->log_in_as_admin();
$this->get_page("user/test"); $this->get_page("user/test");
$this->setField('subject', "message demo to test"); $this->set_field('subject', "message demo to test");
$this->setField('message', "message contents"); $this->set_field('message', "message contents");
$this->click("Send"); $this->click("Send");
$this->get_page("user/test"); $this->get_page("user/test");
$this->assertText("message demo to test"); $this->assert_text("message demo to test");
$this->click("message demo to test"); $this->click("message demo to test");
$this->assertText("message contents"); $this->assert_text("message contents");
$this->back(); $this->back();
$this->click("Delete"); $this->click("Delete");
# simpletest bug? - redirect(referrer) works in opera, not in # simpletest bug? - redirect(referrer) works in opera, not in
# webtestcase, so we end up at the wrong page... # webtestcase, so we end up at the wrong page...
$this->get_page("user/test"); $this->get_page("user/test");
$this->assertTitle("test's Page"); $this->assert_title("test's Page");
$this->assertNoText("message demo to test"); $this->assert_no_text("message demo to test");
$this->log_out(); $this->log_out();
} }
} }

View file

@ -6,7 +6,7 @@ class RandomTest extends ShimmieWebTestCase {
$this->log_out(); $this->log_out();
$this->get_page("random_image/view"); $this->get_page("random_image/view");
$this->assertTitle("Image $image_id: test"); $this->assert_title("Image $image_id: test");
$this->log_in_as_admin(); $this->log_in_as_admin();
$this->delete_image($image_id); $this->delete_image($image_id);

View file

@ -7,45 +7,45 @@ class RatingTest extends ShimmieWebTestCase {
# test for bug #735: user forced to set rating, can't # test for bug #735: user forced to set rating, can't
# set tags and leave unrated # set tags and leave unrated
$this->get_page("post/view/$image_id"); $this->get_page("post/view/$image_id");
$this->assertTitle("Image $image_id: pbx"); $this->assert_title("Image $image_id: pbx");
$this->setField("tag_edit__tags", "new"); $this->set_field("tag_edit__tags", "new");
$this->click("Set"); $this->click("Set");
$this->assertTitle("Image $image_id: new"); $this->assert_title("Image $image_id: new");
# set safe # set safe
$this->setField("rating", "s"); $this->set_field("rating", "s");
$this->click("Set"); $this->click("Set");
$this->assertTitle("Image $image_id: new"); $this->assert_title("Image $image_id: new");
# search for it in various ways # search for it in various ways
$this->get_page("post/list/rating=Safe/1"); $this->get_page("post/list/rating=Safe/1");
$this->assertTitle("Image $image_id: new"); $this->assert_title("Image $image_id: new");
$this->get_page("post/list/rating=s/1"); $this->get_page("post/list/rating=s/1");
$this->assertTitle("Image $image_id: new"); $this->assert_title("Image $image_id: new");
$this->get_page("post/list/rating=sqe/1"); $this->get_page("post/list/rating=sqe/1");
$this->assertTitle("Image $image_id: new"); $this->assert_title("Image $image_id: new");
# test that search by tag still works # test that search by tag still works
$this->get_page("post/list/new/1"); $this->get_page("post/list/new/1");
$this->assertTitle("Image $image_id: new"); $this->assert_title("Image $image_id: new");
# searching for a different rating should return nothing # searching for a different rating should return nothing
$this->get_page("post/list/rating=q/1"); $this->get_page("post/list/rating=q/1");
$this->assertText("No Images Found"); $this->assert_text("No Images Found");
# now set explicit, for the next test # now set explicit, for the next test
$this->get_page("post/view/$image_id"); $this->get_page("post/view/$image_id");
$this->setField("rating", "e"); $this->set_field("rating", "e");
$this->click("Set"); $this->click("Set");
$this->assertTitle("Image $image_id: new"); $this->assert_title("Image $image_id: new");
$this->log_out(); $this->log_out();
# the explicit image shouldn't show up in anon's searches # the explicit image shouldn't show up in anon's searches
$this->get_page("post/list/new/1"); $this->get_page("post/list/new/1");
$this->assertText("No Images Found"); $this->assert_text("No Images Found");
$this->log_in_as_admin(); $this->log_in_as_admin();
$this->delete_image($image_id); $this->delete_image($image_id);

View file

@ -5,7 +5,7 @@ class RegenThumbTest extends ShimmieWebTestCase {
$image_id = $this->post_image("ext/simpletest/data/pbx_screenshot.jpg", "pbx computer screenshot"); $image_id = $this->post_image("ext/simpletest/data/pbx_screenshot.jpg", "pbx computer screenshot");
$this->get_page("post/view/$image_id"); $this->get_page("post/view/$image_id");
$this->click("Regenerate"); $this->click("Regenerate");
$this->assertTitle("Thumbnail Regenerated"); $this->assert_title("Thumbnail Regenerated");
$this->delete_image($image_id); $this->delete_image($image_id);
$this->log_out(); $this->log_out();

View file

@ -4,17 +4,17 @@ class ReportImageTest extends ShimmieWebTestCase {
$this->log_in_as_user(); $this->log_in_as_user();
$image_id = $this->post_image("ext/simpletest/data/pbx_screenshot.jpg", "pbx computer screenshot"); $image_id = $this->post_image("ext/simpletest/data/pbx_screenshot.jpg", "pbx computer screenshot");
$this->get_page("post/view/$image_id"); $this->get_page("post/view/$image_id");
$this->setField('reason', "report details"); $this->set_field('reason', "report details");
$this->click("Report"); $this->click("Report");
$this->log_out(); $this->log_out();
$this->log_in_as_admin(); $this->log_in_as_admin();
$this->get_page("image_report/list"); $this->get_page("image_report/list");
$this->assertTitle("Reported Images"); $this->assert_title("Reported Images");
$this->assertText("report details"); $this->assert_text("report details");
$this->click("Remove Report"); $this->click("Remove Report");
$this->assertTitle("Reported Images"); $this->assert_title("Reported Images");
$this->assertNoText("report details"); $this->assert_no_text("report details");
$this->delete_image($image_id); $this->delete_image($image_id);
$this->log_out(); $this->log_out();

View file

@ -3,20 +3,20 @@ class ResLimitTest extends ShimmieWebTestCase {
function testResLimitOK() { function testResLimitOK() {
$this->log_in_as_admin(); $this->log_in_as_admin();
$this->get_page("setup"); $this->get_page("setup");
$this->setField("_config_upload_min_height", "0"); $this->set_field("_config_upload_min_height", "0");
$this->setField("_config_upload_min_width", "0"); $this->set_field("_config_upload_min_width", "0");
$this->setField("_config_upload_max_height", "2000"); $this->set_field("_config_upload_max_height", "2000");
$this->setField("_config_upload_max_width", "2000"); $this->set_field("_config_upload_max_width", "2000");
$this->setField("_config_upload_ratios", "4:3 16:9"); $this->set_field("_config_upload_ratios", "4:3 16:9");
$this->click("Save Settings"); $this->click("Save Settings");
$this->log_out(); $this->log_out();
$this->log_in_as_user(); $this->log_in_as_user();
$image_id = $this->post_image("ext/simpletest/data/pbx_screenshot.jpg", "pbx computer screenshot"); $image_id = $this->post_image("ext/simpletest/data/pbx_screenshot.jpg", "pbx computer screenshot");
$this->assertResponse(302); $this->assert_response(302);
$this->assertNoText("Image too large"); $this->assert_no_text("Image too large");
$this->assertNoText("Image too small"); $this->assert_no_text("Image too small");
$this->assertNoText("ratio"); $this->assert_no_text("ratio");
$this->log_out(); $this->log_out();
$this->log_in_as_admin(); $this->log_in_as_admin();
@ -27,19 +27,19 @@ class ResLimitTest extends ShimmieWebTestCase {
function testResLimitSmall() { function testResLimitSmall() {
$this->log_in_as_admin(); $this->log_in_as_admin();
$this->get_page("setup"); $this->get_page("setup");
$this->setField("_config_upload_min_height", "900"); $this->set_field("_config_upload_min_height", "900");
$this->setField("_config_upload_min_width", "900"); $this->set_field("_config_upload_min_width", "900");
$this->setField("_config_upload_max_height", "-1"); $this->set_field("_config_upload_max_height", "-1");
$this->setField("_config_upload_max_width", "-1"); $this->set_field("_config_upload_max_width", "-1");
$this->setField("_config_upload_ratios", "4:3 16:9"); $this->set_field("_config_upload_ratios", "4:3 16:9");
$this->click("Save Settings"); $this->click("Save Settings");
$this->log_out(); $this->log_out();
$this->log_in_as_user(); $this->log_in_as_user();
$image_id = $this->post_image("ext/simpletest/data/pbx_screenshot.jpg", "pbx computer screenshot"); $image_id = $this->post_image("ext/simpletest/data/pbx_screenshot.jpg", "pbx computer screenshot");
$this->assertResponse(200); $this->assert_response(200);
$this->assertTitle("Upload Status"); $this->assert_title("Upload Status");
$this->assertText("Image too small"); $this->assert_text("Image too small");
$this->log_out(); $this->log_out();
# hopefully a noop, but just in case # hopefully a noop, but just in case
@ -51,19 +51,19 @@ class ResLimitTest extends ShimmieWebTestCase {
function testResLimitLarge() { function testResLimitLarge() {
$this->log_in_as_admin(); $this->log_in_as_admin();
$this->get_page("setup"); $this->get_page("setup");
$this->setField("_config_upload_min_height", "0"); $this->set_field("_config_upload_min_height", "0");
$this->setField("_config_upload_min_width", "0"); $this->set_field("_config_upload_min_width", "0");
$this->setField("_config_upload_max_height", "100"); $this->set_field("_config_upload_max_height", "100");
$this->setField("_config_upload_max_width", "100"); $this->set_field("_config_upload_max_width", "100");
$this->setField("_config_upload_ratios", "4:3 16:9"); $this->set_field("_config_upload_ratios", "4:3 16:9");
$this->click("Save Settings"); $this->click("Save Settings");
$this->log_out(); $this->log_out();
$this->log_in_as_user(); $this->log_in_as_user();
$image_id = $this->post_image("ext/simpletest/data/pbx_screenshot.jpg", "pbx computer screenshot"); $image_id = $this->post_image("ext/simpletest/data/pbx_screenshot.jpg", "pbx computer screenshot");
$this->assertResponse(200); $this->assert_response(200);
$this->assertTitle("Upload Status"); $this->assert_title("Upload Status");
$this->assertText("Image too large"); $this->assert_text("Image too large");
$this->log_out(); $this->log_out();
# hopefully a noop, but just in case # hopefully a noop, but just in case
@ -75,19 +75,19 @@ class ResLimitTest extends ShimmieWebTestCase {
function testResLimitRatio() { function testResLimitRatio() {
$this->log_in_as_admin(); $this->log_in_as_admin();
$this->get_page("setup"); $this->get_page("setup");
$this->setField("_config_upload_min_height", "-1"); $this->set_field("_config_upload_min_height", "-1");
$this->setField("_config_upload_min_width", "-1"); $this->set_field("_config_upload_min_width", "-1");
$this->setField("_config_upload_max_height", "-1"); $this->set_field("_config_upload_max_height", "-1");
$this->setField("_config_upload_max_width", "-1"); $this->set_field("_config_upload_max_width", "-1");
$this->setField("_config_upload_ratios", "16:9"); $this->set_field("_config_upload_ratios", "16:9");
$this->click("Save Settings"); $this->click("Save Settings");
$this->log_out(); $this->log_out();
$this->log_in_as_user(); $this->log_in_as_user();
$image_id = $this->post_image("ext/simpletest/data/pbx_screenshot.jpg", "pbx computer screenshot"); $image_id = $this->post_image("ext/simpletest/data/pbx_screenshot.jpg", "pbx computer screenshot");
$this->assertResponse(200); $this->assert_response(200);
$this->assertTitle("Upload Status"); $this->assert_title("Upload Status");
$this->assertText("Image needs to be in one of these ratios"); $this->assert_text("Image needs to be in one of these ratios");
$this->log_out(); $this->log_out();
# hopefully a noop, but just in case # hopefully a noop, but just in case
@ -101,11 +101,11 @@ class ResLimitTest extends ShimmieWebTestCase {
public function tearDown() { public function tearDown() {
$this->log_in_as_admin(); $this->log_in_as_admin();
$this->get_page("setup"); $this->get_page("setup");
$this->setField("_config_upload_min_height", "-1"); $this->set_field("_config_upload_min_height", "-1");
$this->setField("_config_upload_min_width", "-1"); $this->set_field("_config_upload_min_width", "-1");
$this->setField("_config_upload_max_height", "-1"); $this->set_field("_config_upload_max_height", "-1");
$this->setField("_config_upload_max_width", "-1"); $this->set_field("_config_upload_max_width", "-1");
$this->setField("_config_upload_ratios", ""); $this->set_field("_config_upload_ratios", "");
$this->click("Save Settings"); $this->click("Save Settings");
$this->log_out(); $this->log_out();
} }

View file

@ -2,8 +2,8 @@
class RSSCommentsTest extends ShimmieWebTestCase { class RSSCommentsTest extends ShimmieWebTestCase {
function testImageFeed() { function testImageFeed() {
$this->get_page('rss/comments'); $this->get_page('rss/comments');
$this->assertMime("application/rss+xml"); $this->assert_mime("application/rss+xml");
$this->assertNoText("Exception"); $this->assert_no_text("Exception");
# FIXME: test that there are some comments here # FIXME: test that there are some comments here
} }

View file

@ -6,27 +6,27 @@ class RSSImagesTest extends ShimmieWebTestCase {
$this->log_out(); $this->log_out();
$this->get_page('rss/images'); $this->get_page('rss/images');
$this->assertMime("application/rss+xml"); $this->assert_mime("application/rss+xml");
$this->assertNoText("Exception"); $this->assert_no_text("Exception");
$this->get_page('rss/images/1'); $this->get_page('rss/images/1');
$this->assertMime("application/rss+xml"); $this->assert_mime("application/rss+xml");
$this->assertNoText("Exception"); $this->assert_no_text("Exception");
# FIXME: test that the image is actually found # FIXME: test that the image is actually found
$this->get_page('rss/images/computer/1'); $this->get_page('rss/images/computer/1');
$this->assertMime("application/rss+xml"); $this->assert_mime("application/rss+xml");
$this->assertNoText("Exception"); $this->assert_no_text("Exception");
# valid tag, invalid page # valid tag, invalid page
$this->get_page('rss/images/computer/2'); $this->get_page('rss/images/computer/2');
$this->assertMime("application/rss+xml"); $this->assert_mime("application/rss+xml");
$this->assertNoText("Exception"); $this->assert_no_text("Exception");
# not found # not found
$this->get_page('rss/images/waffle/2'); $this->get_page('rss/images/waffle/2');
$this->assertMime("application/rss+xml"); $this->assert_mime("application/rss+xml");
$this->assertNoText("Exception"); $this->assert_no_text("Exception");
$this->log_in_as_admin(); $this->log_in_as_admin();
$this->delete_image($image_id); $this->delete_image($image_id);

View file

@ -3,8 +3,8 @@ class SiteDescriptionTest extends SCoreWebTestCase {
function testSiteDescription() { function testSiteDescription() {
$this->log_in_as_admin(); $this->log_in_as_admin();
$this->get_page('setup'); $this->get_page('setup');
$this->assertTitle("Shimmie Setup"); $this->assert_title("Shimmie Setup");
$this->setField("_config_site_description", "A Shimmie testbed"); $this->set_field("_config_site_description", "A Shimmie testbed");
$raw = $this->click("Save Settings"); $raw = $this->click("Save Settings");
$header = '<meta name="description" content="A Shimmie testbed">'; $header = '<meta name="description" content="A Shimmie testbed">';

View file

@ -4,14 +4,14 @@ class TagHistoryTest extends ShimmieWebTestCase {
$this->log_in_as_admin(); $this->log_in_as_admin();
$image_id = $this->post_image("ext/simpletest/data/pbx_screenshot.jpg", "pbx"); $image_id = $this->post_image("ext/simpletest/data/pbx_screenshot.jpg", "pbx");
$this->get_page("post/view/$image_id"); $this->get_page("post/view/$image_id");
$this->assertTitle("Image $image_id: pbx"); $this->assert_title("Image $image_id: pbx");
$this->setField("tag_edit__tags", "new"); $this->set_field("tag_edit__tags", "new");
$this->click("Set"); $this->click("Set");
$this->assertTitle("Image $image_id: new"); $this->assert_title("Image $image_id: new");
$this->click("Tag History"); $this->click("Tag History");
$this->assertText("new (Set by demo"); $this->assert_text("new (Set by demo");
$this->click("Revert"); $this->click("Revert");
$this->assertTitle("Image $image_id: pbx"); $this->assert_title("Image $image_id: pbx");
$this->delete_image($image_id); $this->delete_image($image_id);
$this->log_out(); $this->log_out();
} }

View file

@ -2,8 +2,8 @@
class WikiTest extends SCoreWebTestCase { class WikiTest extends SCoreWebTestCase {
function testIndex() { function testIndex() {
$this->get_page("wiki"); $this->get_page("wiki");
$this->assertTitle("Index"); $this->assert_title("Index");
$this->assertText("This is a default page"); $this->assert_text("This is a default page");
} }
function testAccess() { function testAccess() {
@ -13,7 +13,7 @@ class WikiTest extends SCoreWebTestCase {
if($user != "admin") { if($user != "admin") {
$this->log_in_as_admin(); $this->log_in_as_admin();
$this->get_page("setup"); $this->get_page("setup");
$this->setField("_config_wiki_edit_$user", $allowed); $this->set_field("_config_wiki_edit_$user", $allowed);
$this->click("Save Settings"); $this->click("Save Settings");
$this->log_out(); $this->log_out();
} }
@ -22,15 +22,15 @@ class WikiTest extends SCoreWebTestCase {
if($user == "admin") {$this->log_in_as_admin();} if($user == "admin") {$this->log_in_as_admin();}
$this->get_page("wiki/test"); $this->get_page("wiki/test");
$this->assertTitle("test"); $this->assert_title("test");
$this->assertText("This is a default page"); $this->assert_text("This is a default page");
if($allowed || $user == "admin") { if($allowed || $user == "admin") {
$this->click("Edit"); $this->click("Edit");
$this->assertText("Editor"); $this->assert_text("Editor");
} }
else { else {
$this->click("Edit"); $this->click("Edit");
$this->assertNoText("Editor"); $this->assert_no_text("Editor");
} }
if($user == "user" || $user == "admin") {$this->log_out();} if($user == "user" || $user == "admin") {$this->log_out();}
@ -41,30 +41,30 @@ class WikiTest extends SCoreWebTestCase {
function testLock() { function testLock() {
$this->log_in_as_admin(); $this->log_in_as_admin();
$this->get_page("setup"); $this->get_page("setup");
$this->setField("_config_wiki_Edit_anon", false); $this->set_field("_config_wiki_Edit_anon", false);
$this->setField("_config_wiki_Edit_user", true); $this->set_field("_config_wiki_Edit_user", true);
$this->click("Save Settings"); $this->click("Save Settings");
$this->get_page("wiki/test_locked"); $this->get_page("wiki/test_locked");
$this->assertTitle("test_locked"); $this->assert_title("test_locked");
$this->assertText("This is a default page"); $this->assert_text("This is a default page");
$this->click("Edit"); $this->click("Edit");
$this->setField("body", "test_locked content"); $this->set_field("body", "test_locked content");
$this->setField("lock", true); $this->set_field("lock", true);
$this->click("Save"); $this->click("Save");
$this->log_out(); $this->log_out();
$this->log_in_as_user(); $this->log_in_as_user();
$this->get_page("wiki/test_locked"); $this->get_page("wiki/test_locked");
$this->assertTitle("test_locked"); $this->assert_title("test_locked");
$this->assertText("test_locked content"); $this->assert_text("test_locked content");
$this->assertNoText("Edit"); $this->assert_no_text("Edit");
$this->log_out(); $this->log_out();
$this->get_page("wiki/test_locked"); $this->get_page("wiki/test_locked");
$this->assertTitle("test_locked"); $this->assert_title("test_locked");
$this->assertText("test_locked content"); $this->assert_text("test_locked content");
$this->assertNoText("Edit"); $this->assert_no_text("Edit");
$this->log_in_as_admin(); $this->log_in_as_admin();
$this->get_page("wiki/test_locked"); $this->get_page("wiki/test_locked");
@ -75,14 +75,14 @@ class WikiTest extends SCoreWebTestCase {
function testDefault() { function testDefault() {
$this->log_in_as_admin(); $this->log_in_as_admin();
$this->get_page("wiki/wiki:default"); $this->get_page("wiki/wiki:default");
$this->assertTitle("wiki:default"); $this->assert_title("wiki:default");
$this->assertText("This is a default page"); $this->assert_text("This is a default page");
$this->click("Edit"); $this->click("Edit");
$this->setField("body", "Empty page! Fill it!"); $this->set_field("body", "Empty page! Fill it!");
$this->click("Save"); $this->click("Save");
$this->get_page("wiki/something"); $this->get_page("wiki/something");
$this->assertText("Empty page! Fill it!"); $this->assert_text("Empty page! Fill it!");
$this->get_page("wiki/wiki:default"); $this->get_page("wiki/wiki:default");
$this->click("Delete All"); $this->click("Delete All");
@ -92,21 +92,21 @@ class WikiTest extends SCoreWebTestCase {
function testRevisions() { function testRevisions() {
$this->log_in_as_admin(); $this->log_in_as_admin();
$this->get_page("wiki/test"); $this->get_page("wiki/test");
$this->assertTitle("test"); $this->assert_title("test");
$this->assertText("This is a default page"); $this->assert_text("This is a default page");
$this->click("Edit"); $this->click("Edit");
$this->setField("body", "Mooooo 1"); $this->set_field("body", "Mooooo 1");
$this->click("Save"); $this->click("Save");
$this->assertText("Mooooo 1"); $this->assert_text("Mooooo 1");
$this->assertText("Revision 1"); $this->assert_text("Revision 1");
$this->click("Edit"); $this->click("Edit");
$this->setField("body", "Mooooo 2"); $this->set_field("body", "Mooooo 2");
$this->click("Save"); $this->click("Save");
$this->assertText("Mooooo 2"); $this->assert_text("Mooooo 2");
$this->assertText("Revision 2"); $this->assert_text("Revision 2");
$this->click("Delete This Version"); $this->click("Delete This Version");
$this->assertText("Mooooo 1"); $this->assert_text("Mooooo 1");
$this->assertText("Revision 1"); $this->assert_text("Revision 1");
$this->click("Delete All"); $this->click("Delete All");
$this->log_out(); $this->log_out();
} }

View file

@ -3,7 +3,7 @@ class WordFilterTest extends ShimmieWebTestCase {
function testWordFilter() { function testWordFilter() {
$this->log_in_as_admin(); $this->log_in_as_admin();
$this->get_page("setup"); $this->get_page("setup");
$this->setField("_config_word_filter", "whore,nice lady\na duck,a kitten\n white ,\tspace\ninvalid"); $this->set_field("_config_word_filter", "whore,nice lady\na duck,a kitten\n white ,\tspace\ninvalid");
$this->click("Save Settings"); $this->click("Save Settings");
$this->log_out(); $this->log_out();
@ -12,39 +12,39 @@ class WordFilterTest extends ShimmieWebTestCase {
$this->get_page("post/view/$image_id"); $this->get_page("post/view/$image_id");
# regular # regular
$this->setField('comment', "posted by a whore"); $this->set_field('comment', "posted by a whore");
$this->click("Post Comment"); $this->click("Post Comment");
$this->assertText("posted by a nice lady"); $this->assert_text("posted by a nice lady");
# replace all instances # replace all instances
$this->setField('comment', "a whore is a whore is a whore"); $this->set_field('comment', "a whore is a whore is a whore");
$this->click("Post Comment"); $this->click("Post Comment");
$this->assertText("a nice lady is a nice lady is a nice lady"); $this->assert_text("a nice lady is a nice lady is a nice lady");
# still have effect when case is changed # still have effect when case is changed
$this->setField('comment', "monkey WhorE"); $this->set_field('comment', "monkey WhorE");
$this->click("Post Comment"); $this->click("Post Comment");
$this->assertText("monkey nice lady"); $this->assert_text("monkey nice lady");
# only do whole words # only do whole words
$this->setField('comment', "my name is whoretta"); $this->set_field('comment', "my name is whoretta");
$this->click("Post Comment"); $this->click("Post Comment");
$this->assertText("my name is whoretta"); $this->assert_text("my name is whoretta");
# search multiple words # search multiple words
$this->setField('comment', "I would like a duck"); $this->set_field('comment', "I would like a duck");
$this->click("Post Comment"); $this->click("Post Comment");
$this->assertText("I would like a kitten"); $this->assert_text("I would like a kitten");
# test for a line which was entered with extra whitespace # test for a line which was entered with extra whitespace
$this->setField('comment', "A colour is white"); $this->set_field('comment', "A colour is white");
$this->click("Post Comment"); $this->click("Post Comment");
$this->assertText("A colour is space"); $this->assert_text("A colour is space");
# don't do anything with invalid lines # don't do anything with invalid lines
$this->setField('comment', "The word was invalid"); $this->set_field('comment', "The word was invalid");
$this->click("Post Comment"); $this->click("Post Comment");
$this->assertText("The word was invalid"); $this->assert_text("The word was invalid");
$this->log_out(); $this->log_out();

View file

@ -2,18 +2,18 @@
class AdminPageTest extends ShimmieWebTestCase { class AdminPageTest extends ShimmieWebTestCase {
function testAuth() { function testAuth() {
$this->get_page('admin'); $this->get_page('admin');
$this->assertResponse(403); $this->assert_response(403);
$this->assertTitle("Permission Denied"); $this->assert_title("Permission Denied");
$this->log_in_as_user(); $this->log_in_as_user();
$this->get_page('admin'); $this->get_page('admin');
$this->assertResponse(403); $this->assert_response(403);
$this->assertTitle("Permission Denied"); $this->assert_title("Permission Denied");
$this->log_out(); $this->log_out();
$this->log_in_as_admin(); $this->log_in_as_admin();
$this->get_page('admin'); $this->get_page('admin');
$this->assertTitle("Admin Tools"); $this->assert_title("Admin Tools");
$this->log_out(); $this->log_out();
# FIXME: make sure the admin tools actually work # FIXME: make sure the admin tools actually work

View file

@ -2,66 +2,66 @@
class AliasEditorTest extends ShimmieWebTestCase { class AliasEditorTest extends ShimmieWebTestCase {
function testAliasEditor() { function testAliasEditor() {
$this->get_page('alias/list'); $this->get_page('alias/list');
$this->assertTitle("Alias List"); $this->assert_title("Alias List");
$this->log_in_as_admin(); $this->log_in_as_admin();
# test one to one # test one to one
$this->get_page('alias/list'); $this->get_page('alias/list');
$this->assertTitle("Alias List"); $this->assert_title("Alias List");
$this->setField('oldtag', "test1"); $this->set_field('oldtag', "test1");
$this->setField('newtag', "test2"); $this->set_field('newtag', "test2");
$this->click("Add"); $this->click("Add");
$this->assertText("test1"); $this->assert_text("test1");
$this->get_page("alias/export/aliases.csv"); $this->get_page("alias/export/aliases.csv");
$this->assertText("test1,test2"); $this->assert_text("test1,test2");
$image_id = $this->post_image("ext/simpletest/data/pbx_screenshot.jpg", "test1"); $image_id = $this->post_image("ext/simpletest/data/pbx_screenshot.jpg", "test1");
$this->get_page("post/view/$image_id"); # check that the tag has been replaced $this->get_page("post/view/$image_id"); # check that the tag has been replaced
$this->assertTitle("Image $image_id: test2"); $this->assert_title("Image $image_id: test2");
$this->get_page("post/list/test1/1"); # searching for an alias should find the master tag $this->get_page("post/list/test1/1"); # searching for an alias should find the master tag
$this->assertTitle("Image $image_id: test2"); $this->assert_title("Image $image_id: test2");
$this->get_page("post/list/test2/1"); # check that searching for the main tag still works $this->get_page("post/list/test2/1"); # check that searching for the main tag still works
$this->assertTitle("Image $image_id: test2"); $this->assert_title("Image $image_id: test2");
$this->delete_image($image_id); $this->delete_image($image_id);
$this->get_page('alias/list'); $this->get_page('alias/list');
$this->click("Remove"); $this->click("Remove");
$this->assertTitle("Alias List"); $this->assert_title("Alias List");
$this->assertNoText("test1"); $this->assert_no_text("test1");
# test one to many # test one to many
$this->get_page('alias/list'); $this->get_page('alias/list');
$this->assertTitle("Alias List"); $this->assert_title("Alias List");
$this->setField('oldtag', "onetag"); $this->set_field('oldtag', "onetag");
$this->setField('newtag', "multi tag"); $this->set_field('newtag', "multi tag");
$this->click("Add"); $this->click("Add");
$this->assertText("multi"); $this->assert_text("multi");
$this->assertText("tag"); $this->assert_text("tag");
$this->get_page("alias/export/aliases.csv"); $this->get_page("alias/export/aliases.csv");
$this->assertText("onetag,multi tag"); $this->assert_text("onetag,multi tag");
$image_id_1 = $this->post_image("ext/simpletest/data/pbx_screenshot.jpg", "onetag"); $image_id_1 = $this->post_image("ext/simpletest/data/pbx_screenshot.jpg", "onetag");
$image_id_2 = $this->post_image("ext/simpletest/data/bedroom_workshop.jpg", "onetag"); $image_id_2 = $this->post_image("ext/simpletest/data/bedroom_workshop.jpg", "onetag");
// FIXME: known broken // FIXME: known broken
//$this->get_page("post/list/onetag/1"); # searching for an aliased tag should find its aliases //$this->get_page("post/list/onetag/1"); # searching for an aliased tag should find its aliases
//$this->assertTitle("onetag"); //$this->assert_title("onetag");
//$this->assertNoText("No Images Found"); //$this->assert_no_text("No Images Found");
$this->get_page("post/list/multi/1"); $this->get_page("post/list/multi/1");
$this->assertTitle("multi"); $this->assert_title("multi");
$this->assertNoText("No Images Found"); $this->assert_no_text("No Images Found");
$this->get_page("post/list/multi%20tag/1"); $this->get_page("post/list/multi%20tag/1");
$this->assertTitle("multi tag"); $this->assert_title("multi tag");
$this->assertNoText("No Images Found"); $this->assert_no_text("No Images Found");
$this->delete_image($image_id_1); $this->delete_image($image_id_1);
$this->delete_image($image_id_2); $this->delete_image($image_id_2);
$this->get_page('alias/list'); $this->get_page('alias/list');
$this->click("Remove"); $this->click("Remove");
$this->assertTitle("Alias List"); $this->assert_title("Alias List");
$this->assertNoText("test1"); $this->assert_no_text("test1");
$this->log_out(); $this->log_out();
} }

View file

@ -6,48 +6,48 @@ class CommentListTest extends ShimmieWebTestCase {
# a good comment # a good comment
$this->get_page("post/view/$image_id"); $this->get_page("post/view/$image_id");
$this->setField('comment', "Test Comment ASDFASDF"); $this->set_field('comment', "Test Comment ASDFASDF");
$this->click("Post Comment"); $this->click("Post Comment");
$this->assertText("ASDFASDF"); $this->assert_text("ASDFASDF");
# dupe # dupe
$this->get_page("post/view/$image_id"); $this->get_page("post/view/$image_id");
$this->setField('comment', "Test Comment ASDFASDF"); $this->set_field('comment', "Test Comment ASDFASDF");
$this->click("Post Comment"); $this->click("Post Comment");
$this->assertText("try and be more original"); $this->assert_text("try and be more original");
# empty comment # empty comment
$this->get_page("post/view/$image_id"); $this->get_page("post/view/$image_id");
$this->setField('comment', ""); $this->set_field('comment', "");
$this->click("Post Comment"); $this->click("Post Comment");
$this->assertText("Comments need text..."); $this->assert_text("Comments need text...");
# whitespace is still empty... # whitespace is still empty...
$this->get_page("post/view/$image_id"); $this->get_page("post/view/$image_id");
$this->setField('comment', " \t\r\n"); $this->set_field('comment', " \t\r\n");
$this->click("Post Comment"); $this->click("Post Comment");
$this->assertText("Comments need text..."); $this->assert_text("Comments need text...");
# repetitive (aka. gzip gives >= 10x improvement) # repetitive (aka. gzip gives >= 10x improvement)
$this->get_page("post/view/$image_id"); $this->get_page("post/view/$image_id");
$this->setField('comment', str_repeat("U", 5000)); $this->set_field('comment', str_repeat("U", 5000));
$this->click("Post Comment"); $this->click("Post Comment");
$this->assertText("Comment too repetitive~"); $this->assert_text("Comment too repetitive~");
# test that search by comment metadata works # test that search by comment metadata works
$this->get_page("post/list/commented_by=test/1"); $this->get_page("post/list/commented_by=test/1");
$this->assertTitle("Image $image_id: pbx"); $this->assert_title("Image $image_id: pbx");
$this->get_page("post/list/comments=1/1"); $this->get_page("post/list/comments=1/1");
$this->assertTitle("Image $image_id: pbx"); $this->assert_title("Image $image_id: pbx");
$this->log_out(); $this->log_out();
$this->get_page('comment/list'); $this->get_page('comment/list');
$this->assertTitle('Comments'); $this->assert_title('Comments');
$this->assertText('ASDFASDF'); $this->assert_text('ASDFASDF');
$this->get_page('comment/list/2'); $this->get_page('comment/list/2');
$this->assertTitle('Comments'); $this->assert_title('Comments');
$this->log_in_as_admin(); $this->log_in_as_admin();
$this->delete_image($image_id); $this->delete_image($image_id);
@ -60,15 +60,15 @@ class CommentListTest extends ShimmieWebTestCase {
# make a comment # make a comment
$this->get_page("post/view/$image_id"); $this->get_page("post/view/$image_id");
$this->setField('comment', "Test Comment ASDFASDF"); $this->set_field('comment', "Test Comment ASDFASDF");
$this->click("Post Comment"); $this->click("Post Comment");
$this->assertTitle("Image $image_id: pbx"); $this->assert_title("Image $image_id: pbx");
$this->assertText("ASDFASDF"); $this->assert_text("ASDFASDF");
# delete it # delete it
$this->click("Del"); $this->click("Del");
$this->assertTitle("Image $image_id: pbx"); $this->assert_title("Image $image_id: pbx");
$this->assertNoText("ASDFASDF"); $this->assert_no_text("ASDFASDF");
# tidy up # tidy up
$this->delete_image($image_id); $this->delete_image($image_id);

View file

@ -2,19 +2,19 @@
class ExtManagerTest extends SCoreWebTestCase { class ExtManagerTest extends SCoreWebTestCase {
function testAuth() { function testAuth() {
$this->get_page('ext_manager'); $this->get_page('ext_manager');
$this->assertResponse(403); $this->assert_response(403);
$this->assertTitle("Permission Denied"); $this->assert_title("Permission Denied");
$this->log_in_as_user(); $this->log_in_as_user();
$this->get_page('ext_manager'); $this->get_page('ext_manager');
$this->assertResponse(403); $this->assert_response(403);
$this->assertTitle("Permission Denied"); $this->assert_title("Permission Denied");
$this->log_out(); $this->log_out();
$this->log_in_as_admin(); $this->log_in_as_admin();
$this->get_page('ext_manager'); $this->get_page('ext_manager');
$this->assertTitle("Extensions"); $this->assert_title("Extensions");
$this->assertText("SimpleTest integration"); $this->assert_text("SimpleTest integration");
$this->log_out(); $this->log_out();
# FIXME: test that some extensions can be added and removed? :S # FIXME: test that some extensions can be added and removed? :S

View file

@ -2,9 +2,9 @@
class Handle404Test extends SCoreWebTestCase { class Handle404Test extends SCoreWebTestCase {
function test404Handler() { function test404Handler() {
$this->get_page('not/a/page'); $this->get_page('not/a/page');
$this->assertResponse(404); $this->assert_response(404);
$this->assertTitle('404'); $this->assert_title('404');
$this->assertText("No handler could be found for the page 'not/a/page'"); $this->assert_text("No handler could be found for the page 'not/a/page'");
} }
} }
?> ?>

View file

@ -3,7 +3,7 @@ class PixelHandlerTest extends ShimmieWebTestCase {
function testPixelHander() { function testPixelHander() {
$this->log_in_as_user(); $this->log_in_as_user();
$image_id = $this->post_image("ext/simpletest/data/pbx_screenshot.jpg", "pbx computer screenshot"); $image_id = $this->post_image("ext/simpletest/data/pbx_screenshot.jpg", "pbx computer screenshot");
$this->assertResponse(302); $this->assert_response(302);
$this->log_out(); $this->log_out();
$this->log_in_as_admin(); $this->log_in_as_admin();

View file

@ -5,9 +5,9 @@ class ImageTest extends ShimmieWebTestCase {
$image_id = $this->post_image("ext/simpletest/data/pbx_screenshot.jpg", "test"); $image_id = $this->post_image("ext/simpletest/data/pbx_screenshot.jpg", "test");
$this->get_page("user/test"); $this->get_page("user/test");
$this->assertText("Images uploaded: 1"); $this->assert_text("Images uploaded: 1");
$this->click("Images uploaded"); $this->click("Images uploaded");
$this->assertTitle("Image $image_id: test"); $this->assert_title("Image $image_id: test");
$this->log_out(); $this->log_out();
$this->log_in_as_admin(); $this->log_in_as_admin();

View file

@ -2,28 +2,28 @@
class IndexTest extends ShimmieWebTestCase { class IndexTest extends ShimmieWebTestCase {
function testIndexPage() { function testIndexPage() {
$this->get_page('post/list'); $this->get_page('post/list');
$this->assertTitle("Welcome to Shimmie ".VERSION); $this->assert_title("Welcome to Shimmie ".VERSION);
$this->assertNoText("Prev | Index | Next"); $this->assert_no_text("Prev | Index | Next");
$this->log_in_as_user(); $this->log_in_as_user();
$image_id = $this->post_image("ext/simpletest/data/pbx_screenshot.jpg", "pbx computer screenshot"); $image_id = $this->post_image("ext/simpletest/data/pbx_screenshot.jpg", "pbx computer screenshot");
$this->log_out(); $this->log_out();
$this->get_page('post/list'); $this->get_page('post/list');
$this->assertTitle("Shimmie"); $this->assert_title("Shimmie");
$this->assertText("Prev | Index | Next"); $this->assert_text("Prev | Index | Next");
$this->get_page('post/list/-1'); $this->get_page('post/list/-1');
$this->assertTitle("Shimmie"); $this->assert_title("Shimmie");
$this->get_page('post/list/0'); $this->get_page('post/list/0');
$this->assertTitle("Shimmie"); $this->assert_title("Shimmie");
$this->get_page('post/list/1'); $this->get_page('post/list/1');
$this->assertTitle("Shimmie"); $this->assert_title("Shimmie");
$this->get_page('post/list/99999'); $this->get_page('post/list/99999');
$this->assertTitle("Shimmie"); $this->assert_title("Shimmie");
$this->log_in_as_admin(); $this->log_in_as_admin();
$this->delete_image($image_id); $this->delete_image($image_id);
@ -44,46 +44,46 @@ class IndexTest extends ShimmieWebTestCase {
# regular tag, no results # regular tag, no results
$this->get_page('post/list/maumaumau/1'); $this->get_page('post/list/maumaumau/1');
$this->assertTitle("maumaumau"); $this->assert_title("maumaumau");
$this->assertText("No Images Found"); $this->assert_text("No Images Found");
# regular tag, many results # regular tag, many results
$this->get_page('post/list/computer/1'); $this->get_page('post/list/computer/1');
$this->assertTitle("computer"); $this->assert_title("computer");
$this->assertNoText("No Images Found"); $this->assert_no_text("No Images Found");
# meta tag, many results # meta tag, many results
$this->get_page('post/list/size=640x480/1'); $this->get_page('post/list/size=640x480/1');
$this->assertTitle("size=640x480"); $this->assert_title("size=640x480");
$this->assertNoText("No Images Found"); $this->assert_no_text("No Images Found");
# meta tag, one result # meta tag, one result
$this->get_page("post/list/hash=feb01bab5698a11dd87416724c7a89e3/1"); $this->get_page("post/list/hash=feb01bab5698a11dd87416724c7a89e3/1");
$this->assertTitle(new PatternExpectation("/^Image $image_id_1: /")); $this->assert_title(new PatternExpectation("/^Image $image_id_1: /"));
$this->assertNoText("No Images Found"); $this->assert_no_text("No Images Found");
# meta tag, one result # meta tag, one result
$this->get_page("post/list/md5=feb01bab5698a11dd87416724c7a89e3/1"); $this->get_page("post/list/md5=feb01bab5698a11dd87416724c7a89e3/1");
$this->assertTitle(new PatternExpectation("/^Image $image_id_1: /")); $this->assert_title(new PatternExpectation("/^Image $image_id_1: /"));
$this->assertNoText("No Images Found"); $this->assert_no_text("No Images Found");
# multiple tags, many results # multiple tags, many results
$this->get_page('post/list/computer%20size=640x480/1'); $this->get_page('post/list/computer%20size=640x480/1');
$this->assertTitle("computer size=640x480"); $this->assert_title("computer size=640x480");
$this->assertNoText("No Images Found"); $this->assert_no_text("No Images Found");
# multiple tags, single result; search with one result = direct to image # multiple tags, single result; search with one result = direct to image
$this->get_page('post/list/screenshot%20computer/1'); $this->get_page('post/list/screenshot%20computer/1');
$this->assertTitle(new PatternExpectation("/^Image $image_id_1: /")); $this->assert_title(new PatternExpectation("/^Image $image_id_1: /"));
# negative tag, should have one result # negative tag, should have one result
$this->get_page('post/list/computer%20-pbx/1'); $this->get_page('post/list/computer%20-pbx/1');
$this->assertTitle(new PatternExpectation("/^Image $image_id_2: /")); $this->assert_title(new PatternExpectation("/^Image $image_id_2: /"));
# negative tag alone, should work # negative tag alone, should work
# FIXME: known broken in mysql # FIXME: known broken in mysql
//$this->get_page('post/list/-pbx/1'); //$this->get_page('post/list/-pbx/1');
//$this->assertTitle(new PatternExpectation("/^Image $image_id_2: /")); //$this->assert_title(new PatternExpectation("/^Image $image_id_2: /"));
$this->log_in_as_admin(); $this->log_in_as_admin();
$this->delete_image($image_id_1); $this->delete_image($image_id_1);

View file

@ -2,19 +2,19 @@
class SetupTest extends SCoreWebTestCase { class SetupTest extends SCoreWebTestCase {
function testAuth() { function testAuth() {
$this->get_page('setup'); $this->get_page('setup');
$this->assertResponse(403); $this->assert_response(403);
$this->assertTitle("Permission Denied"); $this->assert_title("Permission Denied");
$this->log_in_as_user(); $this->log_in_as_user();
$this->get_page('setup'); $this->get_page('setup');
$this->assertResponse(403); $this->assert_response(403);
$this->assertTitle("Permission Denied"); $this->assert_title("Permission Denied");
$this->log_out(); $this->log_out();
$this->log_in_as_admin(); $this->log_in_as_admin();
$this->get_page('setup'); $this->get_page('setup');
$this->assertTitle("Shimmie Setup"); $this->assert_title("Shimmie Setup");
$this->assertText("General"); $this->assert_text("General");
$this->log_out(); $this->log_out();
} }
} }

View file

@ -4,13 +4,13 @@ class TagEditTest extends ShimmieWebTestCase {
$this->log_in_as_user(); $this->log_in_as_user();
$image_id = $this->post_image("ext/simpletest/data/pbx_screenshot.jpg", "pbx"); $image_id = $this->post_image("ext/simpletest/data/pbx_screenshot.jpg", "pbx");
$this->get_page("post/view/$image_id"); $this->get_page("post/view/$image_id");
$this->assertTitle("Image $image_id: pbx"); $this->assert_title("Image $image_id: pbx");
$this->setField("tag_edit__tags", "new"); $this->set_field("tag_edit__tags", "new");
$this->click("Set"); $this->click("Set");
$this->assertTitle("Image $image_id: new"); $this->assert_title("Image $image_id: new");
$this->setField("tag_edit__tags", ""); $this->set_field("tag_edit__tags", "");
$this->click("Set"); $this->click("Set");
$this->assertTitle("Image $image_id: tagme"); $this->assert_title("Image $image_id: tagme");
$this->log_out(); $this->log_out();
$this->log_in_as_admin(); $this->log_in_as_admin();

View file

@ -2,16 +2,16 @@
class TagListTest extends ShimmieWebTestCase { class TagListTest extends ShimmieWebTestCase {
function testTagList() { function testTagList() {
$this->get_page('tags/map'); $this->get_page('tags/map');
$this->assertTitle('Tag List'); $this->assert_title('Tag List');
$this->get_page('tags/alphabetic'); $this->get_page('tags/alphabetic');
$this->assertTitle('Tag List'); $this->assert_title('Tag List');
$this->get_page('tags/popularity'); $this->get_page('tags/popularity');
$this->assertTitle('Tag List'); $this->assert_title('Tag List');
$this->get_page('tags/categories'); $this->get_page('tags/categories');
$this->assertTitle('Tag List'); $this->assert_title('Tag List');
# FIXME: test that these show the right stuff # FIXME: test that these show the right stuff
} }

View file

@ -4,25 +4,25 @@ class UploadTest extends ShimmieWebTestCase {
$this->log_in_as_user(); $this->log_in_as_user();
$image_id_1 = $this->post_image("ext/simpletest/data/pbx_screenshot.jpg", "pbx computer screenshot"); $image_id_1 = $this->post_image("ext/simpletest/data/pbx_screenshot.jpg", "pbx computer screenshot");
$this->assertResponse(302); $this->assert_response(302);
$image_id_2 = $this->post_image("ext/simpletest/data/pbx_screenshot.jpg", "pbx computer screenshot"); $image_id_2 = $this->post_image("ext/simpletest/data/pbx_screenshot.jpg", "pbx computer screenshot");
$this->assertResponse(200); $this->assert_response(200);
$this->assertTitle("Upload Status"); $this->assert_title("Upload Status");
$this->assertText("already has hash"); $this->assert_text("already has hash");
$image_id_3 = $this->post_image("index.php", "test"); $image_id_3 = $this->post_image("index.php", "test");
$this->assertResponse(200); $this->assert_response(200);
$this->assertTitle("Upload Status"); $this->assert_title("Upload Status");
$this->assertText("File type not recognised"); $this->assert_text("File type not recognised");
/* /*
// FIXME: huge.dat is rejected for other reasons; manual testing shows that this works // 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)); 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"); $image_id_4 = $this->post_image("index.php", "test");
$this->assertResponse(200); $this->assert_response(200);
$this->assertTitle("Upload Status"); $this->assert_title("Upload Status");
$this->assertText("File too large"); $this->assert_text("File too large");
unlink("huge.dat"); unlink("huge.dat");
*/ */

View file

@ -2,29 +2,29 @@
class UserPageTest extends SCoreWebTestCase { class UserPageTest extends SCoreWebTestCase {
function testUserPage() { function testUserPage() {
$this->get_page('user'); $this->get_page('user');
$this->assertTitle("Not Logged In"); $this->assert_title("Not Logged In");
$this->assertNoText("Options"); $this->assert_no_text("Options");
$this->assertNoText("More Options"); $this->assert_no_text("More Options");
$this->get_page('user/demo'); $this->get_page('user/demo');
$this->assertTitle("demo's Page"); $this->assert_title("demo's Page");
$this->assertText("Join date:"); $this->assert_text("Join date:");
$this->get_page('user/MauMau'); $this->get_page('user/MauMau');
$this->assertTitle("No Such User"); $this->assert_title("No Such User");
$this->log_in_as_user(); $this->log_in_as_user();
// should be on the user page // should be on the user page
$this->assertTitle(USER_NAME+"'s Page"); $this->assert_title(USER_NAME+"'s Page");
$this->assertText("Options"); $this->assert_text("Options");
$this->assertNoText("Admin:"); $this->assert_no_text("Admin:");
$this->log_out(); $this->log_out();
$this->log_in_as_admin(); $this->log_in_as_admin();
// should be on the user page // should be on the user page
$this->assertTitle(ADMIN_NAME+"'s Page"); $this->assert_title(ADMIN_NAME+"'s Page");
$this->assertText("Options"); $this->assert_text("Options");
$this->assertText("Admin:"); $this->assert_text("Admin:");
$this->log_out(); $this->log_out();
# FIXME: test user creation # FIXME: test user creation

View file

@ -7,13 +7,13 @@ class ViewTest extends ShimmieWebTestCase {
$this->log_out(); $this->log_out();
$this->get_page("post/view/$image_id"); $this->get_page("post/view/$image_id");
$this->assertTitle("Image $image_id: test"); $this->assert_title("Image $image_id: test");
$this->get_page("post/view/$idp1"); $this->get_page("post/view/$idp1");
$this->assertTitle('Image not found'); $this->assert_title('Image not found');
$this->get_page('post/view/-1'); $this->get_page('post/view/-1');
$this->assertTitle('Image not found'); $this->assert_title('Image not found');
$this->log_in_as_admin(); $this->log_in_as_admin();
$this->delete_image($image_id); $this->delete_image($image_id);