diff options
Diffstat (limited to 'modules/system/system.test')
-rw-r--r-- | modules/system/system.test | 296 |
1 files changed, 148 insertions, 148 deletions
diff --git a/modules/system/system.test b/modules/system/system.test index 1d665bf94..7d5350153 100644 --- a/modules/system/system.test +++ b/modules/system/system.test @@ -27,9 +27,9 @@ class ModuleTestCase extends DrupalWebTestCase { $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, 'Tables matching "' . $base_table . '" found.'); } - return $this->assertFalse($tables, t('Tables matching "@base_table" not found.', array('@base_table' => $base_table))); + return $this->assertFalse($tables, 'Tables matching "' . $base_table . '" not found.'); } /** @@ -49,7 +49,7 @@ class ModuleTestCase extends DrupalWebTestCase { else { $message = 'Module "@module" is not enabled.'; } - $this->assertEqual(module_exists($module), $enabled, t($message, array('@module' => $module))); + $this->assertEqual(module_exists($module), $enabled, $message); } } @@ -84,7 +84,7 @@ class ModuleTestCase extends DrupalWebTestCase { ->countQuery() ->execute() ->fetchField(); - $this->assertTrue($count > 0, t('watchdog table contains @count rows for @message', array('@count' => $count, '@message' => $message))); + $this->assertTrue($count > 0, 'watchdog table contains ' . $count . ' rows for ' . $message); } } @@ -115,11 +115,11 @@ class EnableDisableTestCase extends ModuleTestCase { $edit['modules[Core][aggregator][enable]'] = 'aggregator'; $edit['modules[Core][forum][enable]'] = 'forum'; $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.'); // Check that hook_modules_installed and hook_modules_enabled hooks were invoked and check tables. - $this->assertText(t('hook_modules_installed fired for aggregator'), t('hook_modules_installed fired.')); - $this->assertText(t('hook_modules_enabled fired for aggregator'), t('hook_modules_enabled fired.')); + $this->assertText(t('hook_modules_installed fired for aggregator'), 'hook_modules_installed fired.'); + $this->assertText(t('hook_modules_enabled fired for aggregator'), 'hook_modules_enabled fired.'); $this->assertModules(array('aggregator'), TRUE); $this->assertTableCount('aggregator', TRUE); $this->assertLogMessage('system', "%module module installed.", array('%module' => 'aggregator'), WATCHDOG_INFO); @@ -129,10 +129,10 @@ class EnableDisableTestCase extends ModuleTestCase { $edit = array(); $edit['modules[Core][aggregator][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.'); // Check that hook_modules_disabled hook was invoked and check tables. - $this->assertText(t('hook_modules_disabled fired for aggregator'), t('hook_modules_disabled fired.')); + $this->assertText(t('hook_modules_disabled fired for aggregator'), 'hook_modules_disabled fired.'); $this->assertModules(array('aggregator'), FALSE); $this->assertTableCount('aggregator', TRUE); $this->assertLogMessage('system', "%module module disabled.", array('%module' => 'aggregator'), WATCHDOG_INFO); @@ -143,10 +143,10 @@ class EnableDisableTestCase extends ModuleTestCase { $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.'); // Check that hook_modules_uninstalled hook was invoked and check tables. - $this->assertText(t('hook_modules_uninstalled fired for aggregator'), t('hook_modules_uninstalled fired.')); + $this->assertText(t('hook_modules_uninstalled fired for aggregator'), 'hook_modules_uninstalled fired.'); $this->assertModules(array('aggregator'), FALSE); $this->assertTableCount('aggregator', FALSE); $this->assertLogMessage('system', "%module module uninstalled.", array('%module' => 'aggregator'), WATCHDOG_INFO); @@ -155,7 +155,7 @@ class EnableDisableTestCase extends ModuleTestCase { $edit = array(); $edit['modules[Core][aggregator][enable]'] = 'aggregator'; $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.'); } /** @@ -165,7 +165,7 @@ class EnableDisableTestCase extends ModuleTestCase { function testEntityCache() { module_enable(array('entity_cache_test')); $info = variable_get('entity_cache_test'); - $this->assertNotNull($info, t('Entity information must not be NULL')); + $this->assertNotNull($info, 'Entity information must not be NULL'); } } @@ -193,7 +193,7 @@ class HookRequirementsTestCase extends ModuleTestCase { $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); } } @@ -218,7 +218,7 @@ class ModuleDependencyTestCase extends ModuleTestCase { $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('Dependecy required.')); + $this->assertText(t('Some required modules must be enabled'), 'Dependecy required.'); $this->assertModules(array('translation', 'locale'), FALSE); @@ -227,7 +227,7 @@ class ModuleDependencyTestCase extends ModuleTestCase { $this->assertTableCount('locale', 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', 'locale'), TRUE); @@ -243,9 +243,9 @@ class ModuleDependencyTestCase extends ModuleTestCase { // 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); @@ -253,7 +253,7 @@ class ModuleDependencyTestCase extends ModuleTestCase { // 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')); @@ -276,7 +276,7 @@ class ModuleDependencyTestCase extends ModuleTestCase { $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); @@ -372,7 +372,7 @@ class ModuleRequiredTestCase extends ModuleTestCase { 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']", '', 'Field ' . $field_name . ' was disabled and checked.'); } else { $this->assertNoFieldByName($field_name); @@ -418,8 +418,8 @@ class IPAddressBlockingTestCase extends DrupalWebTestCase { $edit['ip'] = '192.168.1.1'; $this->drupalPost('admin/config/people/ip-blocking', $edit, t('Add')); $ip = db_query("SELECT iid from {blocked_ips} WHERE ip = :ip", array(':ip' => $edit['ip']))->fetchField(); - $this->assertTrue($ip, t('IP address found in database.')); - $this->assertRaw(t('The IP address %ip has been blocked.', array('%ip' => $edit['ip'])), t('IP address was blocked.')); + $this->assertTrue($ip, 'IP address found in database.'); + $this->assertRaw(t('The IP address %ip has been blocked.', array('%ip' => $edit['ip'])), 'IP address was blocked.'); // Try to block an IP address that's already blocked. $edit = array(); @@ -449,15 +449,15 @@ class IPAddressBlockingTestCase extends DrupalWebTestCase { $submit_ip = '1.2.3.4'; $this->drupalPost('admin/config/people/ip-blocking/' . $submit_ip, NULL, t('Add')); $ip = db_query("SELECT iid from {blocked_ips} WHERE ip = :ip", array(':ip' => $submit_ip))->fetchField(); - $this->assertTrue($ip, t('IP address found in database')); - $this->assertRaw(t('The IP address %ip has been blocked.', array('%ip' => $submit_ip)), t('IP address was blocked.')); + $this->assertTrue($ip, 'IP address found in database'); + $this->assertRaw(t('The IP address %ip has been blocked.', array('%ip' => $submit_ip)), 'IP address was blocked.'); // Submit your own IP address. This fails, although it works when testing manually. - // TODO: on some systems this test fails due to a bug or inconsistency in cURL. - // $edit = array(); - // $edit['ip'] = ip_address(); - // $this->drupalPost('admin/config/people/ip-blocking', $edit, t('Save')); - // $this->assertText(t('You may not block your own IP address.')); + // TODO: on some systems this test fails due to a bug or inconsistency in cURL. + // $edit = array(); + // $edit['ip'] = ip_address(); + // $this->drupalPost('admin/config/people/ip-blocking', $edit, t('Save')); + // $this->assertText(t('You may not block your own IP address.')); } } @@ -508,14 +508,14 @@ class CronRunTestCase extends DrupalWebTestCase { variable_set('cron_last', $cron_last); variable_set('cron_safe_threshold', $cron_safe_threshold); $this->drupalGet(''); - $this->assertTrue($cron_last == variable_get('cron_last', NULL), t('Cron does not run when the cron threshold is not passed.')); + $this->assertTrue($cron_last == variable_get('cron_last', NULL), 'Cron does not run when the cron threshold is not passed.'); // Test if cron runs when the cron threshold was passed. $cron_last = time() - 200; variable_set('cron_last', $cron_last); $this->drupalGet(''); sleep(1); - $this->assertTrue($cron_last < variable_get('cron_last', NULL), t('Cron runs when the cron threshold is passed.')); + $this->assertTrue($cron_last < variable_get('cron_last', NULL), 'Cron runs when the cron threshold is passed.'); // Disable the cron threshold through the interface. $admin_user = $this->drupalCreateUser(array('administer site configuration')); @@ -528,7 +528,7 @@ class CronRunTestCase extends DrupalWebTestCase { $cron_last = time() - 200; variable_set('cron_last', $cron_last); $this->drupalGet(''); - $this->assertTrue($cron_last == variable_get('cron_last', NULL), t('Cron does not run when the cron threshold is disabled.')); + $this->assertTrue($cron_last == variable_get('cron_last', NULL), 'Cron does not run when the cron threshold is disabled.'); } /** @@ -548,7 +548,7 @@ class CronRunTestCase extends DrupalWebTestCase { )) ->condition('fid', $temp_old->fid) ->execute(); - $this->assertTrue(file_exists($temp_old->uri), t('Old temp file was created correctly.')); + $this->assertTrue(file_exists($temp_old->uri), 'Old temp file was created correctly.'); // Temporary file that is less than DRUPAL_MAXIMUM_TEMP_FILE_AGE. $temp_new = file_save_data(''); @@ -556,7 +556,7 @@ class CronRunTestCase extends DrupalWebTestCase { ->fields(array('status' => 0)) ->condition('fid', $temp_new->fid) ->execute(); - $this->assertTrue(file_exists($temp_new->uri), t('New temp file was created correctly.')); + $this->assertTrue(file_exists($temp_new->uri), 'New temp file was created correctly.'); // Permanent file that is older than DRUPAL_MAXIMUM_TEMP_FILE_AGE. $perm_old = file_save_data(''); @@ -564,18 +564,18 @@ class CronRunTestCase extends DrupalWebTestCase { ->fields(array('timestamp' => 1)) ->condition('fid', $temp_old->fid) ->execute(); - $this->assertTrue(file_exists($perm_old->uri), t('Old permanent file was created correctly.')); + $this->assertTrue(file_exists($perm_old->uri), 'Old permanent file was created correctly.'); // Permanent file that is newer than DRUPAL_MAXIMUM_TEMP_FILE_AGE. $perm_new = file_save_data(''); - $this->assertTrue(file_exists($perm_new->uri), t('New permanent file was created correctly.')); + $this->assertTrue(file_exists($perm_new->uri), 'New permanent file was created correctly.'); // Run cron and then ensure that only the old, temp file was deleted. $this->cronRun(); - $this->assertFalse(file_exists($temp_old->uri), t('Old temp file was correctly removed.')); - $this->assertTrue(file_exists($temp_new->uri), t('New temp file was correctly ignored.')); - $this->assertTrue(file_exists($perm_old->uri), t('Old permanent file was correctly ignored.')); - $this->assertTrue(file_exists($perm_new->uri), t('New permanent file was correctly ignored.')); + $this->assertFalse(file_exists($temp_old->uri), 'Old temp file was correctly removed.'); + $this->assertTrue(file_exists($temp_new->uri), 'New temp file was correctly ignored.'); + $this->assertTrue(file_exists($perm_old->uri), 'Old permanent file was correctly ignored.'); + $this->assertTrue(file_exists($perm_new->uri), 'New permanent file was correctly ignored.'); } } @@ -595,10 +595,10 @@ class AdminMetaTagTestCase extends DrupalWebTestCase { * Verify that the meta tag HTML is generated correctly. */ public function testMetaTag() { - list($version, ) = explode('.', VERSION); + list($version, ) = explode('.', VERSION); $string = '<meta name="Generator" content="Drupal ' . $version . ' (http://drupal.org)" />'; $this->drupalGet('node'); - $this->assertRaw($string, t('Fingerprinting meta tag generated correctly.'), t('System')); + $this->assertRaw($string, 'Fingerprinting meta tag generated correctly.', 'System'); } } @@ -626,7 +626,7 @@ class AccessDeniedTestCase extends DrupalWebTestCase { function testAccessDenied() { $this->drupalGet('admin'); - $this->assertText(t('Access denied'), t('Found the default 403 page')); + $this->assertText(t('Access denied'), 'Found the default 403 page'); $this->assertResponse(403); $edit = array( @@ -639,14 +639,14 @@ class AccessDeniedTestCase extends DrupalWebTestCase { $this->drupalPost('admin/config/system/site-information', array('site_403' => 'node/' . $node->nid), t('Save configuration')); $this->drupalGet('admin'); - $this->assertText($node->title, t('Found the custom 403 page')); + $this->assertText($node->title, 'Found the custom 403 page'); // Logout and check that the user login block is shown on custom 403 pages. $this->drupalLogout(); $this->drupalGet('admin'); - $this->assertText($node->title, t('Found the custom 403 page')); - $this->assertText(t('User login'), t('Blocks are shown on the custom 403 page')); + $this->assertText($node->title, 'Found the custom 403 page'); + $this->assertText(t('User login'), 'Blocks are shown on the custom 403 page'); // Log back in and remove the custom 403 page. $this->drupalLogin($this->admin_user); @@ -656,9 +656,9 @@ class AccessDeniedTestCase extends DrupalWebTestCase { $this->drupalLogout(); $this->drupalGet('admin'); - $this->assertText(t('Access denied'), t('Found the default 403 page')); + $this->assertText(t('Access denied'), 'Found the default 403 page'); $this->assertResponse(403); - $this->assertText(t('User login'), t('Blocks are shown on the default 403 page')); + $this->assertText(t('User login'), 'Blocks are shown on the default 403 page'); // Log back in, set the custom 403 page to /user and remove the block $this->drupalLogin($this->admin_user); @@ -705,7 +705,7 @@ class PageNotFoundTestCase extends DrupalWebTestCase { function testPageNotFound() { $this->drupalGet($this->randomName(10)); - $this->assertText(t('Page not found'), t('Found the default 404 page')); + $this->assertText(t('Page not found'), 'Found the default 404 page'); $edit = array( 'title' => $this->randomName(10), @@ -717,7 +717,7 @@ class PageNotFoundTestCase extends DrupalWebTestCase { $this->drupalPost('admin/config/system/site-information', array('site_404' => 'node/' . $node->nid), t('Save configuration')); $this->drupalGet($this->randomName(10)); - $this->assertText($node->title, t('Found the custom 404 page')); + $this->assertText($node->title, 'Found the custom 404 page'); } } @@ -760,7 +760,7 @@ class SiteMaintenanceTestCase extends DrupalWebTestCase { $offline_message = t('@site is currently under maintenance. We should be back shortly. Thank you for your patience.', array('@site' => variable_get('site_name', 'Drupal'))); $this->drupalGet(''); - $this->assertRaw($admin_message, t('Found the site maintenance mode message.')); + $this->assertRaw($admin_message, 'Found the site maintenance mode message.'); // Logout and verify that offline message is displayed. $this->drupalLogout(); @@ -790,7 +790,7 @@ class SiteMaintenanceTestCase extends DrupalWebTestCase { $this->drupalLogout(); $this->drupalLogin($this->admin_user); $this->drupalGet('admin/config/development/maintenance'); - $this->assertNoRaw($admin_message, t('Site maintenance mode message not displayed.')); + $this->assertNoRaw($admin_message, 'Site maintenance mode message not displayed.'); $offline_message = 'Sorry, not online.'; $edit = array( @@ -801,11 +801,11 @@ class SiteMaintenanceTestCase extends DrupalWebTestCase { // Logout and verify that custom site offline message is displayed. $this->drupalLogout(); $this->drupalGet(''); - $this->assertRaw($offline_message, t('Found the site offline message.')); + $this->assertRaw($offline_message, 'Found the site offline message.'); // Verify that custom site offline message is not displayed on user/password. $this->drupalGet('user/password'); - $this->assertText(t('Username or e-mail address'), t('Anonymous users can access user/password')); + $this->assertText(t('Username or e-mail address'), 'Anonymous users can access user/password'); // Submit password reset form. $edit = array( @@ -813,7 +813,7 @@ class SiteMaintenanceTestCase extends DrupalWebTestCase { ); $this->drupalPost('user/password', $edit, t('E-mail new password')); $mails = $this->drupalGetMails(); - $start = strpos($mails[0]['body'], 'user/reset/'. $this->user->uid); + $start = strpos($mails[0]['body'], 'user/reset/' . $this->user->uid); $path = substr($mails[0]['body'], $start, 66 + strlen($this->user->uid)); // Log in with temporary login link. @@ -860,18 +860,18 @@ class DateTimeFunctionalTest extends DrupalWebTestCase { // Confirm date format and time zone. $this->drupalGet("node/$node1->nid"); - $this->assertText('2007-01-31 21:00:00 -1000', t('Date should be identical, with GMT offset of -10 hours.')); + $this->assertText('2007-01-31 21:00:00 -1000', 'Date should be identical, with GMT offset of -10 hours.'); $this->drupalGet("node/$node2->nid"); - $this->assertText('2007-07-31 21:00:00 -1000', t('Date should be identical, with GMT offset of -10 hours.')); + $this->assertText('2007-07-31 21:00:00 -1000', 'Date should be identical, with GMT offset of -10 hours.'); // Set time zone to Los Angeles time. variable_set('date_default_timezone', 'America/Los_Angeles'); // Confirm date format and time zone. $this->drupalGet("node/$node1->nid"); - $this->assertText('2007-01-31 23:00:00 -0800', t('Date should be two hours ahead, with GMT offset of -8 hours.')); + $this->assertText('2007-01-31 23:00:00 -0800', 'Date should be two hours ahead, with GMT offset of -8 hours.'); $this->drupalGet("node/$node2->nid"); - $this->assertText('2007-08-01 00:00:00 -0700', t('Date should be three hours ahead, with GMT offset of -7 hours.')); + $this->assertText('2007-08-01 00:00:00 -0700', 'Date should be three hours ahead, with GMT offset of -7 hours.'); } /** @@ -894,7 +894,7 @@ class DateTimeFunctionalTest extends DrupalWebTestCase { 'date_format' => $date_format, ); $this->drupalPost('admin/config/regional/date-time/types/add', $edit, t('Add date type')); - $this->assertEqual($this->getUrl(), url('admin/config/regional/date-time', array('absolute' => TRUE)), t('Correct page redirection.')); + $this->assertEqual($this->getUrl(), url('admin/config/regional/date-time', array('absolute' => TRUE)), 'Correct page redirection.'); $this->assertText(t('New date type added successfully.'), 'Date type added confirmation message appears.'); $this->assertText($date_type, 'Custom date type appears in the date type list.'); $this->assertText(t('delete'), 'Delete link for custom date type appears.'); @@ -902,7 +902,7 @@ class DateTimeFunctionalTest extends DrupalWebTestCase { // Delete custom date type. $this->clickLink(t('delete')); $this->drupalPost('admin/config/regional/date-time/types/' . $machine_name . '/delete', array(), t('Remove')); - $this->assertEqual($this->getUrl(), url('admin/config/regional/date-time', array('absolute' => TRUE)), t('Correct page redirection.')); + $this->assertEqual($this->getUrl(), url('admin/config/regional/date-time', array('absolute' => TRUE)), 'Correct page redirection.'); $this->assertText(t('Removed date type ' . $date_type), 'Custom date type removed.'); } @@ -920,7 +920,7 @@ class DateTimeFunctionalTest extends DrupalWebTestCase { 'date_format' => 'Y', ); $this->drupalPost('admin/config/regional/date-time/formats/add', $edit, t('Add format')); - $this->assertEqual($this->getUrl(), url('admin/config/regional/date-time/formats', array('absolute' => TRUE)), t('Correct page redirection.')); + $this->assertEqual($this->getUrl(), url('admin/config/regional/date-time/formats', array('absolute' => TRUE)), 'Correct page redirection.'); $this->assertNoText(t('No custom date formats available.'), 'No custom date formats message does not appear.'); $this->assertText(t('Custom date format added.'), 'Custom date format added.'); @@ -935,13 +935,13 @@ class DateTimeFunctionalTest extends DrupalWebTestCase { 'date_format' => 'Y m', ); $this->drupalPost($this->getUrl(), $edit, t('Save format')); - $this->assertEqual($this->getUrl(), url('admin/config/regional/date-time/formats', array('absolute' => TRUE)), t('Correct page redirection.')); + $this->assertEqual($this->getUrl(), url('admin/config/regional/date-time/formats', array('absolute' => TRUE)), 'Correct page redirection.'); $this->assertText(t('Custom date format updated.'), 'Custom date format successfully updated.'); // Delete custom date format. $this->clickLink(t('delete')); $this->drupalPost($this->getUrl(), array(), t('Remove')); - $this->assertEqual($this->getUrl(), url('admin/config/regional/date-time/formats', array('absolute' => TRUE)), t('Correct page redirection.')); + $this->assertEqual($this->getUrl(), url('admin/config/regional/date-time/formats', array('absolute' => TRUE)), 'Correct page redirection.'); $this->assertText(t('Removed date format'), 'Custom date format removed successfully.'); } } @@ -990,11 +990,11 @@ class PageTitleFiltering extends DrupalWebTestCase { // drupal_set_title's $filter is CHECK_PLAIN by default, so the title should be // returned with check_plain(). drupal_set_title($title, CHECK_PLAIN); - $this->assertTrue(strpos(drupal_get_title(), '<em>') === FALSE, t('Tags in title converted to entities when $output is CHECK_PLAIN.')); + $this->assertTrue(strpos(drupal_get_title(), '<em>') === FALSE, 'Tags in title converted to entities when $output is CHECK_PLAIN.'); // drupal_set_title's $filter is passed as PASS_THROUGH, so the title should be // returned with HTML. drupal_set_title($title, PASS_THROUGH); - $this->assertTrue(strpos(drupal_get_title(), '<em>') !== FALSE, t('Tags in title are not converted to entities when $output is PASS_THROUGH.')); + $this->assertTrue(strpos(drupal_get_title(), '<em>') !== FALSE, 'Tags in title are not converted to entities when $output is PASS_THROUGH.'); // Generate node content. $langcode = LANGUAGE_NONE; $edit = array( @@ -1081,11 +1081,11 @@ class FrontPageTestCase extends DrupalWebTestCase { */ function testDrupalIsFrontPage() { $this->drupalGet(''); - $this->assertText(t('On front page.'), t('Path is the front page.')); + $this->assertText(t('On front page.'), 'Path is the front page.'); $this->drupalGet('node'); - $this->assertText(t('On front page.'), t('Path is the front page.')); + $this->assertText(t('On front page.'), 'Path is the front page.'); $this->drupalGet($this->node_path); - $this->assertNoText(t('On front page.'), t('Path is not the front page.')); + $this->assertNoText(t('On front page.'), 'Path is not the front page.'); // Change the front page to an invalid path. $edit = array('site_frontpage' => 'kittens'); @@ -1095,14 +1095,14 @@ class FrontPageTestCase extends DrupalWebTestCase { // Change the front page to a valid path. $edit['site_frontpage'] = $this->node_path; $this->drupalPost('admin/config/system/site-information', $edit, t('Save configuration')); - $this->assertText(t('The configuration options have been saved.'), t('The front page path has been saved.')); + $this->assertText(t('The configuration options have been saved.'), 'The front page path has been saved.'); $this->drupalGet(''); - $this->assertText(t('On front page.'), t('Path is the front page.')); + $this->assertText(t('On front page.'), 'Path is the front page.'); $this->drupalGet('node'); - $this->assertNoText(t('On front page.'), t('Path is not the front page.')); + $this->assertNoText(t('On front page.'), 'Path is not the front page.'); $this->drupalGet($this->node_path); - $this->assertText(t('On front page.'), t('Path is the front page.')); + $this->assertText(t('On front page.'), 'Path is the front page.'); } } @@ -1129,17 +1129,17 @@ class SystemBlockTestCase extends DrupalWebTestCase { function testPoweredByBlock() { // Set block title and some settings to confirm that the interface is available. $this->drupalPost('admin/structure/block/manage/system/powered-by/configure', array('title' => $this->randomName(8)), t('Save block')); - $this->assertText(t('The block configuration has been saved.'), t('Block configuration set.')); + $this->assertText(t('The block configuration has been saved.'), 'Block configuration set.'); // Set the powered-by block to the footer region. $edit = array(); $edit['system_powered-by[region]'] = 'footer'; $this->drupalPost('admin/structure/block', $edit, t('Save blocks')); - $this->assertText(t('The block settings have been updated.'), t('Block successfully moved to footer region.')); + $this->assertText(t('The block settings have been updated.'), 'Block successfully moved to footer region.'); // Confirm that the block is being displayed. $this->drupalGet('node'); - $this->assertRaw('id="block-system-powered-by"', t('Block successfully being displayed on the page.')); + $this->assertRaw('id="block-system-powered-by"', 'Block successfully being displayed on the page.'); // Set the block to the disabled region. $edit = array(); @@ -1147,7 +1147,7 @@ class SystemBlockTestCase extends DrupalWebTestCase { $this->drupalPost('admin/structure/block', $edit, t('Save blocks')); // Confirm that the block is hidden. - $this->assertNoRaw('id="block-system-powered-by"', t('Block no longer appears on page.')); + $this->assertNoRaw('id="block-system-powered-by"', 'Block no longer appears on page.'); // For convenience of developers, set the block to its default settings. $edit = array(); @@ -1197,47 +1197,47 @@ class SystemMainContentFallback extends DrupalWebTestCase { // Disable the dashboard module, which depends on the block module. $edit['modules[Core][dashboard][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.'); // Disable the block module. $edit['modules[Core][block][enable]'] = FALSE; $this->drupalPost('admin/modules', $edit, t('Save configuration')); - $this->assertText(t('The configuration options have been saved.'), t('Modules status has been updated.')); + $this->assertText(t('The configuration options have been saved.'), 'Modules status has been updated.'); module_list(TRUE); - $this->assertFalse(module_exists('block'), t('Block module disabled.')); + $this->assertFalse(module_exists('block'), 'Block module disabled.'); // At this point, no region is filled and fallback should be triggered. $this->drupalGet('admin/config/system/site-information'); - $this->assertField('site_name', t('Admin interface still available.')); + $this->assertField('site_name', 'Admin interface still available.'); // Fallback should not trigger when another module is handling content. $this->drupalGet('system-test/main-content-handling'); - $this->assertRaw('id="system-test-content"', t('Content handled by another module')); - $this->assertText(t('Content to test main content fallback'), t('Main content still displayed.')); + $this->assertRaw('id="system-test-content"', 'Content handled by another module'); + $this->assertText(t('Content to test main content fallback'), 'Main content still displayed.'); // Fallback should trigger when another module // indicates that it is not handling the content. $this->drupalGet('system-test/main-content-fallback'); - $this->assertText(t('Content to test main content fallback'), t('Main content fallback properly triggers.')); + $this->assertText(t('Content to test main content fallback'), 'Main content fallback properly triggers.'); // Fallback should not trigger when another module is handling content. // Note that this test ensures that no duplicate // content gets created by the fallback. $this->drupalGet('system-test/main-content-duplication'); - $this->assertNoText(t('Content to test main content fallback'), t('Main content not duplicated.')); + $this->assertNoText(t('Content to test main content fallback'), 'Main content not duplicated.'); // Request a user* page and see if it is displayed. $this->drupalLogin($this->web_user); $this->drupalGet('user/' . $this->web_user->uid . '/edit'); - $this->assertField('mail', t('User interface still available.')); + $this->assertField('mail', 'User interface still available.'); // Enable the block module again. $this->drupalLogin($this->admin_user); $edit = array(); $edit['modules[Core][block][enable]'] = 'block'; $this->drupalPost('admin/modules', $edit, t('Save configuration')); - $this->assertText(t('The configuration options have been saved.'), t('Modules status has been updated.')); + $this->assertText(t('The configuration options have been saved.'), 'Modules status has been updated.'); module_list(TRUE); - $this->assertTrue(module_exists('block'), t('Block module re-enabled.')); + $this->assertTrue(module_exists('block'), 'Block module re-enabled.'); } } @@ -1273,7 +1273,7 @@ class SystemThemeFunctionalTest extends DrupalWebTestCase { ); $this->drupalPost('admin/appearance/settings', $edit, t('Save configuration')); $this->drupalGet('node'); - $this->assertRaw($file->uri, t('Logo path successfully changed.')); + $this->assertRaw($file->uri, 'Logo path successfully changed.'); // Upload a file to use for the logo. $file = current($this->drupalGetTestFiles('image')); @@ -1285,7 +1285,7 @@ class SystemThemeFunctionalTest extends DrupalWebTestCase { $options = array(); $this->drupalPost('admin/appearance/settings', $edit, t('Save configuration'), $options); $this->drupalGet('node'); - $this->assertRaw($file->name, t('Logo file successfully uploaded.')); + $this->assertRaw($file->name, 'Logo file successfully uploaded.'); } /** @@ -1302,16 +1302,16 @@ class SystemThemeFunctionalTest extends DrupalWebTestCase { $this->drupalPost('admin/appearance', $edit, t('Save configuration')); $this->drupalGet('admin/config'); - $this->assertRaw('themes/garland', t('Administration theme used on an administration page.')); + $this->assertRaw('themes/garland', 'Administration theme used on an administration page.'); $this->drupalGet('node/' . $this->node->nid); - $this->assertRaw('themes/stark', t('Site default theme used on node page.')); + $this->assertRaw('themes/stark', 'Site default theme used on node page.'); $this->drupalGet('node/add'); - $this->assertRaw('themes/garland', t('Administration theme used on the add content page.')); + $this->assertRaw('themes/garland', 'Administration theme used on the add content page.'); $this->drupalGet('node/' . $this->node->nid . '/edit'); - $this->assertRaw('themes/garland', t('Administration theme used on the edit content page.')); + $this->assertRaw('themes/garland', 'Administration theme used on the edit content page.'); // Disable the admin theme on the node admin pages. $edit = array( @@ -1320,10 +1320,10 @@ class SystemThemeFunctionalTest extends DrupalWebTestCase { $this->drupalPost('admin/appearance', $edit, t('Save configuration')); $this->drupalGet('admin/config'); - $this->assertRaw('themes/garland', t('Administration theme used on an administration page.')); + $this->assertRaw('themes/garland', 'Administration theme used on an administration page.'); $this->drupalGet('node/add'); - $this->assertRaw('themes/stark', t('Site default theme used on the add content page.')); + $this->assertRaw('themes/stark', 'Site default theme used on the add content page.'); // Reset to the default theme settings. variable_set('theme_default', 'garland'); @@ -1334,10 +1334,10 @@ class SystemThemeFunctionalTest extends DrupalWebTestCase { $this->drupalPost('admin/appearance', $edit, t('Save configuration')); $this->drupalGet('admin'); - $this->assertRaw('themes/garland', t('Site default theme used on administration page.')); + $this->assertRaw('themes/garland', 'Site default theme used on administration page.'); $this->drupalGet('node/add'); - $this->assertRaw('themes/garland', t('Site default theme used on the add content page.')); + $this->assertRaw('themes/garland', 'Site default theme used on the add content page.'); } } @@ -1385,14 +1385,14 @@ class QueueTestCase extends DrupalWebTestCase { $new_items[] = $item->data; // First two dequeued items should match the first two items we queued. - $this->assertEqual($this->queueScore($data, $new_items), 2, t('Two items matched')); + $this->assertEqual($this->queueScore($data, $new_items), 2, 'Two items matched'); // Add two more items. $queue1->createItem($data[2]); $queue1->createItem($data[3]); - $this->assertTrue($queue1->numberOfItems(), t('Queue 1 is not empty after adding items.')); - $this->assertFalse($queue2->numberOfItems(), t('Queue 2 is empty while Queue 1 has items')); + $this->assertTrue($queue1->numberOfItems(), 'Queue 1 is not empty after adding items.'); + $this->assertFalse($queue2->numberOfItems(), 'Queue 2 is empty while Queue 1 has items'); $items[] = $item = $queue1->claimItem(); $new_items[] = $item->data; @@ -1402,10 +1402,10 @@ class QueueTestCase extends DrupalWebTestCase { // All dequeued items should match the items we queued exactly once, // therefore the score must be exactly 4. - $this->assertEqual($this->queueScore($data, $new_items), 4, t('Four items matched')); + $this->assertEqual($this->queueScore($data, $new_items), 4, 'Four items matched'); // There should be no duplicate items. - $this->assertEqual($this->queueScore($new_items, $new_items), 4, t('Four items matched')); + $this->assertEqual($this->queueScore($new_items, $new_items), 4, 'Four items matched'); // Delete all items from queue1. foreach ($items as $item) { @@ -1413,8 +1413,8 @@ class QueueTestCase extends DrupalWebTestCase { } // Check that both queues are empty. - $this->assertFalse($queue1->numberOfItems(), t('Queue 1 is empty')); - $this->assertFalse($queue2->numberOfItems(), t('Queue 2 is empty')); + $this->assertFalse($queue1->numberOfItems(), 'Queue 1 is empty'); + $this->assertFalse($queue2->numberOfItems(), 'Queue 2 is empty'); } /** @@ -1455,13 +1455,13 @@ class TokenReplaceTestCase extends DrupalWebTestCase { $node->title = '<blink>Blinking Text</blink>'; global $user, $language; - $source = '[node:title]'; // Title of the node we passed in - $source .= '[node:author:name]'; // Node author's name + $source = '[node:title]'; // Title of the node we passed in + $source .= '[node:author:name]'; // Node author's name $source .= '[node:created:since]'; // Time since the node was created - $source .= '[current-user:name]'; // Current user's name - $source .= '[date:short]'; // Short date format of REQUEST_TIME - $source .= '[user:name]'; // No user passed in, should be untouched - $source .= '[bogus:token]'; // Non-existent token + $source .= '[current-user:name]'; // Current user's name + $source .= '[date:short]'; // Short date format of REQUEST_TIME + $source .= '[user:name]'; // No user passed in, should be untouched + $source .= '[bogus:token]'; // Non-existent token $target = check_plain($node->title); $target .= check_plain($account->name); @@ -1485,10 +1485,10 @@ class TokenReplaceTestCase extends DrupalWebTestCase { // token, [node:title]. $raw_tokens = array('title' => '[node:title]'); $generated = token_generate('node', $raw_tokens, array('node' => $node)); - $this->assertFalse(strcmp($generated['[node:title]'], check_plain($node->title)), t('Token sanitized.')); + $this->assertFalse(strcmp($generated['[node:title]'], check_plain($node->title)), 'Token sanitized.'); $generated = token_generate('node', $raw_tokens, array('node' => $node), array('sanitize' => FALSE)); - $this->assertFalse(strcmp($generated['[node:title]'], $node->title), t('Unsanitized token generated properly.')); + $this->assertFalse(strcmp($generated['[node:title]'], $node->title), 'Unsanitized token generated properly.'); } /** @@ -1516,11 +1516,11 @@ class TokenReplaceTestCase extends DrupalWebTestCase { $tests['[site:login-url]'] = url('user', $url_options); // Test to make sure that we generated something for each token. - $this->assertFalse(in_array(0, array_map('strlen', $tests)), t('No empty tokens generated.')); + $this->assertFalse(in_array(0, array_map('strlen', $tests)), 'No empty tokens generated.'); foreach ($tests as $input => $expected) { $output = token_replace($input, array(), array('language' => $language)); - $this->assertFalse(strcmp($output, $expected), t('Sanitized system site information token %token replaced.', array('%token' => $input))); + $this->assertFalse(strcmp($output, $expected), 'Sanitized system site information token ' . $input . ' replaced.'); } // Generate and test unsanitized tokens. @@ -1529,7 +1529,7 @@ class TokenReplaceTestCase extends DrupalWebTestCase { foreach ($tests as $input => $expected) { $output = token_replace($input, array(), array('language' => $language, 'sanitize' => FALSE)); - $this->assertFalse(strcmp($output, $expected), t('Unsanitized system site information token %token replaced.', array('%token' => $input))); + $this->assertFalse(strcmp($output, $expected), 'Unsanitized system site information token ' . $input . ' replaced.'); } } @@ -1552,11 +1552,11 @@ class TokenReplaceTestCase extends DrupalWebTestCase { $tests['[date:raw]'] = filter_xss($date); // Test to make sure that we generated something for each token. - $this->assertFalse(in_array(0, array_map('strlen', $tests)), t('No empty tokens generated.')); + $this->assertFalse(in_array(0, array_map('strlen', $tests)), 'No empty tokens generated.'); foreach ($tests as $input => $expected) { $output = token_replace($input, array('date' => $date), array('language' => $language)); - $this->assertFalse(strcmp($output, $expected), t('Date token %token replaced.', array('%token' => $input))); + $this->assertFalse(strcmp($output, $expected), 'Date token ' . $input . ' replaced.'); } } } @@ -1620,15 +1620,15 @@ array_space[a b] = Value'; $parsed = drupal_parse_info_format($config); - $this->assertEqual($parsed['simple'], $expected['simple'], t('Set a simple value.')); - $this->assertEqual($parsed['quoted'], $expected['quoted'], t('Set a simple value in quotes.')); - $this->assertEqual($parsed['multiline'], $expected['multiline'], t('Set a multiline value.')); - $this->assertEqual($parsed['array'], $expected['array'], t('Set a simple array.')); - $this->assertEqual($parsed['array_assoc'], $expected['array_assoc'], t('Set an associative array.')); - $this->assertEqual($parsed['array_deep'], $expected['array_deep'], t('Set a nested array.')); - $this->assertEqual($parsed['array_deep_assoc'], $expected['array_deep_assoc'], t('Set a nested associative array.')); - $this->assertEqual($parsed['array_space'], $expected['array_space'], t('Set an array with a whitespace in the key.')); - $this->assertEqual($parsed, $expected, t('Entire parsed .info string and expected array are identical.')); + $this->assertEqual($parsed['simple'], $expected['simple'], 'Set a simple value.'); + $this->assertEqual($parsed['quoted'], $expected['quoted'], 'Set a simple value in quotes.'); + $this->assertEqual($parsed['multiline'], $expected['multiline'], 'Set a multiline value.'); + $this->assertEqual($parsed['array'], $expected['array'], 'Set a simple array.'); + $this->assertEqual($parsed['array_assoc'], $expected['array_assoc'], 'Set an associative array.'); + $this->assertEqual($parsed['array_deep'], $expected['array_deep'], 'Set a nested array.'); + $this->assertEqual($parsed['array_deep_assoc'], $expected['array_deep_assoc'], 'Set a nested associative array.'); + $this->assertEqual($parsed['array_space'], $expected['array_space'], 'Set an array with a whitespace in the key.'); + $this->assertEqual($parsed, $expected, 'Entire parsed .info string and expected array are identical.'); } } @@ -1694,19 +1694,19 @@ class UpdateScriptFunctionalTest extends DrupalWebTestCase { // Test if disabling a module that another enabled module depends on will // prevent the update from proceeding. module_disable(array('block'), FALSE); - $this->assertFalse(module_exists('block'), t('Block module is disabled.')); - $this->assertTrue(module_exists('dashboard'), t('Dashboard module is enabled.')); + $this->assertFalse(module_exists('block'), 'Block module is disabled.'); + $this->assertTrue(module_exists('dashboard'), 'Dashboard module is enabled.'); $this->drupalGet($this->update_url, array('external' => TRUE)); - $this->assertText(t('Unresolved dependency'), t('The update process cannot proceed when a module dependency is not enabled.')); + $this->assertText(t('Unresolved dependency'), 'The update process cannot proceed when a module dependency is not enabled.'); // Test if modules required by the current install profile are not required // to be enabled for an update to proceed. module_enable(array('block')); - $this->assertTrue(module_exists('block'), t('Block module is enabled.')); + $this->assertTrue(module_exists('block'), 'Block module is enabled.'); module_disable(array('overlay')); - $this->assertFalse(module_exists('overlay'), t('Overlay module is disabled.')); + $this->assertFalse(module_exists('overlay'), 'Overlay module is disabled.'); $this->drupalGet($this->update_url, array('external' => TRUE)); - $this->assertNoText(t('Unresolved dependency'), t('The update process can proceed when modules from the install profile are disabled.')); + $this->assertNoText(t('Unresolved dependency'), 'The update process can proceed when modules from the install profile are disabled.'); } /** @@ -1720,7 +1720,7 @@ class UpdateScriptFunctionalTest extends DrupalWebTestCase { $this->drupalLogin($this->update_user); $this->drupalGet($this->update_url, array('external' => TRUE)); $final_theme_data = db_query("SELECT * FROM {system} WHERE type = 'theme' ORDER BY name")->fetchAll(); - $this->assertEqual($original_theme_data, $final_theme_data, t('Visiting update.php does not alter the information about themes stored in the database.')); + $this->assertEqual($original_theme_data, $final_theme_data, 'Visiting update.php does not alter the information about themes stored in the database.'); } } @@ -1783,22 +1783,22 @@ class RetrieveFileTestCase extends DrupalWebTestCase { $filename = $this->randomName(); $url = file_create_url($sourcedir . '/' . $filename); $retrieved_file = system_retrieve_file($url); - $this->assertFalse($retrieved_file, t('Non-existent file not fetched.')); + $this->assertFalse($retrieved_file, 'Non-existent file not fetched.'); // Actually create that file, download it via HTTP and test the returned path. file_put_contents($sourcedir . '/' . $filename, 'testing'); $retrieved_file = system_retrieve_file($url); - $this->assertEqual($retrieved_file, 'public://' . $filename, t('Sane path for downloaded file returned (public:// scheme).')); - $this->assertTrue(is_file($retrieved_file), t('Downloaded file does exist (public:// scheme).')); - $this->assertEqual(filesize($retrieved_file), 7, t('File size of downloaded file is correct (public:// scheme).')); + $this->assertEqual($retrieved_file, 'public://' . $filename, 'Sane path for downloaded file returned (public:// scheme).'); + $this->assertTrue(is_file($retrieved_file), 'Downloaded file does exist (public:// scheme).'); + $this->assertEqual(filesize($retrieved_file), 7, 'File size of downloaded file is correct (public:// scheme).'); file_unmanaged_delete($retrieved_file); // Test downloading file to a different location. drupal_mkdir($targetdir = 'temporary://' . $this->randomName()); $retrieved_file = system_retrieve_file($url, $targetdir); - $this->assertEqual($retrieved_file, "$targetdir/$filename", t('Sane path for downloaded file returned (temporary:// scheme).')); - $this->assertTrue(is_file($retrieved_file), t('Downloaded file does exist (temporary:// scheme).')); - $this->assertEqual(filesize($retrieved_file), 7, t('File size of downloaded file is correct (temporary:// scheme).')); + $this->assertEqual($retrieved_file, "$targetdir/$filename", 'Sane path for downloaded file returned (temporary:// scheme).'); + $this->assertTrue(is_file($retrieved_file), 'Downloaded file does exist (temporary:// scheme).'); + $this->assertEqual(filesize($retrieved_file), 7, 'File size of downloaded file is correct (temporary:// scheme).'); file_unmanaged_delete($retrieved_file); file_unmanaged_delete_recursive($sourcedir); @@ -1861,17 +1861,17 @@ class CompactModeTest extends DrupalWebTestCase { */ function testCompactMode() { $this->drupalGet('admin/compact/on'); - $this->assertTrue($this->cookies['Drupal.visitor.admin_compact_mode']['value'], t('Compact mode turns on.')); + $this->assertTrue($this->cookies['Drupal.visitor.admin_compact_mode']['value'], 'Compact mode turns on.'); $this->drupalGet('admin/compact/on'); - $this->assertTrue($this->cookies['Drupal.visitor.admin_compact_mode']['value'], t('Compact mode remains on after a repeat call.')); + $this->assertTrue($this->cookies['Drupal.visitor.admin_compact_mode']['value'], 'Compact mode remains on after a repeat call.'); $this->drupalGet(''); - $this->assertTrue($this->cookies['Drupal.visitor.admin_compact_mode']['value'], t('Compact mode persists on new requests.')); + $this->assertTrue($this->cookies['Drupal.visitor.admin_compact_mode']['value'], 'Compact mode persists on new requests.'); $this->drupalGet('admin/compact/off'); - $this->assertEqual($this->cookies['Drupal.visitor.admin_compact_mode']['value'], 'deleted', t('Compact mode turns off.')); + $this->assertEqual($this->cookies['Drupal.visitor.admin_compact_mode']['value'], 'deleted', 'Compact mode turns off.'); $this->drupalGet('admin/compact/off'); - $this->assertEqual($this->cookies['Drupal.visitor.admin_compact_mode']['value'], 'deleted', t('Compact mode remains off after a repeat call.')); + $this->assertEqual($this->cookies['Drupal.visitor.admin_compact_mode']['value'], 'deleted', 'Compact mode remains off after a repeat call.'); $this->drupalGet(''); - $this->assertTrue($this->cookies['Drupal.visitor.admin_compact_mode']['value'], t('Compact mode persists on new requests.')); + $this->assertTrue($this->cookies['Drupal.visitor.admin_compact_mode']['value'], 'Compact mode persists on new requests.'); } } |