Commit 8e2d696c authored by jhodgdon's avatar jhodgdon

Issue #1797452 by Lars Toomre: Remove t() from system tests starting with M

parent e7ac4295
......@@ -55,7 +55,7 @@ public function testPluggableFramework() {
$message = drupal_mail('simpletest', 'mail_test', 'testing@example.com', $language_interface->langcode);
// Assert whether the message was sent through the send function.
$this->assertEqual(self::$sent_message['to'], 'testing@example.com', t('Pluggable mail system is extendable.'));
$this->assertEqual(self::$sent_message['to'], 'testing@example.com', 'Pluggable mail system is extendable.');
}
/**
......
......@@ -82,7 +82,7 @@ function assertMenuLinkParents($links, $expected_hierarchy) {
$menu_link = menu_link_load($mlid);
menu_link_save($menu_link);
$this->assertEqual($menu_link['plid'], $plid, t('Menu link %mlid has parent of %plid, expected %expected_plid.', array('%mlid' => $mlid, '%plid' => $menu_link['plid'], '%expected_plid' => $plid)));
$this->assertEqual($menu_link['plid'], $plid, format_string('Menu link %mlid has parent of %plid, expected %expected_plid.', array('%mlid' => $mlid, '%plid' => $menu_link['plid'], '%expected_plid' => $plid)));
}
}
......
......@@ -45,7 +45,7 @@ protected function assertBreadcrumb($goto, array $trail, $page_title = NULL, arr
// No parts must be left, or an expected "Home" will always pass.
$pass = ($pass && empty($parts));
$this->assertTrue($pass, t('Breadcrumb %parts found on @path.', array(
$this->assertTrue($pass, format_string('Breadcrumb %parts found on @path.', array(
'%parts' => implode(' » ', $trail),
'@path' => $this->getUrl(),
)));
......@@ -75,7 +75,7 @@ protected function assertBreadcrumb($goto, array $trail, $page_title = NULL, arr
$i++;
}
$elements = $this->xpath($xpath);
$this->assertTrue(!empty($elements), t('Active trail to current page was found in menu tree.'));
$this->assertTrue(!empty($elements), 'Active trail to current page was found in menu tree.');
// Append prefix for active link asserted below.
$xpath .= '/following-sibling::ul/descendant::';
......@@ -92,7 +92,7 @@ protected function assertBreadcrumb($goto, array $trail, $page_title = NULL, arr
':title' => $active_link_title,
);
$elements = $this->xpath($xpath, $args);
$this->assertTrue(!empty($elements), t('Active link %title was found in menu tree, including active trail links %tree.', array(
$this->assertTrue(!empty($elements), format_string('Active link %title was found in menu tree, including active trail links %tree.', array(
'%title' => $active_link_title,
'%tree' => implode(' » ', $tree),
)));
......
......@@ -27,14 +27,14 @@ public static function getInfo() {
function testMenuRebuildByVariable() {
// Check if 'admin' path exists.
$admin_exists = db_query('SELECT path from {menu_router} WHERE path = :path', array(':path' => 'admin'))->fetchField();
$this->assertEqual($admin_exists, 'admin', t("The path 'admin/' exists prior to deleting."));
$this->assertEqual($admin_exists, 'admin', "The path 'admin/' exists prior to deleting.");
// Delete the path item 'admin', and test that the path doesn't exist in the database.
$delete = db_delete('menu_router')
->condition('path', 'admin')
->execute();
$admin_exists = db_query('SELECT path from {menu_router} WHERE path = :path', array(':path' => 'admin'))->fetchField();
$this->assertFalse($admin_exists, t("The path 'admin/' has been deleted and doesn't exist in the database."));
$this->assertFalse($admin_exists, "The path 'admin/' has been deleted and doesn't exist in the database.");
// Now we enable the rebuild variable and send a request to rebuild the menu
// item. Now 'admin' should exist.
......@@ -42,7 +42,7 @@ function testMenuRebuildByVariable() {
// The request should trigger the rebuild.
$this->drupalGet('<front>');
$admin_exists = db_query('SELECT path from {menu_router} WHERE path = :path', array(':path' => 'admin'))->fetchField();
$this->assertEqual($admin_exists, 'admin', t("The menu has been rebuilt, the path 'admin' now exists again."));
$this->assertEqual($admin_exists, 'admin', "The menu has been rebuilt, the path 'admin' now exists again.");
}
}
......@@ -178,13 +178,13 @@ function testCustom403And404Pages() {
// Check that the initial trail (during the Drupal bootstrap) matches
// what we expect.
$initial_trail = variable_get('menu_test_active_trail_initial', array());
$this->assertEqual(count($initial_trail), count($expected_trail[$status_code]['initial']), t('The initial active trail for a @status_code page contains the expected number of items (expected: @expected, found: @found).', array(
$this->assertEqual(count($initial_trail), count($expected_trail[$status_code]['initial']), format_string('The initial active trail for a @status_code page contains the expected number of items (expected: @expected, found: @found).', array(
'@status_code' => $status_code,
'@expected' => count($expected_trail[$status_code]['initial']),
'@found' => count($initial_trail),
)));
foreach (array_keys($expected_trail[$status_code]['initial']) as $index => $path) {
$this->assertEqual($initial_trail[$index]['href'], $path, t('Element number @number of the initial active trail for a @status_code page contains the correct path (expected: @expected, found: @found)', array(
$this->assertEqual($initial_trail[$index]['href'], $path, format_string('Element number @number of the initial active trail for a @status_code page contains the correct path (expected: @expected, found: @found)', array(
'@number' => $index + 1,
'@status_code' => $status_code,
'@expected' => $path,
......@@ -195,13 +195,13 @@ function testCustom403And404Pages() {
// Check that the final trail (after the user has been redirected to the
// custom 403/404 page) matches what we expect.
$final_trail = variable_get('menu_test_active_trail_final', array());
$this->assertEqual(count($final_trail), count($expected_trail[$status_code]['final']), t('The final active trail for a @status_code page contains the expected number of items (expected: @expected, found: @found).', array(
$this->assertEqual(count($final_trail), count($expected_trail[$status_code]['final']), format_string('The final active trail for a @status_code page contains the expected number of items (expected: @expected, found: @found).', array(
'@status_code' => $status_code,
'@expected' => count($expected_trail[$status_code]['final']),
'@found' => count($final_trail),
)));
foreach (array_keys($expected_trail[$status_code]['final']) as $index => $path) {
$this->assertEqual($final_trail[$index]['href'], $path, t('Element number @number of the final active trail for a @status_code page contains the correct path (expected: @expected, found: @found)', array(
$this->assertEqual($final_trail[$index]['href'], $path, format_string('Element number @number of the final active trail for a @status_code page contains the correct path (expected: @expected, found: @found)', array(
'@number' => $index + 1,
'@status_code' => $status_code,
'@expected' => $path,
......
......@@ -39,12 +39,12 @@ function testMenuTreeData() {
$tree = menu_tree_data($this->links);
// Validate that parent items #1, #2, and #5 exist on the root level.
$this->assertSameLink($this->links[1], $tree[1]['link'], t('Parent item #1 exists.'));
$this->assertSameLink($this->links[2], $tree[2]['link'], t('Parent item #2 exists.'));
$this->assertSameLink($this->links[5], $tree[5]['link'], t('Parent item #5 exists.'));
$this->assertSameLink($this->links[1], $tree[1]['link'], 'Parent item #1 exists.');
$this->assertSameLink($this->links[2], $tree[2]['link'], 'Parent item #2 exists.');
$this->assertSameLink($this->links[5], $tree[5]['link'], 'Parent item #5 exists.');
// Validate that child item #4 exists at the correct location in the hierarchy.
$this->assertSameLink($this->links[4], $tree[2]['below'][3]['below'][4]['link'], t('Child item #4 exists in the hierarchy.'));
$this->assertSameLink($this->links[4], $tree[2]['below'][3]['below'][4]['link'], 'Child item #4 exists in the hierarchy.');
}
/**
......@@ -60,6 +60,6 @@ function testMenuTreeData() {
* TRUE if the assertion succeeded, FALSE otherwise.
*/
protected function assertSameLink($link1, $link2, $message = '') {
return $this->assert($link1['mlid'] == $link2['mlid'], $message ? $message : t('First link is identical to second link'));
return $this->assert($link1['mlid'] == $link2['mlid'], $message ?: 'First link is identical to second link');
}
}
......@@ -54,15 +54,15 @@ function testMenuTreeData() {
$output = menu_tree_output($this->tree_data);
// Validate that the - in main-menu is changed into an underscore
$this->assertEqual( $output['1']['#theme'], 'menu_link__main_menu', t('Hyphen is changed to a dash on menu_link'));
$this->assertEqual( $output['#theme_wrappers'][0], 'menu_tree__main_menu', t('Hyphen is changed to a dash on menu_tree wrapper'));
$this->assertEqual( $output['1']['#theme'], 'menu_link__main_menu', 'Hyphen is changed to a dash on menu_link');
$this->assertEqual( $output['#theme_wrappers'][0], 'menu_tree__main_menu', 'Hyphen is changed to a dash on menu_tree wrapper');
// Looking for child items in the data
$this->assertEqual( $output['1']['#below']['2']['#href'], 'a/b', t('Checking the href on a child item'));
$this->assertTrue( in_array('active-trail',$output['1']['#below']['2']['#attributes']['class']) , t('Checking the active trail class'));
$this->assertEqual( $output['1']['#below']['2']['#href'], 'a/b', 'Checking the href on a child item');
$this->assertTrue( in_array('active-trail',$output['1']['#below']['2']['#attributes']['class']) , 'Checking the active trail class');
// Validate that the hidden and no access items are missing
$this->assertFalse( isset($output['5']), t('Hidden item should be missing'));
$this->assertFalse( isset($output['6']), t('False access should be missing'));
$this->assertFalse( isset($output['5']), 'Hidden item should be missing');
$this->assertFalse( isset($output['6']), 'False access should be missing');
// Item 7 is after a couple hidden items. Just to make sure that 5 and 6 are skipped and 7 still included
$this->assertTrue( isset($output['7']), t('Item after hidden items is present'));
$this->assertTrue( isset($output['7']), 'Item after hidden items is present');
}
}
......@@ -32,7 +32,7 @@ function testClassLoading() {
// Check twice to test an unprimed and primed system_list() cache.
for ($i=0; $i<2; $i++) {
$this->drupalGet('module-test/class-loading');
$this->assertText($expected, t('Autoloader loads classes from an enabled module.'));
$this->assertText($expected, 'Autoloader loads classes from an enabled module.');
}
module_disable(array('module_autoload_test'), FALSE);
......@@ -40,7 +40,7 @@ function testClassLoading() {
// Check twice to test an unprimed and primed system_list() cache.
for ($i=0; $i<2; $i++) {
$this->drupalGet('module-test/class-loading');
$this->assertNoText($expected, t('Autoloader does not load classes from a disabled module.'));
$this->assertNoText($expected, 'Autoloader does not load classes from a disabled module.');
}
}
}
......@@ -27,7 +27,7 @@ function testEnableWithoutDependency() {
$edit = array();
$edit['modules[Core][translation][enable]'] = 'translation';
$this->drupalPost('admin/modules', $edit, t('Save configuration'));
$this->assertText(t('Some required modules must be enabled'), t('Dependency required.'));
$this->assertText(t('Some required modules must be enabled'), 'Dependency required.');
$this->assertModules(array('translation', 'locale', 'language'), FALSE);
......@@ -35,7 +35,7 @@ function testEnableWithoutDependency() {
$this->assertTableCount('language', FALSE);
$this->drupalPost(NULL, NULL, t('Continue'));
$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.');
$this->assertModules(array('translation', 'language'), TRUE);
......@@ -50,9 +50,9 @@ function testMissingModules() {
// Test that the system_dependencies_test module is marked
// as missing a dependency.
$this->drupalGet('admin/modules');
$this->assertRaw(t('@module (<span class="admin-missing">missing</span>)', array('@module' => drupal_ucfirst('_missing_dependency'))), t('A module with missing dependencies is marked as such.'));
$this->assertRaw(t('@module (<span class="admin-missing">missing</span>)', array('@module' => drupal_ucfirst('_missing_dependency'))), 'A module with missing dependencies is marked as such.');
$checkbox = $this->xpath('//input[@type="checkbox" and @disabled="disabled" and @name="modules[Testing][system_dependencies_test][enable]"]');
$this->assert(count($checkbox) == 1, t('Checkbox for the module is disabled.'));
$this->assert(count($checkbox) == 1, 'Checkbox for the module is disabled.');
// Force enable the system_dependencies_test module.
module_enable(array('system_dependencies_test'), FALSE);
......@@ -60,7 +60,7 @@ function testMissingModules() {
// Verify that the module is forced to be disabled when submitting
// the module page.
$this->drupalPost('admin/modules', array(), t('Save configuration'));
$this->assertText(t('The @module module is missing, so the following module will be disabled: @depends.', array('@module' => '_missing_dependency', '@depends' => 'system_dependencies_test')), t('The module missing dependencies will be disabled.'));
$this->assertText(t('The @module module is missing, so the following module will be disabled: @depends.', array('@module' => '_missing_dependency', '@depends' => 'system_dependencies_test')), 'The module missing dependencies will be disabled.');
// Confirm.
$this->drupalPost(NULL, NULL, t('Continue'));
......@@ -81,7 +81,7 @@ function testIncompatibleModuleVersionDependency() {
'@version' => '1.0',
)), 'A module that depends on an incompatible version of a module is marked as such.');
$checkbox = $this->xpath('//input[@type="checkbox" and @disabled="disabled" and @name="modules[Testing][system_incompatible_module_version_dependencies_test][enable]"]');
$this->assert(count($checkbox) == 1, t('Checkbox for the module is disabled.'));
$this->assert(count($checkbox) == 1, 'Checkbox for the module is disabled.');
}
/**
......@@ -95,7 +95,7 @@ function testIncompatibleCoreVersionDependency() {
'@module' => 'System incompatible core version test',
)), 'A module that depends on a module with an incompatible core version is marked as such.');
$checkbox = $this->xpath('//input[@type="checkbox" and @disabled="disabled" and @name="modules[Testing][system_incompatible_core_version_dependencies_test][enable]"]');
$this->assert(count($checkbox) == 1, t('Checkbox for the module is disabled.'));
$this->assert(count($checkbox) == 1, 'Checkbox for the module is disabled.');
}
/**
......@@ -114,7 +114,7 @@ function testEnableRequirementsFailureDependency() {
$this->drupalPost('admin/modules', $edit, t('Save configuration'));
// Makes sure the modules were NOT installed.
$this->assertText(t('Requirements 1 Test failed requirements'), t('Modules status has been updated.'));
$this->assertText(t('Requirements 1 Test failed requirements'), 'Modules status has been updated.');
$this->assertModules(array('requirements1_test'), FALSE);
$this->assertModules(array('requirements2_test'), FALSE);
......@@ -180,17 +180,17 @@ function testUninstallDependents() {
// Check that the taxonomy module cannot be uninstalled.
$this->drupalGet('admin/modules/uninstall');
$checkbox = $this->xpath('//input[@type="checkbox" and @disabled="disabled" and @name="uninstall[comment]"]');
$this->assert(count($checkbox) == 1, t('Checkbox for uninstalling the comment module is disabled.'));
$this->assert(count($checkbox) == 1, 'Checkbox for uninstalling the comment module is disabled.');
// Uninstall the forum module, and check that taxonomy now can also be
// uninstalled.
$edit = array('uninstall[forum]' => 'forum');
$this->drupalPost('admin/modules/uninstall', $edit, t('Uninstall'));
$this->drupalPost(NULL, NULL, t('Uninstall'));
$this->assertText(t('The selected modules have been uninstalled.'), t('Modules status has been updated.'));
$this->assertText(t('The selected modules have been uninstalled.'), 'Modules status has been updated.');
$edit = array('uninstall[comment]' => 'comment');
$this->drupalPost('admin/modules/uninstall', $edit, t('Uninstall'));
$this->drupalPost(NULL, NULL, t('Uninstall'));
$this->assertText(t('The selected modules have been uninstalled.'), t('Modules status has been updated.'));
$this->assertText(t('The selected modules have been uninstalled.'), 'Modules status has been updated.');
}
}
......@@ -47,7 +47,7 @@ function testEnableDisable() {
}
}
$this->assertTrue(count($modules), t('Found @count modules that can be enabled: %modules', array(
$this->assertTrue(count($modules), format_string('Found @count modules that can be enabled: %modules', array(
'@count' => count($modules),
'%modules' => implode(', ', array_keys($modules)),
)));
......@@ -95,7 +95,7 @@ function testEnableDisable() {
if (count($modules_to_enable) > 1) {
$this->drupalPost(NULL, array(), t('Continue'));
}
$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.');
// Check that hook_modules_installed() and hook_modules_enabled() were
// invoked with the expected list of modules, that each module's
......@@ -162,7 +162,7 @@ function testEnableDisable() {
$edit['modules[Core][' . $name . '][enable]'] = $name;
}
$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.');
}
/**
......@@ -176,7 +176,7 @@ function assertSuccessfulDisableAndUninstall($module) {
$edit = array();
$edit['modules[Core][' . $module . '][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.');
$this->assertModules(array($module), FALSE);
// Check that the appropriate hook was fired and the appropriate log
......@@ -194,7 +194,7 @@ function assertSuccessfulDisableAndUninstall($module) {
$edit['uninstall[' . $module . ']'] = $module;
$this->drupalPost('admin/modules/uninstall', $edit, t('Uninstall'));
$this->drupalPost(NULL, NULL, t('Uninstall'));
$this->assertText(t('The selected modules have been uninstalled.'), t('Modules status has been updated.'));
$this->assertText(t('The selected modules have been uninstalled.'), 'Modules status has been updated.');
$this->assertModules(array($module), FALSE);
// Check that the appropriate hook was fired and the appropriate log
......
......@@ -31,7 +31,7 @@ function testHookRequirementsFailure() {
$this->drupalPost('admin/modules', $edit, t('Save configuration'));
// Makes sure the module was NOT installed.
$this->assertText(t('Requirements 1 Test failed requirements'), t('Modules status has been updated.'));
$this->assertText(t('Requirements 1 Test failed requirements'), 'Modules status has been updated.');
$this->assertModules(array('requirements1_test'), FALSE);
}
}
......@@ -45,7 +45,7 @@ function testDrupalWriteRecord() {
// Check for data that was inserted using drupal_write_record() while the
// 'module_test' module was being installed and enabled.
$data = db_query("SELECT data FROM {module_test}")->fetchCol();
$this->assertTrue(in_array('Data inserted in hook_install()', $data), t('Data inserted using drupal_write_record() in hook_install() is correctly saved.'));
$this->assertTrue(in_array('Data inserted in hook_enable()', $data), t('Data inserted using drupal_write_record() in hook_enable() is correctly saved.'));
$this->assertTrue(in_array('Data inserted in hook_install()', $data), 'Data inserted using drupal_write_record() in hook_install() is correctly saved.');
$this->assertTrue(in_array('Data inserted in hook_enable()', $data), 'Data inserted using drupal_write_record() in hook_enable() is correctly saved.');
}
}
......@@ -45,9 +45,9 @@ function assertTableCount($base_table, $count = TRUE) {
$tables = db_find_tables(Database::getConnection()->prefixTables('{' . $base_table . '}') . '%');
if ($count) {
return $this->assertTrue($tables, t('Tables matching "@base_table" found.', array('@base_table' => $base_table)));
return $this->assertTrue($tables, format_string('Tables matching "@base_table" found.', array('@base_table' => $base_table)));
}
return $this->assertFalse($tables, t('Tables matching "@base_table" not found.', array('@base_table' => $base_table)));
return $this->assertFalse($tables, format_string('Tables matching "@base_table" not found.', array('@base_table' => $base_table)));
}
/**
......@@ -64,7 +64,7 @@ function assertModuleTablesExist($module) {
$tables_exist = FALSE;
}
}
return $this->assertTrue($tables_exist, t('All database tables defined by the @module module exist.', array('@module' => $module)));
return $this->assertTrue($tables_exist, format_string('All database tables defined by the @module module exist.', array('@module' => $module)));
}
/**
......@@ -81,7 +81,7 @@ function assertModuleTablesDoNotExist($module) {
$tables_exist = TRUE;
}
}
return $this->assertFalse($tables_exist, t('None of the database tables defined by the @module module exist.', array('@module' => $module)));
return $this->assertFalse($tables_exist, format_string('None of the database tables defined by the @module module exist.', array('@module' => $module)));
}
/**
......@@ -147,7 +147,7 @@ function assertModules(array $modules, $enabled) {
else {
$message = 'Module "@module" is not enabled.';
}
$this->assertEqual(module_exists($module), $enabled, t($message, array('@module' => $module)));
$this->assertEqual(module_exists($module), $enabled, format_string($message, array('@module' => $module)));
}
}
......@@ -182,6 +182,6 @@ function assertLogMessage($type, $message, $variables = array(), $severity = WAT
->countQuery()
->execute()
->fetchField();
$this->assertTrue($count > 0, t('watchdog table contains @count rows for @message', array('@count' => $count, '@message' => $message)));
$this->assertTrue($count > 0, format_string('watchdog table contains @count rows for @message', array('@count' => $count, '@message' => $message)));
}
}
......@@ -31,7 +31,7 @@ function testDisableRequired() {
if (!empty($info['required'])) {
$field_name = "modules[{$info['package']}][$module][enable]";
if (empty($info['hidden'])) {
$this->assertFieldByXPath("//input[@name='$field_name' and @disabled='disabled' and @checked='checked']", '', t('Field @name was disabled and checked.', array('@name' => $field_name)));
$this->assertFieldByXPath("//input[@name='$field_name' and @disabled='disabled' and @checked='checked']", '', format_string('Field @name was disabled and checked.', array('@name' => $field_name)));
}
else {
$this->assertNoFieldByName($field_name);
......
......@@ -40,6 +40,6 @@ function testUserPermsUninstalled() {
// Are the perms defined by module_test removed from {role_permission}.
$count = db_query("SELECT COUNT(rid) FROM {role_permission} WHERE permission = :perm", array(':perm' => 'module_test perm'))->fetchField();
$this->assertEqual(0, $count, t('Permissions were all removed.'));
$this->assertEqual(0, $count, 'Permissions were all removed.');
}
}
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