diff --git a/contrib/featured/test.php b/contrib/featured/test.php index 02c8bd25..1557fc17 100644 --- a/contrib/featured/test.php +++ b/contrib/featured/test.php @@ -2,16 +2,17 @@ class FeaturedTest extends ShimmieWebTestCase { function testFeatured() { $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"); $this->log_out(); - $this->get_page("post/view/$image_id"); - $this->click("Feature This"); - - $this->get_page("post/list"); - $this->assertText("Featured Image"); + # FIXME: test that regular users can't feature things $this->log_in_as_admin(); + $this->get_page("post/view/$image_id"); + $this->assertTitle("Image $image_id: pbx"); + $this->click("Feature This"); + $this->get_page("post/list"); + $this->assertText("Featured Image"); $this->delete_image($image_id); $this->log_out(); diff --git a/contrib/link_image/test.php b/contrib/link_image/test.php index 01a31afb..b357d7da 100644 --- a/contrib/link_image/test.php +++ b/contrib/link_image/test.php @@ -7,7 +7,8 @@ class LinkImageTest extends ShimmieWebTestCase { # look in the "plain text link to post" box, follow the link # in there, see if it takes us to the right page $raw = $this->get_page("post/view/$image_id"); - $matches = preg_match("/name='text_post-link'\s+value='([^']+)'/", $raw); + $matches = array(); + preg_match("#value='(http://.*(/|%2F)post(/|%2F)view(/|%2F)[0-9]+)'#", $raw, $matches); $this->assertTrue(count($matches) > 0); $this->get($matches[1]); $this->assertTitle("Image $image_id: pie"); diff --git a/contrib/simpletest/main.php b/contrib/simpletest/main.php index 9d210c0a..377efa93 100644 --- a/contrib/simpletest/main.php +++ b/contrib/simpletest/main.php @@ -19,11 +19,12 @@ class SCoreWebTestCase extends WebTestCase { protected function get_page($page) { $url = "http://".$_SERVER["HTTP_HOST"].get_base_href().'/'.make_link($page); $url = str_replace("/./", "/", $url); - $this->get($url); + $raw = $this->get($url); $this->assertNoText("Exception:"); $this->assertNoText("Error:"); $this->assertNoText("Warning:"); $this->assertNoText("Notice:"); + return $raw; } protected function log_in_as_user() { diff --git a/contrib/site_description/test.php b/contrib/site_description/test.php index 033d507e..089d229c 100644 --- a/contrib/site_description/test.php +++ b/contrib/site_description/test.php @@ -5,11 +5,10 @@ class SiteDescriptionTest extends ShimmieWebTestCase { $this->get_page('setup'); $this->assertTitle("Shimmie Setup"); $this->setField("_config_site_description", "A Shimmie testbed"); - $this->click("Save Settings"); + $raw = $this->click("Save Settings"); - $raw_headers = $this->getBrowser()->getHeaders(); $header = ''; - $this->assertTrue(strpos($raw_headers, $header) > 0); + $this->assertTrue(strpos($raw, $header) > 0); $this->log_out(); }