Commit b52cdd77 authored by webchick's avatar webchick

#652420 by sun: Fixed Various failures everywhere caught by asserting on...

#652420 by sun: Fixed Various failures everywhere caught by asserting on watchdog errors found in testing logs.
parent 778ec56c
......@@ -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
......
......@@ -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.
......
......@@ -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.
......
......@@ -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) {
......
......@@ -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.
......
......@@ -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);
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment