Issue #1797452 by dcam, izus, xjm, Lars Toomre: Remove t() from test asserts in various system tests

merge-requests/26/head
Jennifer Hodgdon 2013-05-21 12:09:39 -07:00
parent 967cfe402b
commit 89f66ab513
4 changed files with 160 additions and 160 deletions

View File

@ -38,7 +38,7 @@ class MailTestCase extends DrupalWebTestCase implements MailSystemInterface {
$message = drupal_mail('simpletest', 'mail_test', 'testing@example.com', $language); $message = drupal_mail('simpletest', 'mail_test', 'testing@example.com', $language);
// Assert whether the message was sent through the send function. // 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.');
} }
/** /**

View File

@ -48,7 +48,7 @@ class MenuWebTestCase extends DrupalWebTestCase {
// No parts must be left, or an expected "Home" will always pass. // No parts must be left, or an expected "Home" will always pass.
$pass = ($pass && empty($parts)); $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), '%parts' => implode(' » ', $trail),
'@path' => $this->getUrl(), '@path' => $this->getUrl(),
))); )));
@ -78,7 +78,7 @@ class MenuWebTestCase extends DrupalWebTestCase {
$i++; $i++;
} }
$elements = $this->xpath($xpath); $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. // Append prefix for active link asserted below.
$xpath .= '/following-sibling::ul/descendant::'; $xpath .= '/following-sibling::ul/descendant::';
@ -95,7 +95,7 @@ class MenuWebTestCase extends DrupalWebTestCase {
':title' => $active_link_title, ':title' => $active_link_title,
); );
$elements = $this->xpath($xpath, $args); $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, '%title' => $active_link_title,
'%tree' => implode(' » ', $tree), '%tree' => implode(' » ', $tree),
))); )));
@ -145,8 +145,8 @@ class MenuRouterTestCase extends DrupalWebTestCase {
*/ */
function testTitleCallbackFalse() { function testTitleCallbackFalse() {
$this->drupalGet('node'); $this->drupalGet('node');
$this->assertText('A title with @placeholder', t('Raw text found on the page')); $this->assertText('A title with @placeholder', 'Raw text found on the page');
$this->assertNoText(t('A title with @placeholder', array('@placeholder' => 'some other text')), t('Text with placeholder substitutions not found.')); $this->assertNoText(t('A title with @placeholder', array('@placeholder' => 'some other text')), 'Text with placeholder substitutions not found.');
} }
/** /**
@ -166,8 +166,8 @@ class MenuRouterTestCase extends DrupalWebTestCase {
*/ */
function testThemeCallbackAdministrative() { function testThemeCallbackAdministrative() {
$this->drupalGet('menu-test/theme-callback/use-admin-theme'); $this->drupalGet('menu-test/theme-callback/use-admin-theme');
$this->assertText('Custom theme: seven. Actual theme: seven.', t('The administrative theme can be correctly set in a theme callback.')); $this->assertText('Custom theme: seven. Actual theme: seven.', 'The administrative theme can be correctly set in a theme callback.');
$this->assertRaw('seven/style.css', t("The administrative theme's CSS appears on the page.")); $this->assertRaw('seven/style.css', "The administrative theme's CSS appears on the page.");
} }
/** /**
@ -175,8 +175,8 @@ class MenuRouterTestCase extends DrupalWebTestCase {
*/ */
function testThemeCallbackInheritance() { function testThemeCallbackInheritance() {
$this->drupalGet('menu-test/theme-callback/use-admin-theme/inheritance'); $this->drupalGet('menu-test/theme-callback/use-admin-theme/inheritance');
$this->assertText('Custom theme: seven. Actual theme: seven. Theme callback inheritance is being tested.', t('Theme callback inheritance correctly uses the administrative theme.')); $this->assertText('Custom theme: seven. Actual theme: seven. Theme callback inheritance is being tested.', 'Theme callback inheritance correctly uses the administrative theme.');
$this->assertRaw('seven/style.css', t("The administrative theme's CSS appears on the page.")); $this->assertRaw('seven/style.css', "The administrative theme's CSS appears on the page.");
} }
/** /**
@ -185,7 +185,7 @@ class MenuRouterTestCase extends DrupalWebTestCase {
*/ */
function testFileInheritance() { function testFileInheritance() {
$this->drupalGet('admin/config/development/file-inheritance'); $this->drupalGet('admin/config/development/file-inheritance');
$this->assertText('File inheritance test description', t('File inheritance works.')); $this->assertText('File inheritance test description', 'File inheritance works.');
} }
/** /**
@ -208,14 +208,14 @@ class MenuRouterTestCase extends DrupalWebTestCase {
// For a regular user, the fact that the site is in maintenance mode means // For a regular user, the fact that the site is in maintenance mode means
// we expect the theme callback system to be bypassed entirely. // we expect the theme callback system to be bypassed entirely.
$this->drupalGet('menu-test/theme-callback/use-admin-theme'); $this->drupalGet('menu-test/theme-callback/use-admin-theme');
$this->assertRaw('bartik/css/style.css', t("The maintenance theme's CSS appears on the page.")); $this->assertRaw('bartik/css/style.css', "The maintenance theme's CSS appears on the page.");
// An administrator, however, should continue to see the requested theme. // An administrator, however, should continue to see the requested theme.
$admin_user = $this->drupalCreateUser(array('access site in maintenance mode')); $admin_user = $this->drupalCreateUser(array('access site in maintenance mode'));
$this->drupalLogin($admin_user); $this->drupalLogin($admin_user);
$this->drupalGet('menu-test/theme-callback/use-admin-theme'); $this->drupalGet('menu-test/theme-callback/use-admin-theme');
$this->assertText('Custom theme: seven. Actual theme: seven.', t('The theme callback system is correctly triggered for an administrator when the site is in maintenance mode.')); $this->assertText('Custom theme: seven. Actual theme: seven.', 'The theme callback system is correctly triggered for an administrator when the site is in maintenance mode.');
$this->assertRaw('seven/style.css', t("The administrative theme's CSS appears on the page.")); $this->assertRaw('seven/style.css', "The administrative theme's CSS appears on the page.");
} }
/** /**
@ -244,11 +244,11 @@ class MenuRouterTestCase extends DrupalWebTestCase {
$this->drupalGet('user/login'); $this->drupalGet('user/login');
// Check that we got to 'user'. // Check that we got to 'user'.
$this->assertTrue($this->url == url('user', array('absolute' => TRUE)), t("Logged-in user redirected to q=user on accessing q=user/login")); $this->assertTrue($this->url == url('user', array('absolute' => TRUE)), "Logged-in user redirected to q=user on accessing q=user/login");
// user/register should redirect to user/UID/edit. // user/register should redirect to user/UID/edit.
$this->drupalGet('user/register'); $this->drupalGet('user/register');
$this->assertTrue($this->url == url('user/' . $this->loggedInUser->uid . '/edit', array('absolute' => TRUE)), t("Logged-in user redirected to q=user/UID/edit on accessing q=user/register")); $this->assertTrue($this->url == url('user/' . $this->loggedInUser->uid . '/edit', array('absolute' => TRUE)), "Logged-in user redirected to q=user/UID/edit on accessing q=user/register");
} }
/** /**
@ -257,14 +257,14 @@ class MenuRouterTestCase extends DrupalWebTestCase {
function testThemeCallbackOptionalTheme() { function testThemeCallbackOptionalTheme() {
// Request a theme that is not enabled. // Request a theme that is not enabled.
$this->drupalGet('menu-test/theme-callback/use-stark-theme'); $this->drupalGet('menu-test/theme-callback/use-stark-theme');
$this->assertText('Custom theme: NONE. Actual theme: bartik.', t('The theme callback system falls back on the default theme when a theme that is not enabled is requested.')); $this->assertText('Custom theme: NONE. Actual theme: bartik.', 'The theme callback system falls back on the default theme when a theme that is not enabled is requested.');
$this->assertRaw('bartik/css/style.css', t("The default theme's CSS appears on the page.")); $this->assertRaw('bartik/css/style.css', "The default theme's CSS appears on the page.");
// Now enable the theme and request it again. // Now enable the theme and request it again.
theme_enable(array('stark')); theme_enable(array('stark'));
$this->drupalGet('menu-test/theme-callback/use-stark-theme'); $this->drupalGet('menu-test/theme-callback/use-stark-theme');
$this->assertText('Custom theme: stark. Actual theme: stark.', t('The theme callback system uses an optional theme once it has been enabled.')); $this->assertText('Custom theme: stark. Actual theme: stark.', 'The theme callback system uses an optional theme once it has been enabled.');
$this->assertRaw('stark/layout.css', t("The optional theme's CSS appears on the page.")); $this->assertRaw('stark/layout.css', "The optional theme's CSS appears on the page.");
} }
/** /**
@ -272,8 +272,8 @@ class MenuRouterTestCase extends DrupalWebTestCase {
*/ */
function testThemeCallbackFakeTheme() { function testThemeCallbackFakeTheme() {
$this->drupalGet('menu-test/theme-callback/use-fake-theme'); $this->drupalGet('menu-test/theme-callback/use-fake-theme');
$this->assertText('Custom theme: NONE. Actual theme: bartik.', t('The theme callback system falls back on the default theme when a theme that does not exist is requested.')); $this->assertText('Custom theme: NONE. Actual theme: bartik.', 'The theme callback system falls back on the default theme when a theme that does not exist is requested.');
$this->assertRaw('bartik/css/style.css', t("The default theme's CSS appears on the page.")); $this->assertRaw('bartik/css/style.css', "The default theme's CSS appears on the page.");
} }
/** /**
@ -281,8 +281,8 @@ class MenuRouterTestCase extends DrupalWebTestCase {
*/ */
function testThemeCallbackNoThemeRequested() { function testThemeCallbackNoThemeRequested() {
$this->drupalGet('menu-test/theme-callback/no-theme-requested'); $this->drupalGet('menu-test/theme-callback/no-theme-requested');
$this->assertText('Custom theme: NONE. Actual theme: bartik.', t('The theme callback system falls back on the default theme when no theme is requested.')); $this->assertText('Custom theme: NONE. Actual theme: bartik.', 'The theme callback system falls back on the default theme when no theme is requested.');
$this->assertRaw('bartik/css/style.css', t("The default theme's CSS appears on the page.")); $this->assertRaw('bartik/css/style.css', "The default theme's CSS appears on the page.");
} }
/** /**
@ -297,8 +297,8 @@ class MenuRouterTestCase extends DrupalWebTestCase {
// Visit a page that does not implement a theme callback. The above request // Visit a page that does not implement a theme callback. The above request
// should be honored. // should be honored.
$this->drupalGet('menu-test/no-theme-callback'); $this->drupalGet('menu-test/no-theme-callback');
$this->assertText('Custom theme: stark. Actual theme: stark.', t('The result of hook_custom_theme() is used as the theme for the current page.')); $this->assertText('Custom theme: stark. Actual theme: stark.', 'The result of hook_custom_theme() is used as the theme for the current page.');
$this->assertRaw('stark/layout.css', t("The Stark theme's CSS appears on the page.")); $this->assertRaw('stark/layout.css', "The Stark theme's CSS appears on the page.");
} }
/** /**
@ -313,8 +313,8 @@ class MenuRouterTestCase extends DrupalWebTestCase {
// The menu "theme callback" should take precedence over a value set in // The menu "theme callback" should take precedence over a value set in
// hook_custom_theme(). // hook_custom_theme().
$this->drupalGet('menu-test/theme-callback/use-admin-theme'); $this->drupalGet('menu-test/theme-callback/use-admin-theme');
$this->assertText('Custom theme: seven. Actual theme: seven.', t('The result of hook_custom_theme() does not override what was set in a theme callback.')); $this->assertText('Custom theme: seven. Actual theme: seven.', 'The result of hook_custom_theme() does not override what was set in a theme callback.');
$this->assertRaw('seven/style.css', t("The Seven theme's CSS appears on the page.")); $this->assertRaw('seven/style.css', "The Seven theme's CSS appears on the page.");
} }
/** /**
@ -348,19 +348,19 @@ class MenuRouterTestCase extends DrupalWebTestCase {
menu_link_maintain('menu_test', 'update', 'menu_test_maintain/1', 'Menu link updated'); menu_link_maintain('menu_test', 'update', 'menu_test_maintain/1', 'Menu link updated');
// Load a different page to be sure that we have up to date information. // Load a different page to be sure that we have up to date information.
$this->drupalGet('menu_test_maintain/1'); $this->drupalGet('menu_test_maintain/1');
$this->assertLink(t('Menu link updated'), 0, t('Found updated menu link')); $this->assertLink(t('Menu link updated'), 0, 'Found updated menu link');
$this->assertNoLink(t('Menu link #1'), 0, t('Not found menu link #1')); $this->assertNoLink(t('Menu link #1'), 0, 'Not found menu link #1');
$this->assertNoLink(t('Menu link #1'), 0, t('Not found menu link #1-1')); $this->assertNoLink(t('Menu link #1'), 0, 'Not found menu link #1-1');
$this->assertLink(t('Menu link #2'), 0, t('Found menu link #2')); $this->assertLink(t('Menu link #2'), 0, 'Found menu link #2');
// Delete all links for the given path. // Delete all links for the given path.
menu_link_maintain('menu_test', 'delete', 'menu_test_maintain/1', ''); menu_link_maintain('menu_test', 'delete', 'menu_test_maintain/1', '');
// Load a different page to be sure that we have up to date information. // Load a different page to be sure that we have up to date information.
$this->drupalGet('menu_test_maintain/2'); $this->drupalGet('menu_test_maintain/2');
$this->assertNoLink(t('Menu link updated'), 0, t('Not found deleted menu link')); $this->assertNoLink(t('Menu link updated'), 0, 'Not found deleted menu link');
$this->assertNoLink(t('Menu link #1'), 0, t('Not found menu link #1')); $this->assertNoLink(t('Menu link #1'), 0, 'Not found menu link #1');
$this->assertNoLink(t('Menu link #1'), 0, t('Not found menu link #1-1')); $this->assertNoLink(t('Menu link #1'), 0, 'Not found menu link #1-1');
$this->assertLink(t('Menu link #2'), 0, t('Found menu link #2')); $this->assertLink(t('Menu link #2'), 0, 'Found menu link #2');
} }
/** /**
@ -397,7 +397,7 @@ class MenuRouterTestCase extends DrupalWebTestCase {
$sql = "SELECT menu_name FROM {menu_links} WHERE router_path = 'menu_name_test'"; $sql = "SELECT menu_name FROM {menu_links} WHERE router_path = 'menu_name_test'";
$name = db_query($sql)->fetchField(); $name = db_query($sql)->fetchField();
$this->assertEqual($name, 'original', t('Menu name is "original".')); $this->assertEqual($name, 'original', 'Menu name is "original".');
// Change the menu_name parameter in menu_test.module, then force a menu // Change the menu_name parameter in menu_test.module, then force a menu
// rebuild. // rebuild.
@ -406,7 +406,7 @@ class MenuRouterTestCase extends DrupalWebTestCase {
$sql = "SELECT menu_name FROM {menu_links} WHERE router_path = 'menu_name_test'"; $sql = "SELECT menu_name FROM {menu_links} WHERE router_path = 'menu_name_test'";
$name = db_query($sql)->fetchField(); $name = db_query($sql)->fetchField();
$this->assertEqual($name, 'changed', t('Menu name was successfully changed after rebuild.')); $this->assertEqual($name, 'changed', 'Menu name was successfully changed after rebuild.');
} }
/** /**
@ -417,8 +417,8 @@ class MenuRouterTestCase extends DrupalWebTestCase {
$child_link = db_query('SELECT * FROM {menu_links} WHERE link_path = :link_path', array(':link_path' => 'menu-test/hierarchy/parent/child'))->fetchAssoc(); $child_link = db_query('SELECT * FROM {menu_links} WHERE link_path = :link_path', array(':link_path' => 'menu-test/hierarchy/parent/child'))->fetchAssoc();
$unattached_child_link = db_query('SELECT * FROM {menu_links} WHERE link_path = :link_path', array(':link_path' => 'menu-test/hierarchy/parent/child2/child'))->fetchAssoc(); $unattached_child_link = db_query('SELECT * FROM {menu_links} WHERE link_path = :link_path', array(':link_path' => 'menu-test/hierarchy/parent/child2/child'))->fetchAssoc();
$this->assertEqual($child_link['plid'], $parent_link['mlid'], t('The parent of a directly attached child is correct.')); $this->assertEqual($child_link['plid'], $parent_link['mlid'], 'The parent of a directly attached child is correct.');
$this->assertEqual($unattached_child_link['plid'], $parent_link['mlid'], t('The parent of a non-directly attached child is correct.')); $this->assertEqual($unattached_child_link['plid'], $parent_link['mlid'], 'The parent of a non-directly attached child is correct.');
} }
/** /**
@ -438,40 +438,40 @@ class MenuRouterTestCase extends DrupalWebTestCase {
$plid = $parent['mlid']; $plid = $parent['mlid'];
$link = $links['menu-test/hidden/menu/list']; $link = $links['menu-test/hidden/menu/list'];
$this->assertEqual($link['depth'], $depth, t('%path depth @link_depth is equal to @depth.', array('%path' => $link['router_path'], '@link_depth' => $link['depth'], '@depth' => $depth))); $this->assertEqual($link['depth'], $depth, format_string('%path depth @link_depth is equal to @depth.', array('%path' => $link['router_path'], '@link_depth' => $link['depth'], '@depth' => $depth)));
$this->assertEqual($link['plid'], $plid, t('%path plid @link_plid is equal to @plid.', array('%path' => $link['router_path'], '@link_plid' => $link['plid'], '@plid' => $plid))); $this->assertEqual($link['plid'], $plid, format_string('%path plid @link_plid is equal to @plid.', array('%path' => $link['router_path'], '@link_plid' => $link['plid'], '@plid' => $plid)));
$link = $links['menu-test/hidden/menu/add']; $link = $links['menu-test/hidden/menu/add'];
$this->assertEqual($link['depth'], $depth, t('%path depth @link_depth is equal to @depth.', array('%path' => $link['router_path'], '@link_depth' => $link['depth'], '@depth' => $depth))); $this->assertEqual($link['depth'], $depth, format_string('%path depth @link_depth is equal to @depth.', array('%path' => $link['router_path'], '@link_depth' => $link['depth'], '@depth' => $depth)));
$this->assertEqual($link['plid'], $plid, t('%path plid @link_plid is equal to @plid.', array('%path' => $link['router_path'], '@link_plid' => $link['plid'], '@plid' => $plid))); $this->assertEqual($link['plid'], $plid, format_string('%path plid @link_plid is equal to @plid.', array('%path' => $link['router_path'], '@link_plid' => $link['plid'], '@plid' => $plid)));
$link = $links['menu-test/hidden/menu/settings']; $link = $links['menu-test/hidden/menu/settings'];
$this->assertEqual($link['depth'], $depth, t('%path depth @link_depth is equal to @depth.', array('%path' => $link['router_path'], '@link_depth' => $link['depth'], '@depth' => $depth))); $this->assertEqual($link['depth'], $depth, format_string('%path depth @link_depth is equal to @depth.', array('%path' => $link['router_path'], '@link_depth' => $link['depth'], '@depth' => $depth)));
$this->assertEqual($link['plid'], $plid, t('%path plid @link_plid is equal to @plid.', array('%path' => $link['router_path'], '@link_plid' => $link['plid'], '@plid' => $plid))); $this->assertEqual($link['plid'], $plid, format_string('%path plid @link_plid is equal to @plid.', array('%path' => $link['router_path'], '@link_plid' => $link['plid'], '@plid' => $plid)));
$link = $links['menu-test/hidden/menu/manage/%']; $link = $links['menu-test/hidden/menu/manage/%'];
$this->assertEqual($link['depth'], $depth, t('%path depth @link_depth is equal to @depth.', array('%path' => $link['router_path'], '@link_depth' => $link['depth'], '@depth' => $depth))); $this->assertEqual($link['depth'], $depth, format_string('%path depth @link_depth is equal to @depth.', array('%path' => $link['router_path'], '@link_depth' => $link['depth'], '@depth' => $depth)));
$this->assertEqual($link['plid'], $plid, t('%path plid @link_plid is equal to @plid.', array('%path' => $link['router_path'], '@link_plid' => $link['plid'], '@plid' => $plid))); $this->assertEqual($link['plid'], $plid, format_string('%path plid @link_plid is equal to @plid.', array('%path' => $link['router_path'], '@link_plid' => $link['plid'], '@plid' => $plid)));
$parent = $links['menu-test/hidden/menu/manage/%']; $parent = $links['menu-test/hidden/menu/manage/%'];
$depth = $parent['depth'] + 1; $depth = $parent['depth'] + 1;
$plid = $parent['mlid']; $plid = $parent['mlid'];
$link = $links['menu-test/hidden/menu/manage/%/list']; $link = $links['menu-test/hidden/menu/manage/%/list'];
$this->assertEqual($link['depth'], $depth, t('%path depth @link_depth is equal to @depth.', array('%path' => $link['router_path'], '@link_depth' => $link['depth'], '@depth' => $depth))); $this->assertEqual($link['depth'], $depth, format_string('%path depth @link_depth is equal to @depth.', array('%path' => $link['router_path'], '@link_depth' => $link['depth'], '@depth' => $depth)));
$this->assertEqual($link['plid'], $plid, t('%path plid @link_plid is equal to @plid.', array('%path' => $link['router_path'], '@link_plid' => $link['plid'], '@plid' => $plid))); $this->assertEqual($link['plid'], $plid, format_string('%path plid @link_plid is equal to @plid.', array('%path' => $link['router_path'], '@link_plid' => $link['plid'], '@plid' => $plid)));
$link = $links['menu-test/hidden/menu/manage/%/add']; $link = $links['menu-test/hidden/menu/manage/%/add'];
$this->assertEqual($link['depth'], $depth, t('%path depth @link_depth is equal to @depth.', array('%path' => $link['router_path'], '@link_depth' => $link['depth'], '@depth' => $depth))); $this->assertEqual($link['depth'], $depth, format_string('%path depth @link_depth is equal to @depth.', array('%path' => $link['router_path'], '@link_depth' => $link['depth'], '@depth' => $depth)));
$this->assertEqual($link['plid'], $plid, t('%path plid @link_plid is equal to @plid.', array('%path' => $link['router_path'], '@link_plid' => $link['plid'], '@plid' => $plid))); $this->assertEqual($link['plid'], $plid, format_string('%path plid @link_plid is equal to @plid.', array('%path' => $link['router_path'], '@link_plid' => $link['plid'], '@plid' => $plid)));
$link = $links['menu-test/hidden/menu/manage/%/edit']; $link = $links['menu-test/hidden/menu/manage/%/edit'];
$this->assertEqual($link['depth'], $depth, t('%path depth @link_depth is equal to @depth.', array('%path' => $link['router_path'], '@link_depth' => $link['depth'], '@depth' => $depth))); $this->assertEqual($link['depth'], $depth, format_string('%path depth @link_depth is equal to @depth.', array('%path' => $link['router_path'], '@link_depth' => $link['depth'], '@depth' => $depth)));
$this->assertEqual($link['plid'], $plid, t('%path plid @link_plid is equal to @plid.', array('%path' => $link['router_path'], '@link_plid' => $link['plid'], '@plid' => $plid))); $this->assertEqual($link['plid'], $plid, format_string('%path plid @link_plid is equal to @plid.', array('%path' => $link['router_path'], '@link_plid' => $link['plid'], '@plid' => $plid)));
$link = $links['menu-test/hidden/menu/manage/%/delete']; $link = $links['menu-test/hidden/menu/manage/%/delete'];
$this->assertEqual($link['depth'], $depth, t('%path depth @link_depth is equal to @depth.', array('%path' => $link['router_path'], '@link_depth' => $link['depth'], '@depth' => $depth))); $this->assertEqual($link['depth'], $depth, format_string('%path depth @link_depth is equal to @depth.', array('%path' => $link['router_path'], '@link_depth' => $link['depth'], '@depth' => $depth)));
$this->assertEqual($link['plid'], $plid, t('%path plid @link_plid is equal to @plid.', array('%path' => $link['router_path'], '@link_plid' => $link['plid'], '@plid' => $plid))); $this->assertEqual($link['plid'], $plid, format_string('%path plid @link_plid is equal to @plid.', array('%path' => $link['router_path'], '@link_plid' => $link['plid'], '@plid' => $plid)));
// Verify links for two dynamic arguments. // Verify links for two dynamic arguments.
$links = db_select('menu_links', 'ml') $links = db_select('menu_links', 'ml')
@ -486,28 +486,28 @@ class MenuRouterTestCase extends DrupalWebTestCase {
$plid = $parent['mlid']; $plid = $parent['mlid'];
$link = $links['menu-test/hidden/block/list']; $link = $links['menu-test/hidden/block/list'];
$this->assertEqual($link['depth'], $depth, t('%path depth @link_depth is equal to @depth.', array('%path' => $link['router_path'], '@link_depth' => $link['depth'], '@depth' => $depth))); $this->assertEqual($link['depth'], $depth, format_string('%path depth @link_depth is equal to @depth.', array('%path' => $link['router_path'], '@link_depth' => $link['depth'], '@depth' => $depth)));
$this->assertEqual($link['plid'], $plid, t('%path plid @link_plid is equal to @plid.', array('%path' => $link['router_path'], '@link_plid' => $link['plid'], '@plid' => $plid))); $this->assertEqual($link['plid'], $plid, format_string('%path plid @link_plid is equal to @plid.', array('%path' => $link['router_path'], '@link_plid' => $link['plid'], '@plid' => $plid)));
$link = $links['menu-test/hidden/block/add']; $link = $links['menu-test/hidden/block/add'];
$this->assertEqual($link['depth'], $depth, t('%path depth @link_depth is equal to @depth.', array('%path' => $link['router_path'], '@link_depth' => $link['depth'], '@depth' => $depth))); $this->assertEqual($link['depth'], $depth, format_string('%path depth @link_depth is equal to @depth.', array('%path' => $link['router_path'], '@link_depth' => $link['depth'], '@depth' => $depth)));
$this->assertEqual($link['plid'], $plid, t('%path plid @link_plid is equal to @plid.', array('%path' => $link['router_path'], '@link_plid' => $link['plid'], '@plid' => $plid))); $this->assertEqual($link['plid'], $plid, format_string('%path plid @link_plid is equal to @plid.', array('%path' => $link['router_path'], '@link_plid' => $link['plid'], '@plid' => $plid)));
$link = $links['menu-test/hidden/block/manage/%/%']; $link = $links['menu-test/hidden/block/manage/%/%'];
$this->assertEqual($link['depth'], $depth, t('%path depth @link_depth is equal to @depth.', array('%path' => $link['router_path'], '@link_depth' => $link['depth'], '@depth' => $depth))); $this->assertEqual($link['depth'], $depth, format_string('%path depth @link_depth is equal to @depth.', array('%path' => $link['router_path'], '@link_depth' => $link['depth'], '@depth' => $depth)));
$this->assertEqual($link['plid'], $plid, t('%path plid @link_plid is equal to @plid.', array('%path' => $link['router_path'], '@link_plid' => $link['plid'], '@plid' => $plid))); $this->assertEqual($link['plid'], $plid, format_string('%path plid @link_plid is equal to @plid.', array('%path' => $link['router_path'], '@link_plid' => $link['plid'], '@plid' => $plid)));
$parent = $links['menu-test/hidden/block/manage/%/%']; $parent = $links['menu-test/hidden/block/manage/%/%'];
$depth = $parent['depth'] + 1; $depth = $parent['depth'] + 1;
$plid = $parent['mlid']; $plid = $parent['mlid'];
$link = $links['menu-test/hidden/block/manage/%/%/configure']; $link = $links['menu-test/hidden/block/manage/%/%/configure'];
$this->assertEqual($link['depth'], $depth, t('%path depth @link_depth is equal to @depth.', array('%path' => $link['router_path'], '@link_depth' => $link['depth'], '@depth' => $depth))); $this->assertEqual($link['depth'], $depth, format_string('%path depth @link_depth is equal to @depth.', array('%path' => $link['router_path'], '@link_depth' => $link['depth'], '@depth' => $depth)));
$this->assertEqual($link['plid'], $plid, t('%path plid @link_plid is equal to @plid.', array('%path' => $link['router_path'], '@link_plid' => $link['plid'], '@plid' => $plid))); $this->assertEqual($link['plid'], $plid, format_string('%path plid @link_plid is equal to @plid.', array('%path' => $link['router_path'], '@link_plid' => $link['plid'], '@plid' => $plid)));
$link = $links['menu-test/hidden/block/manage/%/%/delete']; $link = $links['menu-test/hidden/block/manage/%/%/delete'];
$this->assertEqual($link['depth'], $depth, t('%path depth @link_depth is equal to @depth.', array('%path' => $link['router_path'], '@link_depth' => $link['depth'], '@depth' => $depth))); $this->assertEqual($link['depth'], $depth, format_string('%path depth @link_depth is equal to @depth.', array('%path' => $link['router_path'], '@link_depth' => $link['depth'], '@depth' => $depth)));
$this->assertEqual($link['plid'], $plid, t('%path plid @link_plid is equal to @plid.', array('%path' => $link['router_path'], '@link_plid' => $link['plid'], '@plid' => $plid))); $this->assertEqual($link['plid'], $plid, format_string('%path plid @link_plid is equal to @plid.', array('%path' => $link['router_path'], '@link_plid' => $link['plid'], '@plid' => $plid)));
} }
/** /**
@ -524,7 +524,7 @@ class MenuRouterTestCase extends DrupalWebTestCase {
function testMenuSetItem() { function testMenuSetItem() {
$item = menu_get_item('node'); $item = menu_get_item('node');
$this->assertEqual($item['path'], 'node', t("Path from menu_get_item('node') is equal to 'node'"), 'menu'); $this->assertEqual($item['path'], 'node', "Path from menu_get_item('node') is equal to 'node'", 'menu');
// Modify the path for the item then save it. // Modify the path for the item then save it.
$item['path'] = 'node_test'; $item['path'] = 'node_test';
@ -532,7 +532,7 @@ class MenuRouterTestCase extends DrupalWebTestCase {
menu_set_item('node', $item); menu_set_item('node', $item);
$compare_item = menu_get_item('node'); $compare_item = menu_get_item('node');
$this->assertEqual($compare_item, $item, t('Modified menu item is equal to newly retrieved menu item.'), 'menu'); $this->assertEqual($compare_item, $item, 'Modified menu item is equal to newly retrieved menu item.', 'menu');
} }
/** /**
@ -541,13 +541,13 @@ class MenuRouterTestCase extends DrupalWebTestCase {
function testMenuItemHooks() { function testMenuItemHooks() {
// Create an item. // Create an item.
menu_link_maintain('menu_test', 'insert', 'menu_test_maintain/4', 'Menu link #4'); menu_link_maintain('menu_test', 'insert', 'menu_test_maintain/4', 'Menu link #4');
$this->assertEqual(menu_test_static_variable(), 'insert', t('hook_menu_link_insert() fired correctly')); $this->assertEqual(menu_test_static_variable(), 'insert', 'hook_menu_link_insert() fired correctly');
// Update the item. // Update the item.
menu_link_maintain('menu_test', 'update', 'menu_test_maintain/4', 'Menu link updated'); menu_link_maintain('menu_test', 'update', 'menu_test_maintain/4', 'Menu link updated');
$this->assertEqual(menu_test_static_variable(), 'update', t('hook_menu_link_update() fired correctly')); $this->assertEqual(menu_test_static_variable(), 'update', 'hook_menu_link_update() fired correctly');
// Delete the item. // Delete the item.
menu_link_maintain('menu_test', 'delete', 'menu_test_maintain/4', ''); menu_link_maintain('menu_test', 'delete', 'menu_test_maintain/4', '');
$this->assertEqual(menu_test_static_variable(), 'delete', t('hook_menu_link_delete() fired correctly')); $this->assertEqual(menu_test_static_variable(), 'delete', 'hook_menu_link_delete() fired correctly');
} }
/** /**
@ -572,8 +572,8 @@ class MenuRouterTestCase extends DrupalWebTestCase {
// Load front page. // Load front page.
$this->drupalGet('node'); $this->drupalGet('node');
$this->assertRaw('title="Test title attribute"', t('Title attribute of a menu link renders.')); $this->assertRaw('title="Test title attribute"', 'Title attribute of a menu link renders.');
$this->assertRaw('testparam=testvalue', t('Query parameter added to menu link.')); $this->assertRaw('testparam=testvalue', 'Query parameter added to menu link.');
} }
/** /**
@ -606,7 +606,7 @@ class MenuRouterTestCase extends DrupalWebTestCase {
$this->drupalGet('menu-title-test/case' . $case_no); $this->drupalGet('menu-title-test/case' . $case_no);
$this->assertResponse(200); $this->assertResponse(200);
$asserted_title = $override ? 'Alternative example title - Case ' . $case_no : 'Example title - Case ' . $case_no; $asserted_title = $override ? 'Alternative example title - Case ' . $case_no : 'Example title - Case ' . $case_no;
$this->assertTitle($asserted_title . ' | Drupal', t('Menu title is') . ': ' . $asserted_title, 'Menu'); $this->assertTitle($asserted_title . ' | Drupal', format_string('Menu title is: %title.', array('%title' => $asserted_title)), 'Menu');
} }
/** /**
@ -663,7 +663,7 @@ class MenuRouterTestCase extends DrupalWebTestCase {
foreach ($expected as $router_path => $load_functions) { foreach ($expected as $router_path => $load_functions) {
$router_item = $this->menuLoadRouter($router_path); $router_item = $this->menuLoadRouter($router_path);
$this->assertIdentical(unserialize($router_item['load_functions']), $load_functions, t('Expected load functions for router %router_path' , array('%router_path' => $router_path))); $this->assertIdentical(unserialize($router_item['load_functions']), $load_functions, format_string('Expected load functions for router %router_path' , array('%router_path' => $router_path)));
} }
} }
} }
@ -744,7 +744,7 @@ class MenuLinksUnitTestCase extends DrupalWebTestCase {
$menu_link = menu_link_load($mlid); $menu_link = menu_link_load($mlid);
menu_link_save($menu_link); 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)));
} }
} }
@ -905,14 +905,14 @@ class MenuRebuildTestCase extends DrupalWebTestCase {
function testMenuRebuildByVariable() { function testMenuRebuildByVariable() {
// Check if 'admin' path exists. // Check if 'admin' path exists.
$admin_exists = db_query('SELECT path from {menu_router} WHERE path = :path', array(':path' => 'admin'))->fetchField(); $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 the path item 'admin', and test that the path doesn't exist in the database.
$delete = db_delete('menu_router') $delete = db_delete('menu_router')
->condition('path', 'admin') ->condition('path', 'admin')
->execute(); ->execute();
$admin_exists = db_query('SELECT path from {menu_router} WHERE path = :path', array(':path' => 'admin'))->fetchField(); $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 trigger menu_execute_active_handler() // Now we enable the rebuild variable and trigger menu_execute_active_handler()
// to rebuild the menu item. Now 'admin' should exist. // to rebuild the menu item. Now 'admin' should exist.
@ -920,7 +920,7 @@ class MenuRebuildTestCase extends DrupalWebTestCase {
// menu_execute_active_handler() should trigger the rebuild. // menu_execute_active_handler() should trigger the rebuild.
$this->drupalGet('<front>'); $this->drupalGet('<front>');
$admin_exists = db_query('SELECT path from {menu_router} WHERE path = :path', array(':path' => 'admin'))->fetchField(); $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.");
} }
} }
@ -955,12 +955,12 @@ class MenuTreeDataTestCase extends DrupalUnitTestCase {
$tree = menu_tree_data($this->links); $tree = menu_tree_data($this->links);
// Validate that parent items #1, #2, and #5 exist on the root level. // 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[1], $tree[1]['link'], 'Parent item #1 exists.');
$this->assertSameLink($this->links[2], $tree[2]['link'], t('Parent item #2 exists.')); $this->assertSameLink($this->links[2], $tree[2]['link'], 'Parent item #2 exists.');
$this->assertSameLink($this->links[5], $tree[5]['link'], t('Parent item #5 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. // 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.');
} }
/** /**
@ -976,7 +976,7 @@ class MenuTreeDataTestCase extends DrupalUnitTestCase {
* TRUE if the assertion succeeded, FALSE otherwise. * TRUE if the assertion succeeded, FALSE otherwise.
*/ */
protected function assertSameLink($link1, $link2, $message = '') { 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 ? $message : 'First link is identical to second link');
} }
} }
@ -1025,16 +1025,16 @@ class MenuTreeOutputTestCase extends DrupalWebTestCase {
$output = menu_tree_output($this->tree_data); $output = menu_tree_output($this->tree_data);
// Validate that the - in main-menu is changed into an underscore // 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['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', t('Hyphen is changed to a dash on menu_tree wrapper')); $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 // 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->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']) , t('Checking the active trail class')); $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 // 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['5']), 'Hidden item should be missing');
$this->assertFalse( isset($output['6']), t('False access 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 // 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');
} }
} }
@ -1698,13 +1698,13 @@ class MenuTrailTestCase extends MenuWebTestCase {
// Check that the initial trail (during the Drupal bootstrap) matches // Check that the initial trail (during the Drupal bootstrap) matches
// what we expect. // what we expect.
$initial_trail = variable_get('menu_test_active_trail_initial', array()); $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, '@status_code' => $status_code,
'@expected' => count($expected_trail[$status_code]['initial']), '@expected' => count($expected_trail[$status_code]['initial']),
'@found' => count($initial_trail), '@found' => count($initial_trail),
))); )));
foreach (array_keys($expected_trail[$status_code]['initial']) as $index => $path) { 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, '@number' => $index + 1,
'@status_code' => $status_code, '@status_code' => $status_code,
'@expected' => $path, '@expected' => $path,
@ -1715,13 +1715,13 @@ class MenuTrailTestCase extends MenuWebTestCase {
// Check that the final trail (after the user has been redirected to the // Check that the final trail (after the user has been redirected to the
// custom 403/404 page) matches what we expect. // custom 403/404 page) matches what we expect.
$final_trail = variable_get('menu_test_active_trail_final', array()); $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, '@status_code' => $status_code,
'@expected' => count($expected_trail[$status_code]['final']), '@expected' => count($expected_trail[$status_code]['final']),
'@found' => count($final_trail), '@found' => count($final_trail),
))); )));
foreach (array_keys($expected_trail[$status_code]['final']) as $index => $path) { 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, '@number' => $index + 1,
'@status_code' => $status_code, '@status_code' => $status_code,
'@expected' => $path, '@expected' => $path,

View File

@ -76,9 +76,9 @@ class ModuleUnitTest extends DrupalWebTestCase {
*/ */
protected function assertModuleList(Array $expected_values, $condition) { protected function assertModuleList(Array $expected_values, $condition) {
$expected_values = array_combine($expected_values, $expected_values); $expected_values = array_combine($expected_values, $expected_values);
$this->assertEqual($expected_values, module_list(), t('@condition: module_list() returns correct results', array('@condition' => $condition))); $this->assertEqual($expected_values, module_list(), format_string('@condition: module_list() returns correct results', array('@condition' => $condition)));
ksort($expected_values); ksort($expected_values);
$this->assertIdentical($expected_values, module_list(FALSE, FALSE, TRUE), t('@condition: module_list() returns correctly sorted results', array('@condition' => $condition))); $this->assertIdentical($expected_values, module_list(FALSE, FALSE, TRUE), format_string('@condition: module_list() returns correctly sorted results', array('@condition' => $condition)));
} }
/** /**
@ -87,16 +87,16 @@ class ModuleUnitTest extends DrupalWebTestCase {
function testModuleImplements() { function testModuleImplements() {
// Clear the cache. // Clear the cache.
cache_clear_all('module_implements', 'cache_bootstrap'); cache_clear_all('module_implements', 'cache_bootstrap');
$this->assertFalse(cache_get('module_implements', 'cache_bootstrap'), t('The module implements cache is empty.')); $this->assertFalse(cache_get('module_implements', 'cache_bootstrap'), 'The module implements cache is empty.');
$this->drupalGet(''); $this->drupalGet('');
$this->assertTrue(cache_get('module_implements', 'cache_bootstrap'), t('The module implements cache is populated after requesting a page.')); $this->assertTrue(cache_get('module_implements', 'cache_bootstrap'), 'The module implements cache is populated after requesting a page.');
// Test again with an authenticated user. // Test again with an authenticated user.
$this->user = $this->drupalCreateUser(); $this->user = $this->drupalCreateUser();
$this->drupalLogin($this->user); $this->drupalLogin($this->user);
cache_clear_all('module_implements', 'cache_bootstrap'); cache_clear_all('module_implements', 'cache_bootstrap');
$this->drupalGet(''); $this->drupalGet('');
$this->assertTrue(cache_get('module_implements', 'cache_bootstrap'), t('The module implements cache is populated after requesting a page.')); $this->assertTrue(cache_get('module_implements', 'cache_bootstrap'), 'The module implements cache is populated after requesting a page.');
// Make sure group include files are detected properly even when the file is // Make sure group include files are detected properly even when the file is
// already loaded when the cache is rebuilt. // already loaded when the cache is rebuilt.
@ -117,7 +117,7 @@ class ModuleUnitTest extends DrupalWebTestCase {
module_enable(array('module_test'), FALSE); module_enable(array('module_test'), FALSE);
$this->resetAll(); $this->resetAll();
$this->drupalGet('module-test/hook-dynamic-loading-invoke'); $this->drupalGet('module-test/hook-dynamic-loading-invoke');
$this->assertText('success!', t('module_invoke() dynamically loads a hook defined in hook_hook_info().')); $this->assertText('success!', 'module_invoke() dynamically loads a hook defined in hook_hook_info().');
} }
/** /**
@ -127,7 +127,7 @@ class ModuleUnitTest extends DrupalWebTestCase {
module_enable(array('module_test'), FALSE); module_enable(array('module_test'), FALSE);
$this->resetAll(); $this->resetAll();
$this->drupalGet('module-test/hook-dynamic-loading-invoke-all'); $this->drupalGet('module-test/hook-dynamic-loading-invoke-all');
$this->assertText('success!', t('module_invoke_all() dynamically loads a hook defined in hook_hook_info().')); $this->assertText('success!', 'module_invoke_all() dynamically loads a hook defined in hook_hook_info().');
} }
/** /**
@ -138,79 +138,79 @@ class ModuleUnitTest extends DrupalWebTestCase {
// are not already enabled. (If they were, the tests below would not work // are not already enabled. (If they were, the tests below would not work
// correctly.) // correctly.)
module_enable(array('module_test'), FALSE); 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.');
$this->assertFalse(module_exists('forum'), t('Forum module is disabled.')); $this->assertFalse(module_exists('forum'), 'Forum module is disabled.');
$this->assertFalse(module_exists('poll'), t('Poll module is disabled.')); $this->assertFalse(module_exists('poll'), 'Poll module is disabled.');
$this->assertFalse(module_exists('php'), t('PHP module is disabled.')); $this->assertFalse(module_exists('php'), 'PHP module is disabled.');
// First, create a fake missing dependency. Forum depends on poll, which // First, create a fake missing dependency. Forum depends on poll, which
// depends on a made-up module, foo. Nothing should be installed. // depends on a made-up module, foo. Nothing should be installed.
variable_set('dependency_test', 'missing dependency'); variable_set('dependency_test', 'missing dependency');
drupal_static_reset('system_rebuild_module_data'); drupal_static_reset('system_rebuild_module_data');
$result = module_enable(array('forum')); $result = module_enable(array('forum'));
$this->assertFalse($result, t('module_enable() returns FALSE if dependencies are missing.')); $this->assertFalse($result, 'module_enable() returns FALSE if dependencies are missing.');
$this->assertFalse(module_exists('forum'), t('module_enable() aborts if dependencies are missing.')); $this->assertFalse(module_exists('forum'), 'module_enable() aborts if dependencies are missing.');
// Now, fix the missing dependency. Forum module depends on poll, but poll // Now, fix the missing dependency. Forum module depends on poll, but poll
// depends on the PHP module. module_enable() should work. // depends on the PHP module. module_enable() should work.
variable_set('dependency_test', 'dependency'); variable_set('dependency_test', 'dependency');
drupal_static_reset('system_rebuild_module_data'); drupal_static_reset('system_rebuild_module_data');
$result = module_enable(array('forum')); $result = module_enable(array('forum'));
$this->assertTrue($result, t('module_enable() returns the correct value.')); $this->assertTrue($result, 'module_enable() returns the correct value.');
// Verify that the fake dependency chain was installed. // Verify that the fake dependency chain was installed.
$this->assertTrue(module_exists('poll') && module_exists('php'), t('Dependency chain was installed by module_enable().')); $this->assertTrue(module_exists('poll') && module_exists('php'), 'Dependency chain was installed by module_enable().');
// Verify that the original module was installed. // Verify that the original module was installed.
$this->assertTrue(module_exists('forum'), t('Module installation with unlisted dependencies succeeded.')); $this->assertTrue(module_exists('forum'), 'Module installation with unlisted dependencies succeeded.');
// Finally, verify that the modules were enabled in the correct order. // Finally, verify that the modules were enabled in the correct order.
$this->assertEqual(variable_get('test_module_enable_order', array()), array('php', 'poll', 'forum'), t('Modules were enabled in the correct order by module_enable().')); $this->assertEqual(variable_get('test_module_enable_order', array()), array('php', 'poll', 'forum'), 'Modules were enabled in the correct order by module_enable().');
// Now, disable the PHP module. Both forum and poll should be disabled as // Now, disable the PHP module. Both forum and poll should be disabled as
// well, in the correct order. // well, in the correct order.
module_disable(array('php')); module_disable(array('php'));
$this->assertTrue(!module_exists('forum') && !module_exists('poll'), t('Depedency chain was disabled by module_disable().')); $this->assertTrue(!module_exists('forum') && !module_exists('poll'), 'Depedency chain was disabled by module_disable().');
$this->assertFalse(module_exists('php'), t('Disabling a module with unlisted dependents succeeded.')); $this->assertFalse(module_exists('php'), 'Disabling a module with unlisted dependents succeeded.');
$this->assertEqual(variable_get('test_module_disable_order', array()), array('forum', 'poll', 'php'), t('Modules were disabled in the correct order by module_disable().')); $this->assertEqual(variable_get('test_module_disable_order', array()), array('forum', 'poll', 'php'), 'Modules were disabled in the correct order by module_disable().');
// Disable a module that is listed as a dependency by the installation // Disable a module that is listed as a dependency by the installation
// profile. Make sure that the profile itself is not on the list of // profile. Make sure that the profile itself is not on the list of
// dependent modules to be disabled. // dependent modules to be disabled.
$profile = drupal_get_profile(); $profile = drupal_get_profile();
$info = install_profile_info($profile); $info = install_profile_info($profile);
$this->assertTrue(in_array('comment', $info['dependencies']), t('Comment module is listed as a dependency of the installation profile.')); $this->assertTrue(in_array('comment', $info['dependencies']), 'Comment module is listed as a dependency of the installation profile.');
$this->assertTrue(module_exists('comment'), t('Comment module is enabled.')); $this->assertTrue(module_exists('comment'), 'Comment module is enabled.');
module_disable(array('comment')); module_disable(array('comment'));
$this->assertFalse(module_exists('comment'), t('Comment module was disabled.')); $this->assertFalse(module_exists('comment'), 'Comment module was disabled.');
$disabled_modules = variable_get('test_module_disable_order', array()); $disabled_modules = variable_get('test_module_disable_order', array());
$this->assertTrue(in_array('comment', $disabled_modules), t('Comment module is in the list of disabled modules.')); $this->assertTrue(in_array('comment', $disabled_modules), 'Comment module is in the list of disabled modules.');
$this->assertFalse(in_array($profile, $disabled_modules), t('The installation profile is not in the list of disabled modules.')); $this->assertFalse(in_array($profile, $disabled_modules), 'The installation profile is not in the list of disabled modules.');
// Try to uninstall the PHP module by itself. This should be rejected, // Try to uninstall the PHP module by itself. This should be rejected,
// since the modules which it depends on need to be uninstalled first, and // since the modules which it depends on need to be uninstalled first, and
// that is too destructive to perform automatically. // that is too destructive to perform automatically.
$result = drupal_uninstall_modules(array('php')); $result = drupal_uninstall_modules(array('php'));
$this->assertFalse($result, t('Calling drupal_uninstall_modules() on a module whose dependents are not uninstalled fails.')); $this->assertFalse($result, 'Calling drupal_uninstall_modules() on a module whose dependents are not uninstalled fails.');
foreach (array('forum', 'poll', 'php') as $module) { foreach (array('forum', 'poll', 'php') as $module) {
$this->assertNotEqual(drupal_get_installed_schema_version($module), SCHEMA_UNINSTALLED, t('The @module module was not uninstalled.', array('@module' => $module))); $this->assertNotEqual(drupal_get_installed_schema_version($module), SCHEMA_UNINSTALLED, format_string('The @module module was not uninstalled.', array('@module' => $module)));
} }
// Now uninstall all three modules explicitly, but in the incorrect order, // Now uninstall all three modules explicitly, but in the incorrect order,
// and make sure that drupal_uninstal_modules() uninstalled them in the // and make sure that drupal_uninstal_modules() uninstalled them in the
// correct sequence. // correct sequence.
$result = drupal_uninstall_modules(array('poll', 'php', 'forum')); $result = drupal_uninstall_modules(array('poll', 'php', 'forum'));
$this->assertTrue($result, t('drupal_uninstall_modules() returns the correct value.')); $this->assertTrue($result, 'drupal_uninstall_modules() returns the correct value.');
foreach (array('forum', 'poll', 'php') as $module) { foreach (array('forum', 'poll', 'php') as $module) {
$this->assertEqual(drupal_get_installed_schema_version($module), SCHEMA_UNINSTALLED, t('The @module module was uninstalled.', array('@module' => $module))); $this->assertEqual(drupal_get_installed_schema_version($module), SCHEMA_UNINSTALLED, format_string('The @module module was uninstalled.', array('@module' => $module)));
} }
$this->assertEqual(variable_get('test_module_uninstall_order', array()), array('forum', 'poll', 'php'), t('Modules were uninstalled in the correct order by drupal_uninstall_modules().')); $this->assertEqual(variable_get('test_module_uninstall_order', array()), array('forum', 'poll', 'php'), 'Modules were uninstalled in the correct order by drupal_uninstall_modules().');
// Uninstall the profile module from above, and make sure that the profile // Uninstall the profile module from above, and make sure that the profile
// itself is not on the list of dependent modules to be uninstalled. // itself is not on the list of dependent modules to be uninstalled.
$result = drupal_uninstall_modules(array('comment')); $result = drupal_uninstall_modules(array('comment'));
$this->assertTrue($result, t('drupal_uninstall_modules() returns the correct value.')); $this->assertTrue($result, 'drupal_uninstall_modules() returns the correct value.');
$this->assertEqual(drupal_get_installed_schema_version('comment'), SCHEMA_UNINSTALLED, t('Comment module was uninstalled.')); $this->assertEqual(drupal_get_installed_schema_version('comment'), SCHEMA_UNINSTALLED, 'Comment module was uninstalled.');
$uninstalled_modules = variable_get('test_module_uninstall_order', array()); $uninstalled_modules = variable_get('test_module_uninstall_order', array());
$this->assertTrue(in_array('comment', $uninstalled_modules), t('Comment module is in the list of uninstalled modules.')); $this->assertTrue(in_array('comment', $uninstalled_modules), 'Comment module is in the list of uninstalled modules.');
$this->assertFalse(in_array($profile, $uninstalled_modules), t('The installation profile is not in the list of uninstalled modules.')); $this->assertFalse(in_array($profile, $uninstalled_modules), 'The installation profile is not in the list of uninstalled modules.');
// Enable forum module again, which should enable both the poll module and // Enable forum module again, which should enable both the poll module and
// php module. But, this time do it with poll module declaring a dependency // php module. But, this time do it with poll module declaring a dependency
@ -219,11 +219,11 @@ class ModuleUnitTest extends DrupalWebTestCase {
variable_set('dependency_test', 'version dependency'); variable_set('dependency_test', 'version dependency');
drupal_static_reset('system_rebuild_module_data'); drupal_static_reset('system_rebuild_module_data');
$result = module_enable(array('forum')); $result = module_enable(array('forum'));
$this->assertTrue($result, t('module_enable() returns the correct value.')); $this->assertTrue($result, 'module_enable() returns the correct value.');
// Verify that the fake dependency chain was installed. // Verify that the fake dependency chain was installed.
$this->assertTrue(module_exists('poll') && module_exists('php'), t('Dependency chain was installed by module_enable().')); $this->assertTrue(module_exists('poll') && module_exists('php'), 'Dependency chain was installed by module_enable().');
// Verify that the original module was installed. // Verify that the original module was installed.
$this->assertTrue(module_exists('forum'), t('Module installation with version dependencies succeeded.')); $this->assertTrue(module_exists('forum'), 'Module installation with version dependencies succeeded.');
// Finally, verify that the modules were enabled in the correct order. // Finally, verify that the modules were enabled in the correct order.
$enable_order = variable_get('test_module_enable_order', array()); $enable_order = variable_get('test_module_enable_order', array());
$php_position = array_search('php', $enable_order); $php_position = array_search('php', $enable_order);
@ -231,7 +231,7 @@ class ModuleUnitTest extends DrupalWebTestCase {
$forum_position = array_search('forum', $enable_order); $forum_position = array_search('forum', $enable_order);
$php_before_poll = $php_position !== FALSE && $poll_position !== FALSE && $php_position < $poll_position; $php_before_poll = $php_position !== FALSE && $poll_position !== FALSE && $php_position < $poll_position;
$poll_before_forum = $poll_position !== FALSE && $forum_position !== FALSE && $poll_position < $forum_position; $poll_before_forum = $poll_position !== FALSE && $forum_position !== FALSE && $poll_position < $forum_position;
$this->assertTrue($php_before_poll && $poll_before_forum, t('Modules were enabled in the correct order by module_enable().')); $this->assertTrue($php_before_poll && $poll_before_forum, 'Modules were enabled in the correct order by module_enable().');
} }
} }
@ -267,8 +267,8 @@ class ModuleInstallTestCase extends DrupalWebTestCase {
// Check for data that was inserted using drupal_write_record() while the // Check for data that was inserted using drupal_write_record() while the
// 'module_test' module was being installed and enabled. // 'module_test' module was being installed and enabled.
$data = db_query("SELECT data FROM {module_test}")->fetchCol(); $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_install()', $data), '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_enable()', $data), 'Data inserted using drupal_write_record() in hook_enable() is correctly saved.');
} }
} }
@ -299,6 +299,6 @@ class ModuleUninstallTestCase extends DrupalWebTestCase {
// Are the perms defined by module_test removed from {role_permission}. // 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(); $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.');
} }
} }

View File

@ -31,9 +31,9 @@ class ModuleTestCase extends DrupalWebTestCase {
$tables = db_find_tables(Database::getConnection()->prefixTables('{' . $base_table . '}') . '%'); $tables = db_find_tables(Database::getConnection()->prefixTables('{' . $base_table . '}') . '%');
if ($count) { 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)));
} }
/** /**
@ -50,7 +50,7 @@ class ModuleTestCase extends DrupalWebTestCase {
$tables_exist = FALSE; $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)));
} }
/** /**
@ -67,7 +67,7 @@ class ModuleTestCase extends DrupalWebTestCase {
$tables_exist = TRUE; $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)));
} }
/** /**
@ -87,7 +87,7 @@ class ModuleTestCase extends DrupalWebTestCase {
else { else {
$message = 'Module "@module" is not enabled.'; $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)));
} }
} }
@ -122,7 +122,7 @@ class ModuleTestCase extends DrupalWebTestCase {
->countQuery() ->countQuery()
->execute() ->execute()
->fetchField(); ->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)));
} }
} }
@ -152,7 +152,7 @@ class EnableDisableTestCase extends ModuleTestCase {
unset($modules[$name]); unset($modules[$name]);
} }
} }
$this->assertTrue(count($modules), t('Found @count core modules that we can try to enable in this test.', array('@count' => count($modules)))); $this->assertTrue(count($modules), format_string('Found @count core modules that we can try to enable in this test.', array('@count' => count($modules))));
// Enable the dblog module first, since we will be asserting the presence // Enable the dblog module first, since we will be asserting the presence
// of log messages throughout the test. // of log messages throughout the test.
@ -202,7 +202,7 @@ class EnableDisableTestCase extends ModuleTestCase {
if (count($modules_to_enable) > 1) { if (count($modules_to_enable) > 1) {
$this->drupalPost(NULL, array(), t('Continue')); $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 // Check that hook_modules_installed() and hook_modules_enabled() were
// invoked with the expected list of modules, that each module's // invoked with the expected list of modules, that each module's
@ -268,7 +268,7 @@ class EnableDisableTestCase extends ModuleTestCase {
$edit['modules[Core][' . $name . '][enable]'] = $name; $edit['modules[Core][' . $name . '][enable]'] = $name;
} }
$this->drupalPost('admin/modules', $edit, t('Save configuration')); $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.');
} }
/** /**
@ -315,7 +315,7 @@ class EnableDisableTestCase extends ModuleTestCase {
$edit = array(); $edit = array();
$edit['modules[Core][' . $module . '][enable]'] = FALSE; $edit['modules[Core][' . $module . '][enable]'] = FALSE;
$this->drupalPost('admin/modules', $edit, t('Save configuration')); $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); $this->assertModules(array($module), FALSE);
// Check that the appropriate hook was fired and the appropriate log // Check that the appropriate hook was fired and the appropriate log
@ -331,7 +331,7 @@ class EnableDisableTestCase extends ModuleTestCase {
$edit['uninstall[' . $module . ']'] = $module; $edit['uninstall[' . $module . ']'] = $module;
$this->drupalPost('admin/modules/uninstall', $edit, t('Uninstall')); $this->drupalPost('admin/modules/uninstall', $edit, t('Uninstall'));
$this->drupalPost(NULL, NULL, 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); $this->assertModules(array($module), FALSE);
// Check that the appropriate hook was fired and the appropriate log // Check that the appropriate hook was fired and the appropriate log
@ -372,7 +372,7 @@ class HookRequirementsTestCase extends ModuleTestCase {
$this->drupalPost('admin/modules', $edit, t('Save configuration')); $this->drupalPost('admin/modules', $edit, t('Save configuration'));
// Makes sure the module was NOT installed. // 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); $this->assertModules(array('requirements1_test'), FALSE);
} }
} }
@ -397,7 +397,7 @@ class ModuleDependencyTestCase extends ModuleTestCase {
$edit = array(); $edit = array();
$edit['modules[Core][translation][enable]'] = 'translation'; $edit['modules[Core][translation][enable]'] = 'translation';
$this->drupalPost('admin/modules', $edit, t('Save configuration')); $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'), FALSE); $this->assertModules(array('translation', 'locale'), FALSE);
@ -406,7 +406,7 @@ class ModuleDependencyTestCase extends ModuleTestCase {
$this->assertTableCount('locale', FALSE); $this->assertTableCount('locale', FALSE);
$this->drupalPost(NULL, NULL, t('Continue')); $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', 'locale'), TRUE); $this->assertModules(array('translation', 'locale'), TRUE);
@ -422,9 +422,9 @@ class ModuleDependencyTestCase extends ModuleTestCase {
// Test that the system_dependencies_test module is marked // Test that the system_dependencies_test module is marked
// as missing a dependency. // as missing a dependency.
$this->drupalGet('admin/modules'); $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]"]'); $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. // Force enable the system_dependencies_test module.
module_enable(array('system_dependencies_test'), FALSE); module_enable(array('system_dependencies_test'), FALSE);
@ -432,7 +432,7 @@ class ModuleDependencyTestCase extends ModuleTestCase {
// Verify that the module is forced to be disabled when submitting // Verify that the module is forced to be disabled when submitting
// the module page. // the module page.
$this->drupalPost('admin/modules', array(), t('Save configuration')); $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. // Confirm.
$this->drupalPost(NULL, NULL, t('Continue')); $this->drupalPost(NULL, NULL, t('Continue'));
@ -453,7 +453,7 @@ class ModuleDependencyTestCase extends ModuleTestCase {
'@version' => '1.0', '@version' => '1.0',
)), 'A module that depends on an incompatible version of a module is marked as such.'); )), '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]"]'); $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.');
} }
/** /**
@ -467,7 +467,7 @@ class ModuleDependencyTestCase extends ModuleTestCase {
'@module' => 'System incompatible core version test', '@module' => 'System incompatible core version test',
)), 'A module that depends on a module with an incompatible core version is marked as such.'); )), '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]"]'); $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.');
} }
/** /**
@ -484,7 +484,7 @@ class ModuleDependencyTestCase extends ModuleTestCase {
$this->drupalPost('admin/modules', $edit, t('Save configuration')); $this->drupalPost('admin/modules', $edit, t('Save configuration'));
// Makes sure the modules were NOT installed. // 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('requirements1_test'), FALSE);
$this->assertModules(array('requirements2_test'), FALSE); $this->assertModules(array('requirements2_test'), FALSE);
@ -543,18 +543,18 @@ class ModuleDependencyTestCase extends ModuleTestCase {
// Check that the taxonomy module cannot be uninstalled. // Check that the taxonomy module cannot be uninstalled.
$this->drupalGet('admin/modules/uninstall'); $this->drupalGet('admin/modules/uninstall');
$checkbox = $this->xpath('//input[@type="checkbox" and @disabled="disabled" and @name="uninstall[comment]"]'); $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 // Uninstall the forum module, and check that taxonomy now can also be
// uninstalled. // uninstalled.
$edit = array('uninstall[forum]' => 'forum'); $edit = array('uninstall[forum]' => 'forum');
$this->drupalPost('admin/modules/uninstall', $edit, t('Uninstall')); $this->drupalPost('admin/modules/uninstall', $edit, t('Uninstall'));
$this->drupalPost(NULL, NULL, 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'); $edit = array('uninstall[comment]' => 'comment');
$this->drupalPost('admin/modules/uninstall', $edit, t('Uninstall')); $this->drupalPost('admin/modules/uninstall', $edit, t('Uninstall'));
$this->drupalPost(NULL, NULL, 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.');
} }
} }
@ -643,7 +643,7 @@ class ModuleRequiredTestCase extends ModuleTestCase {
if (!empty($info['required'])) { if (!empty($info['required'])) {
$field_name = "modules[{$info['package']}][$module][enable]"; $field_name = "modules[{$info['package']}][$module][enable]";
if (empty($info['hidden'])) { 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 { else {
$this->assertNoFieldByName($field_name); $this->assertNoFieldByName($field_name);