more tests...
This commit is contained in:
parent
aa7969cdde
commit
5857b60c2e
@ -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();
|
||||
|
||||
|
@ -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");
|
||||
|
@ -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() {
|
||||
|
@ -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 = '<meta name="description" content="A Shimmie testbed">';
|
||||
$this->assertTrue(strpos($raw_headers, $header) > 0);
|
||||
$this->assertTrue(strpos($raw, $header) > 0);
|
||||
|
||||
$this->log_out();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user