summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAngie Byron <webchick@24967.no-reply.drupal.org>2009-12-07 06:07:19 +0000
committerAngie Byron <webchick@24967.no-reply.drupal.org>2009-12-07 06:07:19 +0000
commitb52cdd773c10df895f306f4956e8b8294d875c0f (patch)
tree9a5f2e8cf4033c03db179c55f74c390a13363d65
parent778ec56c7b2e30b97671b4f5090c7832ed41649d (diff)
downloadbrdo-b52cdd773c10df895f306f4956e8b8294d875c0f.tar.gz
brdo-b52cdd773c10df895f306f4956e8b8294d875c0f.tar.bz2
#652420 by sun: Fixed Various failures everywhere caught by asserting on watchdog errors found in testing logs.
-rw-r--r--includes/path.inc2
-rw-r--r--modules/contact/contact.test1
-rw-r--r--modules/locale/locale.test37
-rw-r--r--modules/path/path.test6
-rw-r--r--modules/search/search.test5
-rw-r--r--modules/simpletest/tests/session.test4
6 files changed, 30 insertions, 25 deletions
diff --git a/includes/path.inc b/includes/path.inc
index cbbaff691..7d9fc1631 100644
--- a/includes/path.inc
+++ b/includes/path.inc
@@ -161,7 +161,7 @@ function drupal_cache_system_paths() {
// Check if the system paths for this page were loaded from cache in this
// request to avoid writing to cache on every request.
$cache = &drupal_static('drupal_lookup_path', array());
- if (empty($cache['system_paths'])) {
+ if (empty($cache['system_paths']) && !empty($cache['map'])) {
// Generate a cache ID (cid) specifically for this page.
$cid = current_path();
// The static $map array used by drupal_lookup_path() includes all
diff --git a/modules/contact/contact.test b/modules/contact/contact.test
index 6bbf4d996..3b6f90a82 100644
--- a/modules/contact/contact.test
+++ b/modules/contact/contact.test
@@ -144,6 +144,7 @@ class ContactSitewideTestCase extends DrupalWebTestCase {
}
// Submit contact form one over limit.
$this->drupalGet('contact');
+ $this->assertResponse(403, t('Access denied to anonymous user after reaching message treshold.'));
$this->assertRaw(t('You cannot send more than %number messages in @interval. Please try again later.', array('%number' => variable_get('contact_threshold_limit', 3), '@interval' => format_interval(600))), t('Message threshold reached.'));
// Delete created categories.
diff --git a/modules/locale/locale.test b/modules/locale/locale.test
index 2e6cceade..10f60109c 100644
--- a/modules/locale/locale.test
+++ b/modules/locale/locale.test
@@ -85,13 +85,12 @@ class LocaleConfigurationTest extends DrupalWebTestCase {
$edit = array(
'site_default' => $langcode,
);
- $this->drupalPost($path, $edit, t('Save configuration'));
+ $this->drupalPost(NULL, $edit, t('Save configuration'));
$this->assertNoFieldChecked('edit-site-default-en', t('Default language updated.'));
$this->assertEqual($this->getUrl(), url('admin/config/regional/language', array('absolute' => TRUE)), t('Correct page redirection.'));
// Ensure we can't delete the default language.
- $path = 'admin/config/regional/language/delete/' . $langcode;
- $this->drupalGet($path);
+ $this->drupalGet('admin/config/regional/language/delete/' . $langcode);
$this->assertEqual($this->getUrl(), url('admin/config/regional/language', array('absolute' => TRUE)), t('Correct page redirection.'));
$this->assertText(t('The default language cannot be deleted.'), t('Failed to delete the default language.'));
@@ -106,53 +105,45 @@ class LocaleConfigurationTest extends DrupalWebTestCase {
$edit = array(
'site_default' => 'en',
);
- $this->drupalPost($path, $edit, t('Save configuration'));
+ $this->drupalPost(NULL, $edit, t('Save configuration'));
$this->assertFieldChecked('edit-enabled-en', t('Default language re-enabled.'));
// Ensure 'edit' link works.
$this->clickLink(t('edit'));
$this->assertTitle(t('Edit language | Drupal'), t('Page title is "Edit language".'));
// Edit a language.
- $path = 'admin/config/regional/language/edit/' . $langcode;
$name = $this->randomName(16);
$edit = array(
'name' => $name,
);
- $this->drupalPost($path, $edit, t('Save language'));
+ $this->drupalPost('admin/config/regional/language/edit/' . $langcode, $edit, t('Save language'));
$this->assertRaw($name, t('The language has been updated.'));
$this->assertEqual($this->getUrl(), url('admin/config/regional/language', array('absolute' => TRUE)), t('Correct page redirection.'));
// Ensure 'delete' link works.
- $path = 'admin/config/regional/language';
- $this->drupalGet($path);
+ $this->drupalGet('admin/config/regional/language');
$this->clickLink(t('delete'));
$this->assertText(t('Are you sure you want to delete the language'), t('"delete" link is correct.'));
// Delete the language.
- $path = 'admin/config/regional/language/delete/' . $langcode;
- $this->drupalGet($path);
+ $this->drupalGet('admin/config/regional/language/delete/' . $langcode);
// First test the 'cancel' link.
$this->clickLink(t('Cancel'));
$this->assertEqual($this->getUrl(), url('admin/config/regional/language', array('absolute' => TRUE)), t('Correct page redirection.'));
$this->assertRaw($name, t('The language was not deleted.'));
// Delete the language for real. This a confirm form, we do not need any
// fields changed.
- $this->drupalPost($path, array(), t('Delete'));
+ $this->drupalPost('admin/config/regional/language/delete/' . $langcode, array(), t('Delete'));
// We need raw here because %locale will add HTML.
$this->assertRaw(t('The language %locale has been removed.', array('%locale' => $name)), t('The test language has been removed.'));
$this->assertEqual($this->getUrl(), url('admin/config/regional/language', array('absolute' => TRUE)), t('Correct page redirection.'));
- // Reload to remove $name.
- $this->drupalGet($path);
- $this->assertNoText($langcode, t('Language code not found.'));
- $this->assertNoText($name, t('Name not found.'));
- $this->assertNoText($native, t('Native not found.'));
+ // Verify that language is no longer found.
+ $this->drupalGet('admin/config/regional/language/delete/' . $langcode);
+ $this->assertResponse(404, t('Language no longer found.'));
// Ensure we can't delete the English language.
- $path = 'admin/config/regional/language/delete/en';
- $this->drupalGet($path);
+ $this->drupalGet('admin/config/regional/language/delete/en');
$this->assertEqual($this->getUrl(), url('admin/config/regional/language', array('absolute' => TRUE)), t('Correct page redirection.'));
$this->assertText(t('The English language cannot be deleted.'), t('Failed to delete English language.'));
-
- $this->drupalLogout();
}
}
@@ -1323,7 +1314,7 @@ class LocaleContentFunctionalTest extends DrupalWebTestCase {
// User to add and remove language.
$admin_user = $this->drupalCreateUser(array('administer languages', 'administer content types', 'access administration pages'));
// User to create a node.
- $web_user = $this->drupalCreateUser(array('create page content', 'edit any page content'));
+ $web_user = $this->drupalCreateUser(array('create article content', 'create page content', 'edit any page content'));
// Add custom language.
$this->drupalLogin($admin_user);
@@ -1382,12 +1373,12 @@ class LocaleContentFunctionalTest extends DrupalWebTestCase {
$this->drupalLogin($web_user);
$this->drupalGet('node/add/article');
// Verify language select list is not present.
- $this->assertNoRaw('<select name="language" class="form-select" id="edit-language" >', t('Language select not present on add article form.'));
+ $this->assertNoFieldByName('language', '', t('Language select not present on add article form.'));
// Verify language selection appears on add page form.
$this->drupalGet('node/add/page');
// Verify language select list is present.
- $this->assertRaw('<select name="language" class="form-select" id="edit-language" >', t('Language select present on add page form.'));
+ $this->assertFieldByName('language', '', t('Language select present on add page form.'));
// Ensure enabled language appears.
$this->assertText($name, t('Enabled language present.'));
// Ensure disabled language doesn't appear.
diff --git a/modules/path/path.test b/modules/path/path.test
index 43a9d778a..adf6c3e34 100644
--- a/modules/path/path.test
+++ b/modules/path/path.test
@@ -64,6 +64,7 @@ class PathTestCase extends DrupalWebTestCase {
// Confirm that the alias works.
$this->drupalGet($edit['alias']);
$this->assertText($node1->title[LANGUAGE_NONE][0]['value'], 'Alias works.');
+ $this->assertNoResponse(404);
// Change alias.
$pid = $this->getPID($edit['alias']);
@@ -75,6 +76,7 @@ class PathTestCase extends DrupalWebTestCase {
// Confirm that the alias works.
$this->drupalGet($edit['alias']);
$this->assertText($node1->title[LANGUAGE_NONE][0]['value'], 'Changed alias works.');
+ $this->assertNoResponse(404);
drupal_static_reset('drupal_lookup_path');
// Confirm that previous alias no longer works.
@@ -99,6 +101,7 @@ class PathTestCase extends DrupalWebTestCase {
// Confirm that the alias no longer works.
$this->drupalGet($edit['alias']);
$this->assertNoText($node1->title, 'Alias was successfully deleted.');
+ $this->assertResponse(404);
}
/**
@@ -116,6 +119,7 @@ class PathTestCase extends DrupalWebTestCase {
// Confirm that the alias works.
$this->drupalGet($edit['path[alias]']);
$this->assertText($node1->title[LANGUAGE_NONE][0]['value'], 'Alias works.');
+ $this->assertNoResponse(404);
// Change alias.
$previous = $edit['path[alias]'];
@@ -125,6 +129,7 @@ class PathTestCase extends DrupalWebTestCase {
// Confirm that the alias works.
$this->drupalGet($edit['path[alias]']);
$this->assertText($node1->title[LANGUAGE_NONE][0]['value'], 'Changed alias works.');
+ $this->assertNoResponse(404);
// Make sure that previous alias no longer works.
$this->drupalGet($previous);
@@ -147,6 +152,7 @@ class PathTestCase extends DrupalWebTestCase {
// Confirm that the alias no longer works.
$this->drupalGet($edit['path[alias]']);
$this->assertNoText($node1->title, 'Alias was successfully deleted.');
+ $this->assertResponse(404);
}
function getPID($alias) {
diff --git a/modules/search/search.test b/modules/search/search.test
index 15cc1328d..de7b454e2 100644
--- a/modules/search/search.test
+++ b/modules/search/search.test
@@ -424,7 +424,10 @@ class SearchBlockTestCase extends DrupalWebTestCase {
$this->assertText('Your search yielded no results');
// Test a search from the block on a 404 page.
- $this->drupalPost('foo', $terms, t('Search'));
+ $this->drupalGet('foo');
+ $this->assertResponse(404);
+ $this->drupalPost(NULL, $terms, t('Search'));
+ $this->assertNoResponse(404);
$this->assertText('Your search yielded no results');
// Test a search from the block when it doesn't appear on the search page.
diff --git a/modules/simpletest/tests/session.test b/modules/simpletest/tests/session.test
index 379b82733..640431487 100644
--- a/modules/simpletest/tests/session.test
+++ b/modules/simpletest/tests/session.test
@@ -309,12 +309,14 @@ class SessionHttpsTestCase extends DrupalWebTestCase {
$this->curlClose();
$this->drupalGet($this->httpsUrl('admin'), array(), array('Cookie: ' . $cookie));
$this->assertText(t('Administer'));
+ $this->assertNoResponse(403);
// Verify that user is not logged in on non-secure URL.
if (!$is_https) {
$this->curlClose();
$this->drupalGet('admin', array(), array('Cookie: ' . $cookie));
$this->assertNoText(t('Administer'));
+ $this->assertResponse(403);
}
// Clear browser cookie jar.
@@ -373,9 +375,11 @@ class SessionHttpsTestCase extends DrupalWebTestCase {
$this->drupalGet($url, array(), array('Cookie: ' . $cookie));
if ($cookie_key == $url_key) {
$this->assertText(t('Administer'));
+ $this->assertNoResponse(403);
}
else {
$this->assertNoText(t('Administer'));
+ $this->assertResponse(403);
}
}
}