Commit 958ff6ff authored by jhodgdon's avatar jhodgdon
Browse files

Issue #1797926 by Lars Toomre: Remove t() from test asserts in System tests

parent 18fa6daa
......@@ -43,7 +43,7 @@ function setUp() {
function testAccessDenied() {
$this->drupalGet('admin');
$this->assertText(t('Access denied'), t('Found the default 403 page'));
$this->assertText(t('Access denied'), 'Found the default 403 page');
$this->assertResponse(403);
// Use a custom 403 page.
......@@ -62,8 +62,8 @@ function testAccessDenied() {
// Logout and check that the user login block is shown on custom 403 pages.
$this->drupalLogout();
$this->drupalGet('admin');
$this->assertText($this->admin_user->name, t('Found the custom 403 page'));
$this->assertText(t('User login'), t('Blocks are shown on the custom 403 page'));
$this->assertText($this->admin_user->name, 'Found the custom 403 page');
$this->assertText(t('User login'), 'Blocks are shown on the custom 403 page');
// Log back in and remove the custom 403 page.
$this->drupalLogin($this->admin_user);
......@@ -75,9 +75,9 @@ function testAccessDenied() {
// Logout and check that the user login block is shown on default 403 pages.
$this->drupalLogout();
$this->drupalGet('admin');
$this->assertText(t('Access denied'), t('Found the default 403 page'));
$this->assertText(t('Access denied'), 'Found the default 403 page');
$this->assertResponse(403);
$this->assertText(t('User login'), t('Blocks are shown on the default 403 page'));
$this->assertText(t('User login'), 'Blocks are shown on the default 403 page');
// Log back in, set the custom 403 page to /user and remove the block
$this->drupalLogin($this->admin_user);
......
......@@ -28,6 +28,6 @@ public function testMetaTag() {
list($version, ) = explode('.', VERSION);
$string = '<meta name="Generator" content="Drupal ' . $version . ' (http://drupal.org)" />';
$this->drupalGet('node');
$this->assertRaw($string, t('Fingerprinting meta tag generated correctly.'), t('System'));
$this->assertRaw($string, 'Fingerprinting meta tag generated correctly.', t('System'));
}
}
......@@ -115,17 +115,17 @@ function testAdminPages() {
*/
function testCompactMode() {
$this->drupalGet('admin/compact/on');
$this->assertTrue($this->cookies['Drupal.visitor.admin_compact_mode']['value'], t('Compact mode turns on.'));
$this->assertTrue($this->cookies['Drupal.visitor.admin_compact_mode']['value'], 'Compact mode turns on.');
$this->drupalGet('admin/compact/on');
$this->assertTrue($this->cookies['Drupal.visitor.admin_compact_mode']['value'], t('Compact mode remains on after a repeat call.'));
$this->assertTrue($this->cookies['Drupal.visitor.admin_compact_mode']['value'], 'Compact mode remains on after a repeat call.');
$this->drupalGet('');
$this->assertTrue($this->cookies['Drupal.visitor.admin_compact_mode']['value'], t('Compact mode persists on new requests.'));
$this->assertTrue($this->cookies['Drupal.visitor.admin_compact_mode']['value'], 'Compact mode persists on new requests.');
$this->drupalGet('admin/compact/off');
$this->assertEqual($this->cookies['Drupal.visitor.admin_compact_mode']['value'], 'deleted', t('Compact mode turns off.'));
$this->assertEqual($this->cookies['Drupal.visitor.admin_compact_mode']['value'], 'deleted', 'Compact mode turns off.');
$this->drupalGet('admin/compact/off');
$this->assertEqual($this->cookies['Drupal.visitor.admin_compact_mode']['value'], 'deleted', t('Compact mode remains off after a repeat call.'));
$this->assertEqual($this->cookies['Drupal.visitor.admin_compact_mode']['value'], 'deleted', 'Compact mode remains off after a repeat call.');
$this->drupalGet('');
$this->assertTrue($this->cookies['Drupal.visitor.admin_compact_mode']['value'], t('Compact mode persists on new requests.'));
$this->assertTrue($this->cookies['Drupal.visitor.admin_compact_mode']['value'], 'Compact mode persists on new requests.');
}
}
......@@ -63,14 +63,14 @@ function testAutomaticCron() {
->set('threshold.autorun', $cron_safe_threshold)
->save();
$this->drupalGet('');
$this->assertTrue($cron_last == variable_get('cron_last', NULL), t('Cron does not run when the cron threshold is not passed.'));
$this->assertTrue($cron_last == variable_get('cron_last', NULL), 'Cron does not run when the cron threshold is not passed.');
// Test if cron runs when the cron threshold was passed.
$cron_last = time() - 200;
variable_set('cron_last', $cron_last);
$this->drupalGet('');
sleep(1);
$this->assertTrue($cron_last < variable_get('cron_last', NULL), t('Cron runs when the cron threshold is passed.'));
$this->assertTrue($cron_last < variable_get('cron_last', NULL), 'Cron runs when the cron threshold is passed.');
// Disable the cron threshold through the interface.
$admin_user = $this->drupalCreateUser(array('administer site configuration'));
......@@ -83,7 +83,7 @@ function testAutomaticCron() {
$cron_last = time() - 200;
variable_set('cron_last', $cron_last);
$this->drupalGet('');
$this->assertTrue($cron_last == variable_get('cron_last', NULL), t('Cron does not run when the cron threshold is disabled.'));
$this->assertTrue($cron_last == variable_get('cron_last', NULL), 'Cron does not run when the cron threshold is disabled.');
}
/**
......@@ -96,6 +96,6 @@ function testCronExceptions() {
// The common_test_cron_helper module sets the 'common_test_cron' variable.
$this->cronRun();
$result = variable_get('common_test_cron');
$this->assertEqual($result, 'success', t('Cron correctly handles exceptions thrown during hook_cron() invocations.'));
$this->assertEqual($result, 'success', 'Cron correctly handles exceptions thrown during hook_cron() invocations.');
}
}
......@@ -81,9 +81,9 @@ function testLocalizeDateFormats() {
// Configure format for the node posted date changes with the language.
$this->drupalGet('node/' . $node->nid);
$english_date = format_date($node->created, 'custom', 'j M Y');
$this->assertText($english_date, t('English date format appears'));
$this->assertText($english_date, 'English date format appears');
$this->drupalGet('fr/node/' . $node->nid);
$french_date = format_date($node->created, 'custom', 'd.m.Y');
$this->assertText($french_date, t('French date format appears'));
$this->assertText($french_date, 'French date format appears');
}
}
......@@ -56,18 +56,18 @@ function testTimeZoneHandling() {
// Confirm date format and time zone.
$this->drupalGet("node/$node1->nid");
$this->assertText('2007-01-31 21:00:00 -1000', t('Date should be identical, with GMT offset of -10 hours.'));
$this->assertText('2007-01-31 21:00:00 -1000', 'Date should be identical, with GMT offset of -10 hours.');
$this->drupalGet("node/$node2->nid");
$this->assertText('2007-07-31 21:00:00 -1000', t('Date should be identical, with GMT offset of -10 hours.'));
$this->assertText('2007-07-31 21:00:00 -1000', 'Date should be identical, with GMT offset of -10 hours.');
// Set time zone to Los Angeles time.
variable_set('date_default_timezone', 'America/Los_Angeles');
// Confirm date format and time zone.
$this->drupalGet("node/$node1->nid");
$this->assertText('2007-01-31 23:00:00 -0800', t('Date should be two hours ahead, with GMT offset of -8 hours.'));
$this->assertText('2007-01-31 23:00:00 -0800', 'Date should be two hours ahead, with GMT offset of -8 hours.');
$this->drupalGet("node/$node2->nid");
$this->assertText('2007-08-01 00:00:00 -0700', t('Date should be three hours ahead, with GMT offset of -7 hours.'));
$this->assertText('2007-08-01 00:00:00 -0700', 'Date should be three hours ahead, with GMT offset of -7 hours.');
}
/**
......@@ -90,7 +90,7 @@ function testDateTypeConfiguration() {
'date_format' => $date_format,
);
$this->drupalPost('admin/config/regional/date-time/types/add', $edit, t('Add date type'));
$this->assertEqual($this->getUrl(), url('admin/config/regional/date-time', array('absolute' => TRUE)), t('Correct page redirection.'));
$this->assertEqual($this->getUrl(), url('admin/config/regional/date-time', array('absolute' => TRUE)), 'Correct page redirection.');
$this->assertText(t('New date type added successfully.'), 'Date type added confirmation message appears.');
$this->assertText($date_type, 'Custom date type appears in the date type list.');
$this->assertText(t('delete'), 'Delete link for custom date type appears.');
......@@ -98,7 +98,7 @@ function testDateTypeConfiguration() {
// Delete custom date type.
$this->clickLink(t('delete'));
$this->drupalPost('admin/config/regional/date-time/types/' . $machine_name . '/delete', array(), t('Remove'));
$this->assertEqual($this->getUrl(), url('admin/config/regional/date-time', array('absolute' => TRUE)), t('Correct page redirection.'));
$this->assertEqual($this->getUrl(), url('admin/config/regional/date-time', array('absolute' => TRUE)), 'Correct page redirection.');
$this->assertText(t('Removed date type ' . $date_type), 'Custom date type removed.');
}
......@@ -116,7 +116,7 @@ function testDateFormatConfiguration() {
'date_format' => 'Y',
);
$this->drupalPost('admin/config/regional/date-time/formats/add', $edit, t('Add format'));
$this->assertEqual($this->getUrl(), url('admin/config/regional/date-time/formats', array('absolute' => TRUE)), t('Correct page redirection.'));
$this->assertEqual($this->getUrl(), url('admin/config/regional/date-time/formats', array('absolute' => TRUE)), 'Correct page redirection.');
$this->assertNoText(t('No custom date formats available.'), 'No custom date formats message does not appear.');
$this->assertText(t('Custom date format added.'), 'Custom date format added.');
......@@ -131,13 +131,13 @@ function testDateFormatConfiguration() {
'date_format' => 'Y m',
);
$this->drupalPost($this->getUrl(), $edit, t('Save format'));
$this->assertEqual($this->getUrl(), url('admin/config/regional/date-time/formats', array('absolute' => TRUE)), t('Correct page redirection.'));
$this->assertEqual($this->getUrl(), url('admin/config/regional/date-time/formats', array('absolute' => TRUE)), 'Correct page redirection.');
$this->assertText(t('Custom date format updated.'), 'Custom date format successfully updated.');
// Delete custom date format.
$this->clickLink(t('delete'));
$this->drupalPost($this->getUrl(), array(), t('Remove'));
$this->assertEqual($this->getUrl(), url('admin/config/regional/date-time/formats', array('absolute' => TRUE)), t('Correct page redirection.'));
$this->assertEqual($this->getUrl(), url('admin/config/regional/date-time/formats', array('absolute' => TRUE)), 'Correct page redirection.');
$this->assertText(t('Removed date format'), 'Custom date format removed successfully.');
}
......
......@@ -34,7 +34,7 @@ function setUp() {
public function testDefaultMetaTagsExist() {
$this->drupalGet('');
foreach ($this->default_metatags as $name => $metatag) {
$this->assertRaw($metatag, 'Default Mobile meta tag "' . $name . '" displayed properly.', t('System'));
$this->assertRaw($metatag, format_string('Default Mobile meta tag "@name" displayed properly.', array('@name' => $name)), t('System'));
}
}
......@@ -45,7 +45,7 @@ public function testRemovingDefaultMetaTags() {
module_enable(array('system_module_test'));
$this->drupalGet('');
foreach ($this->default_metatags as $name => $metatag) {
$this->assertNoRaw($metatag, 'Default Mobile meta tag "' . $name . '" removed properly.', t('System'));
$this->assertNoRaw($metatag, format_string('Default Mobile meta tag "@name" removed properly.', array('@name' => $name)), t('System'));
}
}
}
......@@ -56,7 +56,7 @@ function testErrorHandler() {
// Set error reporting to display verbose notices.
config('system.logging')->set('error_level', ERROR_REPORTING_DISPLAY_VERBOSE)->save();
$this->drupalGet('error-test/generate-warnings');
$this->assertResponse(200, t('Received expected HTTP status code.'));
$this->assertResponse(200, 'Received expected HTTP status code.');
$this->assertErrorMessage($error_notice);
$this->assertErrorMessage($error_warning);
$this->assertErrorMessage($error_user_notice);
......@@ -65,7 +65,7 @@ function testErrorHandler() {
// Set error reporting to collect notices.
$config->set('error_level', ERROR_REPORTING_DISPLAY_ALL)->save();
$this->drupalGet('error-test/generate-warnings');
$this->assertResponse(200, t('Received expected HTTP status code.'));
$this->assertResponse(200, 'Received expected HTTP status code.');
$this->assertErrorMessage($error_notice);
$this->assertErrorMessage($error_warning);
$this->assertErrorMessage($error_user_notice);
......@@ -74,7 +74,7 @@ function testErrorHandler() {
// Set error reporting to not collect notices.
$config->set('error_level', ERROR_REPORTING_DISPLAY_SOME)->save();
$this->drupalGet('error-test/generate-warnings');
$this->assertResponse(200, t('Received expected HTTP status code.'));
$this->assertResponse(200, 'Received expected HTTP status code.');
$this->assertNoErrorMessage($error_notice);
$this->assertErrorMessage($error_warning);
$this->assertErrorMessage($error_user_notice);
......@@ -83,7 +83,7 @@ function testErrorHandler() {
// Set error reporting to not show any errors.
$config->set('error_level', ERROR_REPORTING_HIDE)->save();
$this->drupalGet('error-test/generate-warnings');
$this->assertResponse(200, t('Received expected HTTP status code.'));
$this->assertResponse(200, 'Received expected HTTP status code.');
$this->assertNoErrorMessage($error_notice);
$this->assertNoErrorMessage($error_warning);
$this->assertNoErrorMessage($error_user_notice);
......@@ -110,17 +110,17 @@ function testExceptionHandler() {
);
$this->drupalGet('error-test/trigger-exception');
$this->assertTrue(strpos($this->drupalGetHeader(':status'), '500 Service unavailable (with message)'), t('Received expected HTTP status line.'));
$this->assertTrue(strpos($this->drupalGetHeader(':status'), '500 Service unavailable (with message)'), 'Received expected HTTP status line.');
$this->assertErrorMessage($error_exception);
$this->drupalGet('error-test/trigger-pdo-exception');
$this->assertTrue(strpos($this->drupalGetHeader(':status'), '500 Service unavailable (with message)'), t('Received expected HTTP status line.'));
$this->assertTrue(strpos($this->drupalGetHeader(':status'), '500 Service unavailable (with message)'), 'Received expected HTTP status line.');
// We cannot use assertErrorMessage() since the extact error reported
// varies from database to database. Check that the SQL string is displayed.
$this->assertText($error_pdo_exception['%type'], t('Found %type in error page.', $error_pdo_exception));
$this->assertText($error_pdo_exception['!message'], t('Found !message in error page.', $error_pdo_exception));
$error_details = t('in %function (line ', $error_pdo_exception);
$this->assertRaw($error_details, t("Found '!message' in error page.", array('!message' => $error_details)));
$this->assertText($error_pdo_exception['%type'], format_string('Found %type in error page.', $error_pdo_exception));
$this->assertText($error_pdo_exception['!message'], format_string('Found !message in error page.', $error_pdo_exception));
$error_details = format_string('in %function (line ', $error_pdo_exception);
$this->assertRaw($error_details, format_string("Found '!message' in error page.", array('!message' => $error_details)));
}
/**
......@@ -128,7 +128,7 @@ function testExceptionHandler() {
*/
function assertErrorMessage(array $error) {
$message = t('%type: !message in %function (line ', $error);
$this->assertRaw($message, t('Found error message: !message.', array('!message' => $message)));
$this->assertRaw($message, format_string('Found error message: !message.', array('!message' => $message)));
}
/**
......@@ -136,6 +136,6 @@ function assertErrorMessage(array $error) {
*/
function assertNoErrorMessage(array $error) {
$message = t('%type: !message in %function (line ', $error);
$this->assertNoRaw($message, t('Did not find error message: !message.', array('!message' => $message)));
$this->assertNoRaw($message, format_string('Did not find error message: !message.', array('!message' => $message)));
}
}
......@@ -48,11 +48,11 @@ function setUp() {
*/
function testDrupalIsFrontPage() {
$this->drupalGet('');
$this->assertText(t('On front page.'), t('Path is the front page.'));
$this->assertText(t('On front page.'), 'Path is the front page.');
$this->drupalGet('node');
$this->assertText(t('On front page.'), t('Path is the front page.'));
$this->assertText(t('On front page.'), 'Path is the front page.');
$this->drupalGet($this->node_path);
$this->assertNoText(t('On front page.'), t('Path is not the front page.'));
$this->assertNoText(t('On front page.'), 'Path is not the front page.');
// Change the front page to an invalid path.
$edit = array('site_frontpage' => 'kittens');
......@@ -62,13 +62,13 @@ function testDrupalIsFrontPage() {
// Change the front page to a valid path.
$edit['site_frontpage'] = $this->node_path;
$this->drupalPost('admin/config/system/site-information', $edit, t('Save configuration'));
$this->assertText(t('The configuration options have been saved.'), t('The front page path has been saved.'));
$this->assertText(t('The configuration options have been saved.'), 'The front page path has been saved.');
$this->drupalGet('');
$this->assertText(t('On front page.'), t('Path is the front page.'));
$this->assertText(t('On front page.'), 'Path is the front page.');
$this->drupalGet('node');
$this->assertNoText(t('On front page.'), t('Path is not the front page.'));
$this->assertNoText(t('On front page.'), 'Path is not the front page.');
$this->drupalGet($this->node_path);
$this->assertText(t('On front page.'), t('Path is the front page.'));
$this->assertText(t('On front page.'), 'Path is the front page.');
}
}
......@@ -32,9 +32,9 @@ function testIndexPhpHandling() {
$index_php = $GLOBALS['base_url'] . '/index.php';
$this->drupalGet($index_php, array('external' => TRUE));
$this->assertResponse(200, t('Make sure index.php returns a valid page.'));
$this->assertResponse(200, 'Make sure index.php returns a valid page.');
$this->drupalGet($index_php .'/user', array('external' => TRUE));
$this->assertResponse(200, t("Make sure index.php/user returns a valid page."));
$this->assertResponse(200, 'Make sure index.php/user returns a valid page.');
}
}
......@@ -32,31 +32,31 @@ function testSystemInfoAlter() {
// Enable seven and the test module.
theme_enable(array('seven'));
module_enable(array('module_test'), FALSE);
$this->assertTrue(module_exists('module_test'), t('Test module is enabled.'));
$this->assertTrue(module_exists('module_test'), 'Test module is enabled.');
// Verify that the rebuilt and altered theme info is returned.
$info = system_get_info('theme', 'seven');
$this->assertTrue(isset($info['regions']['test_region']), t('Altered theme info was returned by system_get_info().'));
$this->assertTrue(isset($info['regions']['test_region']), 'Altered theme info was returned by system_get_info().');
$seven_regions = system_region_list('seven');
$this->assertTrue(isset($seven_regions['test_region']), t('Altered theme info was returned by system_region_list().'));
$this->assertTrue(isset($seven_regions['test_region']), 'Altered theme info was returned by system_region_list().');
$system_list_themes = system_list('theme');
$info = $system_list_themes['seven']->info;
$this->assertTrue(isset($info['regions']['test_region']), t('Altered theme info was returned by system_list().'));
$this->assertTrue(isset($info['regions']['test_region']), 'Altered theme info was returned by system_list().');
$list_themes = list_themes();
$this->assertTrue(isset($list_themes['seven']->info['regions']['test_region']), t('Altered theme info was returned by list_themes().'));
$this->assertTrue(isset($list_themes['seven']->info['regions']['test_region']), 'Altered theme info was returned by list_themes().');
// Disable the module and verify that rebuilt .info does not contain it.
module_disable(array('module_test'), FALSE);
$this->assertFalse(module_exists('module_test'), t('Test module is disabled.'));
$this->assertFalse(module_exists('module_test'), 'Test module is disabled.');
$info = system_get_info('theme', 'seven');
$this->assertFalse(isset($info['regions']['test_region']), t('Altered theme info was not returned by system_get_info().'));
$this->assertFalse(isset($info['regions']['test_region']), 'Altered theme info was not returned by system_get_info().');
$seven_regions = system_region_list('seven');
$this->assertFalse(isset($seven_regions['test_region']), t('Altered theme info was not returned by system_region_list().'));
$this->assertFalse(isset($seven_regions['test_region']), 'Altered theme info was not returned by system_region_list().');
$system_list_themes = system_list('theme');
$info = $system_list_themes['seven']->info;
$this->assertFalse(isset($info['regions']['test_region']), t('Altered theme info was not returned by system_list().'));
$this->assertFalse(isset($info['regions']['test_region']), 'Altered theme info was not returned by system_list().');
$list_themes = list_themes();
$this->assertFalse(isset($list_themes['seven']->info['regions']['test_region']), t('Altered theme info was not returned by list_themes().'));
$this->assertFalse(isset($list_themes['seven']->info['regions']['test_region']), 'Altered theme info was not returned by list_themes().');
}
}
......@@ -68,14 +68,14 @@ function testDrupalParseInfoFormat() {
$parsed = drupal_parse_info_format($config);
$this->assertEqual($parsed['simple'], $expected['simple'], t('Set a simple value.'));
$this->assertEqual($parsed['quoted'], $expected['quoted'], t('Set a simple value in quotes.'));
$this->assertEqual($parsed['multiline'], $expected['multiline'], t('Set a multiline value.'));
$this->assertEqual($parsed['array'], $expected['array'], t('Set a simple array.'));
$this->assertEqual($parsed['array_assoc'], $expected['array_assoc'], t('Set an associative array.'));
$this->assertEqual($parsed['array_deep'], $expected['array_deep'], t('Set a nested array.'));
$this->assertEqual($parsed['array_deep_assoc'], $expected['array_deep_assoc'], t('Set a nested associative array.'));
$this->assertEqual($parsed['array_space'], $expected['array_space'], t('Set an array with a whitespace in the key.'));
$this->assertEqual($parsed, $expected, t('Entire parsed .info string and expected array are identical.'));
$this->assertEqual($parsed['simple'], $expected['simple'], 'Set a simple value.');
$this->assertEqual($parsed['quoted'], $expected['quoted'], 'Set a simple value in quotes.');
$this->assertEqual($parsed['multiline'], $expected['multiline'], 'Set a multiline value.');
$this->assertEqual($parsed['array'], $expected['array'], 'Set a simple array.');
$this->assertEqual($parsed['array_assoc'], $expected['array_assoc'], 'Set an associative array.');
$this->assertEqual($parsed['array_deep'], $expected['array_deep'], 'Set a nested array.');
$this->assertEqual($parsed['array_deep_assoc'], $expected['array_deep_assoc'], 'Set a nested associative array.');
$this->assertEqual($parsed['array_space'], $expected['array_space'], 'Set an array with a whitespace in the key.');
$this->assertEqual($parsed, $expected, 'Entire parsed .info string and expected array are identical.');
}
}
......@@ -55,42 +55,42 @@ function testMainContentFallback() {
// Disable the block module.
$edit['modules[Core][block][enable]'] = FALSE;
$this->drupalPost('admin/modules', $edit, t('Save configuration'));
$this->assertText(t('The configuration options have been saved.'), t('Modules status has been updated.'));
$this->assertText(t('The configuration options have been saved.'), 'Modules status has been updated.');
system_list_reset();
$this->assertFalse(module_exists('block'), t('Block module disabled.'));
$this->assertFalse(module_exists('block'), 'Block module disabled.');
// At this point, no region is filled and fallback should be triggered.
$this->drupalGet('admin/config/system/site-information');
$this->assertField('site_name', t('Admin interface still available.'));
$this->assertField('site_name', 'Admin interface still available.');
// Fallback should not trigger when another module is handling content.
$this->drupalGet('system-test/main-content-handling');
$this->assertRaw('id="system-test-content"', t('Content handled by another module'));
$this->assertText(t('Content to test main content fallback'), t('Main content still displayed.'));
$this->assertRaw('id="system-test-content"', 'Content handled by another module');
$this->assertText(t('Content to test main content fallback'), 'Main content still displayed.');
// Fallback should trigger when another module
// indicates that it is not handling the content.
$this->drupalGet('system-test/main-content-fallback');
$this->assertText(t('Content to test main content fallback'), t('Main content fallback properly triggers.'));
$this->assertText(t('Content to test main content fallback'), 'Main content fallback properly triggers.');
// Fallback should not trigger when another module is handling content.
// Note that this test ensures that no duplicate
// content gets created by the fallback.
$this->drupalGet('system-test/main-content-duplication');
$this->assertNoText(t('Content to test main content fallback'), t('Main content not duplicated.'));
$this->assertNoText(t('Content to test main content fallback'), 'Main content not duplicated.');
// Request a user* page and see if it is displayed.
$this->drupalLogin($this->web_user);
$this->drupalGet('user/' . $this->web_user->uid . '/edit');
$this->assertField('mail', t('User interface still available.'));
$this->assertField('mail', 'User interface still available.');
// Enable the block module again.
$this->drupalLogin($this->admin_user);
$edit = array();
$edit['modules[Core][block][enable]'] = 'block';
$this->drupalPost('admin/modules', $edit, t('Save configuration'));
$this->assertText(t('The configuration options have been saved.'), t('Modules status has been updated.'));
$this->assertText(t('The configuration options have been saved.'), 'Modules status has been updated.');
system_list_reset();
$this->assertTrue(module_exists('block'), t('Block module re-enabled.'));
$this->assertTrue(module_exists('block'), 'Block module re-enabled.');
}
}
......@@ -33,7 +33,7 @@ function setUp() {
function testPageNotFound() {
$this->drupalLogin($this->admin_user);
$this->drupalGet($this->randomName(10));
$this->assertText(t('Page not found'), t('Found the default 404 page'));
$this->assertText(t('Page not found'), 'Found the default 404 page');
// Use a custom 404 page.
$edit = array(
......@@ -42,6 +42,6 @@ function testPageNotFound() {
$this->drupalPost('admin/config/system/site-information', $edit, t('Save configuration'));
$this->drupalGet($this->randomName(10));
$this->assertText($this->admin_user->name, t('Found the custom 404 page'));
$this->assertText($this->admin_user->name, 'Found the custom 404 page');
}
}
......@@ -63,11 +63,11 @@ function testTitleTags() {
// drupal_set_title's $filter is CHECK_PLAIN by default, so the title should be
// returned with check_plain().
drupal_set_title($title, CHECK_PLAIN);
$this->assertTrue(strpos(drupal_get_title(), '<em>') === FALSE, t('Tags in title converted to entities when $output is CHECK_PLAIN.'));
$this->assertTrue(strpos(drupal_get_title(), '<em>') === FALSE, 'Tags in title converted to entities when $output is CHECK_PLAIN.');
// drupal_set_title's $filter is passed as PASS_THROUGH, so the title should be
// returned with HTML.
drupal_set_title($title, PASS_THROUGH);
$this->assertTrue(strpos(drupal_get_title(), '<em>') !== FALSE, t('Tags in title are not converted to entities when $output is PASS_THROUGH.'));
$this->assertTrue(strpos(drupal_get_title(), '<em>') !== FALSE, 'Tags in title are not converted to entities when $output is PASS_THROUGH.');
// Generate node content.
$langcode = LANGUAGE_NOT_SPECIFIED;
$edit = array(
......
......@@ -37,26 +37,26 @@ function testPasswordHashing() {
$password = 'baz';
$account = (object) array('name' => 'foo', 'pass' => md5($password));
// The md5 password should be flagged as needing an update.
$this->assertTrue(user_needs_new_hash($account), t('User with md5 password needs a new hash.'));
$this->assertTrue(user_needs_new_hash($account), 'User with md5 password needs a new hash.');
// Re-hash the password.
$old_hash = $account->pass;
$account->pass = user_hash_password($password);
$this->assertIdentical(_password_get_count_log2($account->pass), DRUPAL_MIN_HASH_COUNT, t('Re-hashed password has the minimum number of log2 iterations.'));
$this->assertTrue($account->pass != $old_hash, t('Password hash changed.'));
$this->assertTrue(user_check_password($password, $account), t('Password check succeeds.'));
$this->assertIdentical(_password_get_count_log2($account->pass), DRUPAL_MIN_HASH_COUNT, 'Re-hashed password has the minimum number of log2 iterations.');
$this->assertTrue($account->pass != $old_hash, 'Password hash changed.');
$this->assertTrue(user_check_password($password, $account), 'Password check succeeds.');
// Since the log2 setting hasn't changed and the user has a valid password,
// user_needs_new_hash() should return FALSE.
$this->assertFalse(user_needs_new_hash($account), t('User does not need a new hash.'));
$this->assertFalse(user_needs_new_hash($account), 'User does not need a new hash.');
// Increment the log2 iteration to MIN + 1.
variable_set('password_count_log2', DRUPAL_MIN_HASH_COUNT + 1);
$this->assertTrue(user_needs_new_hash($account), t('User needs a new hash after incrementing the log2 count.'));
$this->assertTrue(user_needs_new_hash($account), 'User needs a new hash after incrementing the log2 count.');
// Re-hash the password.
$old_hash = $account->pass;
$account->pass = user_hash_password($password);
$this->assertIdentical(_password_get_count_log2($account->pass), DRUPAL_MIN_HASH_COUNT + 1, t('Re-hashed password has the correct number of log2 iterations.'));
$this->assertTrue($account->pass != $old_hash, t('Password hash changed again.'));
$this->assertIdentical(_password_get_count_log2($account->pass), DRUPAL_MIN_HASH_COUNT + 1, 'Re-hashed password has the correct number of log2 iterations.');
$this->assertTrue($account->pass != $old_hash, 'Password hash changed again.');
// Now the hash should be OK.
$this->assertFalse(user_needs_new_hash($account), t('Re-hashed password does not need a new hash.'));
$this->assertTrue(user_check_password($password, $account), t('Password check succeeds with re-hashed password.'));
$this->assertFalse(user_needs_new_hash($account), 'Re-hashed password does not need a new hash.');
$this->assertTrue(user_check_password($password, $account), 'Password check succeeds with re-hashed password.');
}
}
......@@ -30,7 +30,7 @@ function testFileRetrieving() {
$filename = 'Файл для тестирования ' . $this->randomName();
$url = file_create_url($sourcedir . '/' . $filename);
$retrieved_file = system_retrieve_file($url);
$this->assertFalse($retrieved_file, t('Non-existent file not fetched.'));
$this->assertFalse($retrieved_file, 'Non-existent file not fetched.');
// Actually create that file, download it via HTTP and test the returned path.
file_put_contents($sourcedir . '/' . $filename, 'testing');
......@@ -40,17 +40,17 @@ function testFileRetrieving() {
// has to be encoded.
$encoded_filename = rawurlencode($filename);
$this->assertEqual($retrieved_file, 'public://' . $encoded_filename, t('Sane path for downloaded file returned (public:// scheme).'));
$this->assertTrue(is_file($retrieved_file), t('Downloaded file does exist (public:// scheme).'));
$this->assertEqual(filesize($retrieved_file), 7, t('File size of downloaded file is correct (public:// scheme).'));
$this->assertEqual($retrieved_file, 'public://' . $encoded_filename, 'Sane path for downloaded file returned (public:// scheme).');
$this->assertTrue(is_file($retrieved_file), 'Downloaded file does exist (public:// scheme).');
$this->assertEqual(filesize($retrieved_file), 7, 'File size of downloaded file is correct (public:// scheme).');
file_unmanaged_delete($retrieved_file);
// Test downloading file to a different location.
drupal_mkdir($targetdir = 'temporary://' . $this->randomName());
$retrieved_file = system_retrieve_file($url, $targetdir);
$this->assertEqual($retrieved_file, "$targetdir/$encoded_filename", t('Sane path for downloaded file returned (temporary:// scheme).'));
$this->assertTrue(is_file($retrieved_file), t('Downloaded file does exist (temporary:// scheme).'));
$this->assertEqual(filesize($retrieved_file), 7, t('File size of downloaded file is correct (temporary:// scheme).'));
$this->assertEqual($retrieved_file, "$targetdir/$encoded_filename", 'Sane path for downloaded file returned (temporary:// scheme).');
$this->assertTrue(is_file($retrieved_file), 'Downloaded file does exist (temporary:// scheme).');
$this->assertEqual(filesize($retrieved_file), 7, 'File size of downloaded file is correct (temporary:// scheme).');
file_unmanaged_delete($retrieved_file);
file_unmanaged_delete_recursive($sourcedir);
......
......@@ -59,7 +59,7 @@ function testSiteMaintenance() {
$offline_message = t('@site is currently under maintenance. We should be back shortly. Thank you for your patience.', array('@site' => config('system.site')->get('name')));
$this->drupalGet('');
$this->assertRaw($admin_message, t('Found the site maintenance mode message.'));
$this->assertRaw($admin_message, 'Found the site maintenance mode message.');