summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAngie Byron <webchick@24967.no-reply.drupal.org>2010-08-05 23:53:39 +0000
committerAngie Byron <webchick@24967.no-reply.drupal.org>2010-08-05 23:53:39 +0000
commit25171a17f626695ecf984cc44b60d3eae1310b4c (patch)
tree3268ef89294cbb96d0875d665012c4ff16d8c68a
parentcacd044a6398df92de68c5aea31987ac0fff507a (diff)
downloadbrdo-25171a17f626695ecf984cc44b60d3eae1310b4c.tar.gz
brdo-25171a17f626695ecf984cc44b60d3eae1310b4c.tar.bz2
Reverting #500866. Needs more discussion.
-rw-r--r--modules/aggregator/aggregator.test106
-rw-r--r--modules/block/block.test110
-rw-r--r--modules/blog/blog.test40
-rw-r--r--modules/book/book.test58
-rw-r--r--modules/comment/comment.test260
-rw-r--r--modules/contact/contact.test72
-rw-r--r--modules/dashboard/dashboard.test8
-rw-r--r--modules/dblog/dblog.test46
-rw-r--r--modules/field/modules/field_sql_storage/field_sql_storage.test36
-rw-r--r--modules/field/modules/list/tests/list.test38
-rw-r--r--modules/field/modules/options/options.test78
-rw-r--r--modules/field/modules/text/text.test42
-rw-r--r--modules/field/tests/field.test409
-rw-r--r--modules/field_ui/field_ui.test76
-rw-r--r--modules/file/tests/file.test118
-rw-r--r--modules/filter/filter.test436
-rw-r--r--modules/forum/forum.test56
-rw-r--r--modules/help/help.test14
-rw-r--r--modules/image/image.test174
-rw-r--r--modules/locale/locale.test280
-rw-r--r--modules/menu/menu.test50
-rw-r--r--modules/node/node.test320
-rw-r--r--modules/openid/openid.test156
-rw-r--r--modules/path/path.test22
-rw-r--r--modules/php/php.test22
-rw-r--r--modules/poll/poll.test90
-rw-r--r--modules/profile/profile.test90
-rw-r--r--modules/rdf/rdf.test112
-rw-r--r--modules/search/search.test101
-rw-r--r--modules/shortcut/shortcut.test8
-rw-r--r--modules/simpletest/tests/actions.test20
-rw-r--r--modules/simpletest/tests/ajax.test32
-rw-r--r--modules/simpletest/tests/batch.test70
-rw-r--r--modules/simpletest/tests/bootstrap.test164
-rw-r--r--modules/simpletest/tests/cache.test65
-rw-r--r--modules/simpletest/tests/common.test458
-rw-r--r--modules/simpletest/tests/database_test.test629
-rw-r--r--modules/simpletest/tests/entity_query.test146
-rw-r--r--modules/simpletest/tests/error.test20
-rw-r--r--modules/simpletest/tests/file.test646
-rw-r--r--modules/simpletest/tests/filetransfer.test2
-rw-r--r--modules/simpletest/tests/form.test192
-rw-r--r--modules/simpletest/tests/graph.test12
-rw-r--r--modules/simpletest/tests/image.test72
-rw-r--r--modules/simpletest/tests/lock.test20
-rw-r--r--modules/simpletest/tests/mail.test2
-rw-r--r--modules/simpletest/tests/menu.test156
-rw-r--r--modules/simpletest/tests/module.test28
-rw-r--r--modules/simpletest/tests/path.test10
-rw-r--r--modules/simpletest/tests/registry.test6
-rw-r--r--modules/simpletest/tests/schema.test42
-rw-r--r--modules/simpletest/tests/session.test72
-rw-r--r--modules/simpletest/tests/theme.test36
-rw-r--r--modules/simpletest/tests/unicode.test22
-rw-r--r--modules/simpletest/tests/update.test18
-rw-r--r--modules/simpletest/tests/upgrade/upgrade.poll.test14
-rw-r--r--modules/simpletest/tests/upgrade/upgrade.test13
-rw-r--r--modules/simpletest/tests/xmlrpc.test4
-rw-r--r--modules/statistics/statistics.test88
-rw-r--r--modules/syslog/syslog.test2
-rw-r--r--modules/system/system.test296
-rw-r--r--modules/taxonomy/taxonomy.test180
-rw-r--r--modules/tracker/tracker.test42
-rw-r--r--modules/translation/translation.test26
-rw-r--r--modules/trigger/trigger.test47
-rw-r--r--modules/update/update.test40
-rw-r--r--modules/user/user.test324
67 files changed, 3734 insertions, 3710 deletions
diff --git a/modules/aggregator/aggregator.test b/modules/aggregator/aggregator.test
index eb0343afb..160f8ba6a 100644
--- a/modules/aggregator/aggregator.test
+++ b/modules/aggregator/aggregator.test
@@ -26,10 +26,10 @@ class AggregatorTestCase extends DrupalWebTestCase {
function createFeed($feed_url = NULL) {
$edit = $this->getFeedEditArray($feed_url);
$this->drupalPost('admin/config/services/aggregator/add/feed', $edit, t('Save'));
- $this->assertRaw(t('The feed %name has been added.', array('%name' => $edit['title'])), 'The feed ' . $edit['title'] . ' has been added.');
+ $this->assertRaw(t('The feed %name has been added.', array('%name' => $edit['title'])), t('The feed !name has been added.', array('!name' => $edit['title'])));
$feed = db_query("SELECT * FROM {aggregator_feed} WHERE title = :title AND url = :url", array(':title' => $edit['title'], ':url' => $edit['url']))->fetch();
- $this->assertTrue(!empty($feed), 'The feed found in database.');
+ $this->assertTrue(!empty($feed), t('The feed found in database.'));
return $feed;
}
@@ -41,7 +41,7 @@ class AggregatorTestCase extends DrupalWebTestCase {
*/
function deleteFeed($feed) {
$this->drupalPost('admin/config/services/aggregator/edit/feed/' . $feed->fid, array(), t('Delete'));
- $this->assertRaw(t('The feed %title has been deleted.', array('%title' => $feed->title)), 'Feed deleted successfully.');
+ $this->assertRaw(t('The feed %title has been deleted.', array('%title' => $feed->title)), t('Feed deleted successfully.'));
}
/**
@@ -91,7 +91,7 @@ class AggregatorTestCase extends DrupalWebTestCase {
function updateFeedItems(&$feed, $expected_count) {
// First, let's ensure we can get to the rss xml.
$this->drupalGet($feed->url);
- $this->assertResponse(200, $feed->url . ' is reachable.');
+ $this->assertResponse(200, t('!url is reachable.', array('!url' => $feed->url)));
// Refresh the feed (simulated link click).
$this->drupalGet('admin/config/services/aggregator/update/' . $feed->fid);
@@ -104,7 +104,7 @@ class AggregatorTestCase extends DrupalWebTestCase {
$feed->items[] = $item->iid;
}
$feed->item_count = count($feed->items);
- $this->assertEqual($expected_count, $feed->item_count, 'Total items in feed equal to the total items in database (' . $expected_count . ' != ' . $feed->item_count . ')');
+ $this->assertEqual($expected_count, $feed->item_count, t('Total items in feed equal to the total items in database (!val1 != !val2)', array('!val1' => $expected_count, '!val2' => $feed->item_count)));
}
/**
@@ -115,7 +115,7 @@ class AggregatorTestCase extends DrupalWebTestCase {
*/
function removeFeedItems($feed) {
$this->drupalPost('admin/config/services/aggregator/remove/' . $feed->fid, array(), t('Remove items'));
- $this->assertRaw(t('The news items from %title have been removed.', array('%title' => $feed->title)), 'Feed items removed.');
+ $this->assertRaw(t('The news items from %title have been removed.', array('%title' => $feed->title)), t('Feed items removed.'));
}
/**
@@ -295,15 +295,15 @@ class AddFeedTestCase extends AggregatorTestCase {
$feed = $this->createFeed();
// Check feed data.
- $this->assertEqual($this->getUrl(), url('admin/config/services/aggregator/add/feed', array('absolute' => TRUE)), 'Directed to correct url.');
- $this->assertTrue($this->uniqueFeed($feed->title, $feed->url), 'The feed is unique.');
+ $this->assertEqual($this->getUrl(), url('admin/config/services/aggregator/add/feed', array('absolute' => TRUE)), t('Directed to correct url.'));
+ $this->assertTrue($this->uniqueFeed($feed->title, $feed->url), t('The feed is unique.'));
// Check feed source.
$this->drupalGet('aggregator/sources/' . $feed->fid);
- $this->assertResponse(200, 'Feed source exists.');
- $this->assertText($feed->title, 'Page title');
+ $this->assertResponse(200, t('Feed source exists.'));
+ $this->assertText($feed->title, t('Page title'));
$this->drupalGet('aggregator/sources/' . $feed->fid . '/categorize');
- $this->assertResponse(200, 'Feed categorization page exists.');
+ $this->assertResponse(200, t('Feed categorization page exists.'));
// Delete feed.
$this->deleteFeed($feed);
@@ -327,11 +327,11 @@ class CategorizeFeedTestCase extends AggregatorTestCase {
// Create 2 categories.
$category_1 = array('title' => $this->randomName(10), 'description' => '');
$this->drupalPost('admin/config/services/aggregator/add/category', $category_1, t('Save'));
- $this->assertRaw(t('The category %title has been added.', array('%title' => $category_1['title'])), 'The category ' . $category_1['title'] . ' has been added.');
+ $this->assertRaw(t('The category %title has been added.', array('%title' => $category_1['title'])), t('The category %title has been added.', array('%title' => $category_1['title'])));
$category_2 = array('title' => $this->randomName(10), 'description' => '');
$this->drupalPost('admin/config/services/aggregator/add/category', $category_2, t('Save'));
- $this->assertRaw(t('The category %title has been added.', array('%title' => $category_2['title'])), 'The category ' . $category_2['title'] . ' has been added.');
+ $this->assertRaw(t('The category %title has been added.', array('%title' => $category_2['title'])), t('The category %title has been added.', array('%title' => $category_2['title'])));
// Get categories from database.
$categories = $this->getCategories();
@@ -349,7 +349,7 @@ class CategorizeFeedTestCase extends AggregatorTestCase {
// Assert the feed has two categories.
$this->getFeedCategories($db_feed);
- $this->assertEqual(count($db_feed->categories), 2, 'Feed has 2 categories');
+ $this->assertEqual(count($db_feed->categories), 2, t('Feed has 2 categories'));
}
}
@@ -377,16 +377,16 @@ class UpdateFeedTestCase extends AggregatorTestCase {
$edit[$same_field] = $feed->{$same_field};
}
$this->drupalPost('admin/config/services/aggregator/edit/feed/' . $feed->fid, $edit, t('Save'));
- $this->assertRaw(t('The feed %name has been updated.', array('%name' => $edit['title'])), 'The feed ' . $edit['title'] . ' has been updated.');
+ $this->assertRaw(t('The feed %name has been updated.', array('%name' => $edit['title'])), t('The feed %name has been updated.', array('%name' => $edit['title'])));
// Check feed data.
$this->assertEqual($this->getUrl(), url('admin/config/services/aggregator/', array('absolute' => TRUE)));
- $this->assertTrue($this->uniqueFeed($edit['title'], $edit['url']), 'The feed is unique.');
+ $this->assertTrue($this->uniqueFeed($edit['title'], $edit['url']), t('The feed is unique.'));
// Check feed source.
$this->drupalGet('aggregator/sources/' . $feed->fid);
- $this->assertResponse(200, 'Feed source exists.');
- $this->assertText($edit['title'], 'Page title');
+ $this->assertResponse(200, t('Feed source exists.'));
+ $this->assertText($edit['title'], t('Page title'));
// Delete feed.
$feed->title = $edit['title']; // Set correct title so deleteFeed() will work.
@@ -415,11 +415,11 @@ class RemoveFeedTestCase extends AggregatorTestCase {
// Check feed source.
$this->drupalGet('aggregator/sources/' . $feed->fid);
- $this->assertResponse(404, 'Deleted feed source does not exists.');
+ $this->assertResponse(404, t('Deleted feed source does not exists.'));
// Check database for feed.
$result = db_query("SELECT COUNT(*) FROM {aggregator_feed} WHERE title = :title AND url = :url", array(':title' => $feed->title, ':url' => $feed->url))->fetchField();
- $this->assertFalse($result, 'Feed not found in database');
+ $this->assertFalse($result, t('Feed not found in database'));
}
}
@@ -455,10 +455,10 @@ class UpdateFeedItemTestCase extends AggregatorTestCase {
);
$this->drupalGet($edit['url']);
- $this->assertResponse(array(200), 'URL ' . $edit['url'] . ' is accessible');
+ $this->assertResponse(array(200), t('URL !url is accessible', array('!url' => $edit['url'])));
$this->drupalPost('admin/config/services/aggregator/add/feed', $edit, t('Save'));
- $this->assertRaw(t('The feed %name has been added.', array('%name' => $edit['title'])), 'The feed ' . $edit['title'] . ' has been added.');
+ $this->assertRaw(t('The feed %name has been added.', array('%name' => $edit['title'])), t('The feed !name has been added.', array('!name' => $edit['title'])));
$feed = db_query("SELECT * FROM {aggregator_feed} WHERE url = :url", array(':url' => $edit['url']))->fetchObject();
$this->drupalGet('admin/config/services/aggregator/update/' . $feed->fid);
@@ -480,7 +480,7 @@ class UpdateFeedItemTestCase extends AggregatorTestCase {
$after = db_query('SELECT timestamp FROM {aggregator_item} WHERE fid = :fid', array(':fid' => $feed->fid))->fetchField();
- $this->assertTrue($before === $after, 'Publish timestamp of feed item was not updated (' . $before . ' === ' . $after . ')');
+ $this->assertTrue($before === $after, t('Publish timestamp of feed item was not updated (!before === !after)', array('!before' => $before, '!after' => $after)));
}
}
@@ -541,14 +541,14 @@ class CategorizeFeedItemTestCase extends AggregatorTestCase {
// Simulate form submission on "admin/config/services/aggregator/add/category".
$edit = array('title' => $this->randomName(10), 'description' => '');
$this->drupalPost('admin/config/services/aggregator/add/category', $edit, t('Save'));
- $this->assertRaw(t('The category %title has been added.', array('%title' => $edit['title'])), 'The category ' . $edit['title'] . ' has been added.');
+ $this->assertRaw(t('The category %title has been added.', array('%title' => $edit['title'])), t('The category %title has been added.', array('%title' => $edit['title'])));
$category = db_query("SELECT * FROM {aggregator_category} WHERE title = :title", array(':title' => $edit['title']))->fetch();
- $this->assertTrue(!empty($category), 'The category found in database.');
+ $this->assertTrue(!empty($category), t('The category found in database.'));
$link_path = 'aggregator/categories/' . $category->cid;
$menu_link = db_query("SELECT * FROM {menu_links} WHERE link_path = :link_path", array(':link_path' => $link_path))->fetch();
- $this->assertTrue(!empty($menu_link), 'The menu link associated with the category found in database.');
+ $this->assertTrue(!empty($menu_link), t('The menu link associated with the category found in database.'));
$feed = $this->createFeed();
db_insert('aggregator_category_feed')
@@ -559,7 +559,7 @@ class CategorizeFeedItemTestCase extends AggregatorTestCase {
->execute();
$this->updateFeedItems($feed, $this->getDefaultFeedItemCount());
$this->getFeedCategories($feed);
- $this->assertTrue(!empty($feed->categories), 'The category found in the feed.');
+ $this->assertTrue(!empty($feed->categories), t('The category found in the feed.'));
// For each category of a feed, ensure feed items have that category, too.
if (!empty($feed->categories) && !empty($feed->items)) {
@@ -570,7 +570,7 @@ class CategorizeFeedItemTestCase extends AggregatorTestCase {
->execute()
->fetchField();
- $this->assertEqual($feed->item_count, $categorized_count, 'Total items in feed equal to the total categorized feed items in database');
+ $this->assertEqual($feed->item_count, $categorized_count, t('Total items in feed equal to the total categorized feed items in database'));
}
}
@@ -603,11 +603,11 @@ class ImportOPMLTestCase extends AggregatorTestCase {
->execute();
$this->drupalGet('admin/config/services/aggregator/add/opml');
- $this->assertText('A single OPML document may contain a collection of many feeds.', 'Looking for help text.');
- $this->assertFieldByName('files[upload]', '', 'Looking for file upload field.');
- $this->assertFieldByName('remote', '', 'Looking for remote URL field.');
- $this->assertFieldByName('refresh', '', 'Looking for refresh field.');
- $this->assertFieldByName("category[$cid]", $cid, 'Looking for category field.');
+ $this->assertText('A single OPML document may contain a collection of many feeds.', t('Looking for help text.'));
+ $this->assertFieldByName('files[upload]', '', t('Looking for file upload field.'));
+ $this->assertFieldByName('remote', '', t('Looking for remote URL field.'));
+ $this->assertFieldByName('refresh', '', t('Looking for refresh field.'));
+ $this->assertFieldByName("category[$cid]", $cid, t('Looking for category field.'));
}
/**
@@ -618,7 +618,7 @@ class ImportOPMLTestCase extends AggregatorTestCase {
$edit = array();
$this->drupalPost('admin/config/services/aggregator/add/opml', $edit, t('Import'));
- $this->assertRaw(t('You must <em>either</em> upload a file or enter a URL.'), 'Error if no fields are filled.');
+ $this->assertRaw(t('You must <em>either</em> upload a file or enter a URL.'), t('Error if no fields are filled.'));
$path = $this->getEmptyOpml();
$edit = array(
@@ -626,14 +626,14 @@ class ImportOPMLTestCase extends AggregatorTestCase {
'remote' => file_create_url($path),
);
$this->drupalPost('admin/config/services/aggregator/add/opml', $edit, t('Import'));
- $this->assertRaw(t('You must <em>either</em> upload a file or enter a URL.'), 'Error if both fields are filled.');
+ $this->assertRaw(t('You must <em>either</em> upload a file or enter a URL.'), t('Error if both fields are filled.'));
$edit = array('remote' => 'invalidUrl://empty');
$this->drupalPost('admin/config/services/aggregator/add/opml', $edit, t('Import'));
- $this->assertText(t('This URL is not valid.'), 'Error if the URL is invalid.');
+ $this->assertText(t('This URL is not valid.'), t('Error if the URL is invalid.'));
$after = db_query('SELECT COUNT(*) FROM {aggregator_feed}')->fetchField();
- $this->assertEqual($before, $after, 'No feeds were added during the three last form submissions.');
+ $this->assertEqual($before, $after, t('No feeds were added during the three last form submissions.'));
}
/**
@@ -644,14 +644,14 @@ class ImportOPMLTestCase extends AggregatorTestCase {
$form['files[upload]'] = $this->getInvalidOpml();
$this->drupalPost('admin/config/services/aggregator/add/opml', $form, t('Import'));
- $this->assertText(t('No new feed has been added.'), 'Attempting to upload invalid XML.');
+ $this->assertText(t('No new feed has been added.'), t('Attempting to upload invalid XML.'));
$edit = array('remote' => file_create_url($this->getEmptyOpml()));
$this->drupalPost('admin/config/services/aggregator/add/opml', $edit, t('Import'));
- $this->assertText(t('No new feed has been added.'), 'Attempting to load empty OPML from remote URL.');
+ $this->assertText(t('No new feed has been added.'), t('Attempting to load empty OPML from remote URL.'));
$after = db_query('SELECT COUNT(*) FROM {aggregator_feed}')->fetchField();
- $this->assertEqual($before, $after, 'No feeds were added during the two last form submissions.');
+ $this->assertEqual($before, $after, t('No feeds were added during the two last form submissions.'));
db_delete('aggregator_feed')->execute();
db_delete('aggregator_category')->execute();
@@ -675,11 +675,11 @@ class ImportOPMLTestCase extends AggregatorTestCase {
'category[1]' => $category,
);
$this->drupalPost('admin/config/services/aggregator/add/opml', $edit, t('Import'));
- $this->assertRaw(t('A feed with the URL %url already exists.', array('%url' => $feeds[0]['url'])), 'Verifying that a duplicate URL was identified');
- $this->assertRaw(t('A feed named %title already exists.', array('%title' => $feeds[1]['title'])), 'Verifying that a duplicate title was identified');
+ $this->assertRaw(t('A feed with the URL %url already exists.', array('%url' => $feeds[0]['url'])), t('Verifying that a duplicate URL was identified'));
+ $this->assertRaw(t('A feed named %title already exists.', array('%title' => $feeds[1]['title'])), t('Verifying that a duplicate title was identified'));
$after = db_query('SELECT COUNT(*) FROM {aggregator_feed}')->fetchField();
- $this->assertEqual($after, 2, 'Verifying that two distinct feeds were added.');
+ $this->assertEqual($after, 2, t('Verifying that two distinct feeds were added.'));
$feeds_from_db = db_query("SELECT f.title, f.url, f.refresh, cf.cid FROM {aggregator_feed} f LEFT JOIN {aggregator_category_feed} cf ON f.fid = cf.fid");
$refresh = $category = TRUE;
@@ -690,10 +690,10 @@ class ImportOPMLTestCase extends AggregatorTestCase {
$refresh = $refresh && $feed->refresh == 900;
}
- $this->assertEqual($title[$feeds[0]['url']], $feeds[0]['title'], 'First feed was added correctly.');
- $this->assertEqual($url[$feeds[1]['title']], $feeds[1]['url'], 'Second feed was added correctly.');
- $this->assertTrue($refresh, 'Refresh times are correct.');
- $this->assertTrue($category, 'Categories are correct.');
+ $this->assertEqual($title[$feeds[0]['url']], $feeds[0]['title'], t('First feed was added correctly.'));
+ $this->assertEqual($url[$feeds[1]['title']], $feeds[1]['url'], t('Second feed was added correctly.'));
+ $this->assertTrue($refresh, t('Refresh times are correct.'));
+ $this->assertTrue($category, t('Categories are correct.'));
}
function testOPMLImport() {
@@ -793,20 +793,20 @@ class AggregatorRenderingTestCase extends AggregatorTestCase {
$this->assertFieldByName($block['module'] . '_' . $block['delta'] . '[region]', '', 'Aggregator feed block is available for positioning.');
// Position it.
$this->drupalPost('admin/structure/block', $edit, t('Save blocks'));
- $this->assertText(t('The block settings have been updated.'), 'Block successfully moved to ' . $region . ' region.');
+ $this->assertText(t('The block settings have been updated.'), t('Block successfully moved to %region_name region.', array( '%region_name' => $region)));
// Confirm that the block is now being displayed on pages.
$this->drupalGet('node');
- $this->assertText(t($block['title']), 'Feed block is displayed on the page.');
+ $this->assertText(t($block['title']), t('Feed block is displayed on the page.'));
// Find the expected read_more link.
$href = 'aggregator/sources/' . $feed->fid;
$links = $this->xpath('//a[@href = :href]', array(':href' => url($href)));
- $this->assert(isset($links[0]), 'Link to href ' . $href . ' found.');
+ $this->assert(isset($links[0]), t('Link to href %href found.', array('%href' => $href)));
// Visit that page.
$this->drupalGet($href);
$correct_titles = $this->xpath('//h1[normalize-space(text())=:title]', array(':title' => $feed->title));
- $this->assertFalse(empty($correct_titles), 'Aggregator feed page is available and has the correct title.');
+ $this->assertFalse(empty($correct_titles), t('Aggregator feed page is available and has the correct title.'));
}
}
@@ -837,7 +837,7 @@ class FeedParserTestCase extends AggregatorTestCase {
$feed = $this->createFeed($this->getRSS091Sample());
aggregator_refresh($feed);
$this->drupalGet('aggregator/sources/' . $feed->fid);
- $this->assertResponse(200, 'Feed ' . $feed->title . ' exists.');
+ $this->assertResponse(200, t('Feed %name exists.', array('%name' => $feed->title)));
$this->assertText('First example feed item title');
$this->assertLinkByHref('http://example.com/example-turns-one');
$this->assertText('First example feed item description.');
@@ -850,7 +850,7 @@ class FeedParserTestCase extends AggregatorTestCase {
$feed = $this->createFeed($this->getAtomSample());
aggregator_refresh($feed);
$this->drupalGet('aggregator/sources/' . $feed->fid);
- $this->assertResponse(200, 'Feed ' . $feed->title . ' exists.');
+ $this->assertResponse(200, t('Feed %name exists.', array('%name' => $feed->title)));
$this->assertText('Atom-Powered Robots Run Amok');
$this->assertLinkByHref('http://example.org/2003/12/13/atom03');
$this->assertText('Some text.');
diff --git a/modules/block/block.test b/modules/block/block.test
index 7cb70aaf1..86584df7e 100644
--- a/modules/block/block.test
+++ b/modules/block/block.test
@@ -46,9 +46,9 @@ class BlockTestCase extends DrupalWebTestCase {
function testCustomBlock() {
// Confirm that the add block link appears on block overview pages.
$this->drupalGet('admin/structure/block');
- $this->assertRaw(l('Add block', 'admin/structure/block/add'), 'Add block link is present on block overview page for default theme.');
+ $this->assertRaw(l('Add block', 'admin/structure/block/add'), t('Add block link is present on block overview page for default theme.'));
$this->drupalGet('admin/structure/block/list/seven');
- $this->assertRaw(l('Add block', 'admin/structure/block/list/seven/add'), 'Add block link is present on block overview page for non-default theme.');
+ $this->assertRaw(l('Add block', 'admin/structure/block/list/seven/add'), t('Add block link is present on block overview page for non-default theme.'));
// Confirm that hidden regions are not shown as options for block placement
// when adding a new block.
@@ -59,7 +59,7 @@ class BlockTestCase extends DrupalWebTestCase {
if ($theme->status) {
foreach ($theme->info['regions_hidden'] as $hidden_region) {
$elements = $this->xpath('//select[@id=:id]//option[@value=:value]', array(':id' => 'edit-regions-' . $key, ':value' => $hidden_region));
- $this->assertFalse(isset($elements[0]), 'The hidden region ' . $hidden_region . ' is not available for ' . $key . '.');
+ $this->assertFalse(isset($elements[0]), t('The hidden region @region is not available for @theme.', array('@region' => $hidden_region, '@theme' => $key)));
}
}
}
@@ -72,11 +72,11 @@ class BlockTestCase extends DrupalWebTestCase {
$this->drupalPost('admin/structure/block/add', $custom_block, t('Save block'));
// Confirm that the custom block has been created, and then query the created bid.
- $this->assertText(t('The block has been created.'), 'Custom block successfully created.');
+ $this->assertText(t('The block has been created.'), t('Custom block successfully created.'));
$bid = db_query("SELECT bid FROM {block_custom} WHERE info = :info", array(':info' => $custom_block['info']))->fetchField();
// Check to see if the custom block was created by checking that it's in the database..
- $this->assertNotNull($bid, 'Custom block found in database');
+ $this->assertNotNull($bid, t('Custom block found in database'));
// Check if the block can be moved to all availble regions.
$custom_block['module'] = 'block';
@@ -87,8 +87,8 @@ class BlockTestCase extends DrupalWebTestCase {
// Verify presence of configure and delete links for custom block.
$this->drupalGet('admin/structure/block');
- $this->assertRaw(l(t('configure'), 'admin/structure/block/manage/block/' . $bid . '/configure'), 'Custom block configure link found.');
- $this->assertRaw(l(t('delete'), 'admin/structure/block/manage/block/' . $bid . '/delete'), 'Custom block delete link found.');
+ $this->assertRaw(l(t('configure'), 'admin/structure/block/manage/block/' . $bid . '/configure'), t('Custom block configure link found.'));
+ $this->assertRaw(l(t('delete'), 'admin/structure/block/manage/block/' . $bid . '/delete'), t('Custom block delete link found.'));
// Set visibility only for authenticated users, to verify delete functionality.
$edit = array();
@@ -98,10 +98,10 @@ class BlockTestCase extends DrupalWebTestCase {
// Delete the created custom block & verify that it's been deleted and no longer appearing on the page.
$this->clickLink(t('delete'));
$this->drupalPost('admin/structure/block/manage/block/' . $bid . '/delete', array(), t('Delete'));
- $this->assertRaw(t('The block %title has been removed.', array('%title' => $custom_block['info'])), 'Custom block successfully deleted.');
- $this->assertNoText(t($custom_block['title']), 'Custom block no longer appears on page.');
+ $this->assertRaw(t('The block %title has been removed.', array('%title' => $custom_block['info'])), t('Custom block successfully deleted.'));
+ $this->assertNoText(t($custom_block['title']), t('Custom block no longer appears on page.'));
$count = db_query("SELECT 1 FROM {block_role} WHERE module = :module AND delta = :delta", array(':module' => $custom_block['module'], ':delta' => $custom_block['delta']))->fetchField();
- $this->assertFalse($count, 'Table block_role being cleaned.');
+ $this->assertFalse($count, t('Table block_role being cleaned.'));
}
/**
@@ -125,20 +125,20 @@ class BlockTestCase extends DrupalWebTestCase {
// Confirm that the custom block is being displayed using configured text format.
$this->drupalGet('node');
- $this->assertRaw('<h1>Full HTML</h1>', 'Custom block successfully being displayed using Full HTML.');
+ $this->assertRaw('<h1>Full HTML</h1>', t('Custom block successfully being displayed using Full HTML.'));
// Confirm that a user without access to Full HTML can not see the body field,
// but can still submit the form without errors.
$block_admin = $this->drupalCreateUser(array('administer blocks'));
$this->drupalLogin($block_admin);
$this->drupalGet('admin/structure/block/manage/block/' . $bid . '/configure');
- $this->assertFieldByXPath("//textarea[@name='body[value]' and @disabled='disabled']", t('This field has been disabled because you do not have sufficient permissions to edit it.'), 'Body field contains denied message');
+ $this->assertFieldByXPath("//textarea[@name='body[value]' and @disabled='disabled']", t('This field has been disabled because you do not have sufficient permissions to edit it.'), t('Body field contains denied message'));
$this->drupalPost('admin/structure/block/manage/block/' . $bid . '/configure', array(), t('Save block'));
$this->assertNoText(t('Ensure that each block description is unique.'));
// Confirm that the custom block is still being displayed using configured text format.
$this->drupalGet('node');
- $this->assertRaw('<h1>Full HTML</h1>', 'Custom block successfully being displayed using Full HTML.');
+ $this->assertRaw('<h1>Full HTML</h1>', t('Custom block successfully being displayed using Full HTML.'));
}
/**
@@ -173,18 +173,18 @@ class BlockTestCase extends DrupalWebTestCase {
$this->moveBlockToRegion($block, $this->regions[1]);
$this->drupalGet('');
- $this->assertText($title, 'Block was displayed on the front page.');
+ $this->assertText($title, t('Block was displayed on the front page.'));
$this->drupalGet('user');
- $this->assertNoText($title, 'Block was not displayed according to block visibility rules.');
+ $this->assertNoText($title, t('Block was not displayed according to block visibility rules.'));
$this->drupalGet('USER/' . $this->admin_user->uid);
- $this->assertNoText($title, 'Block was not displayed according to block visibility rules regardless of path case.');
+ $this->assertNoText($title, t('Block was not displayed according to block visibility rules regardless of path case.'));
// Confirm that the block is not displayed to anonymous users.
$this->drupalLogout();
$this->drupalGet('');
- $this->assertNoText($title, 'Block was not displayed to anonymous users.');
+ $this->assertNoText($title, t('Block was not displayed to anonymous users.'));
}
/**
@@ -199,14 +199,14 @@ class BlockTestCase extends DrupalWebTestCase {
// Set block title to confirm that interface works and override any custom titles.
$this->drupalPost('admin/structure/block/manage/' . $block['module'] . '/' . $block['delta'] . '/configure', array('title' => $block['title']), t('Save block'));
- $this->assertText(t('The block configuration has been saved.'), 'Block title set.');
+ $this->assertText(t('The block configuration has been saved.'), t('Block title set.'));
$bid = db_query("SELECT bid FROM {block} WHERE module = :module AND delta = :delta", array(
':module' => $block['module'],
':delta' => $block['delta'],
))->fetchField();
// Check to see if the block was created by checking that it's in the database.
- $this->assertNotNull($bid, 'Block found in database');
+ $this->assertNotNull($bid, t('Block found in database'));
// Check if the block can be moved to all availble regions.
foreach ($this->regions as $region) {
@@ -219,21 +219,21 @@ class BlockTestCase extends DrupalWebTestCase {
$this->drupalPost('admin/structure/block', $edit, t('Save blocks'));
// Confirm that the block was moved to the proper region.
- $this->assertText(t('The block settings have been updated.'), 'Block successfully move to disabled region.');
- $this->assertNoText(t($block['title']), 'Block no longer appears on page.');
+ $this->assertText(t('The block settings have been updated.'), t('Block successfully move to disabled region.'));
+ $this->assertNoText(t($block['title']), t('Block no longer appears on page.'));
// Confirm that the regions xpath is not availble
$xpath = $this->buildXPathQuery('//div[@id=:id]/*', array(':id' => 'block-block-' . $bid));
- $this->assertNoFieldByXPath($xpath, FALSE, 'Custom block found in no regions.');
+ $this->assertNoFieldByXPath($xpath, FALSE, t('Custom block found in no regions.'));
// For convenience of developers, put the navigation block back.
$edit = array();
$edit[$block['module'] . '_' . $block['delta'] . '[region]'] = $this->regions[1];
$this->drupalPost('admin/structure/block', $edit, t('Save blocks'));
- $this->assertText(t('The block settings have been updated.'), 'Block successfully move to first sidebar region.');
+ $this->assertText(t('The block settings have been updated.'), t('Block successfully move to first sidebar region.'));
$this->drupalPost('admin/structure/block/manage/' . $block['module'] . '/' . $block['delta'] . '/configure', array('title' => 'Navigation'), t('Save block'));
- $this->assertText(t('The block configuration has been saved.'), 'Block title set.');
+ $this->assertText(t('The block configuration has been saved.'), t('Block title set.'));
}
function moveBlockToRegion($block, $region) {
@@ -243,18 +243,18 @@ class BlockTestCase extends DrupalWebTestCase {
$this->drupalPost('admin/structure/block', $edit, t('Save blocks'));
// Confirm that the block was moved to the proper region.
- $this->assertText(t('The block settings have been updated.'), 'Block successfully moved to ' . $region . ' region.');
+ $this->assertText(t('The block settings have been updated.'), t('Block successfully moved to %region_name region.', array( '%region_name' => $region)));
// Confirm that the block is being displayed.
$this->drupalGet('node');
- $this->assertText(t($block['title']), 'Block successfully being displayed on the page.');
+ $this->assertText(t($block['title']), t('Block successfully being displayed on the page.'));
// Confirm that the custom block was found at the proper region.
$xpath = $this->buildXPathQuery('//div[@class=:region-class]//div[@id=:block-id]/*', array(
':region-class' => 'region region-' . str_replace('_', '-', $region),
':block-id' => 'block-' . $block['module'] . '-' . $block['delta'],
));
- $this->assertFieldByXPath($xpath, FALSE, 'Custom block found in ' . $region . ' region.');
+ $this->assertFieldByXPath($xpath, FALSE, t('Custom block found in %region_name region.', array('%region_name' => $region)));
}
/**
@@ -262,14 +262,14 @@ class BlockTestCase extends DrupalWebTestCase {
*/
function testBlockRehash() {
module_enable(array('block_test'));
- $this->assertTrue(module_exists('block_test'), 'Test block module enabled.');
+ $this->assertTrue(module_exists('block_test'), t('Test block module enabled.'));
// Our new block should be inserted in the database when we visit the
// block management page.
$this->drupalGet('admin/structure/block');
// Our test block's caching should default to DRUPAL_CACHE_PER_ROLE.
$current_caching = db_query("SELECT cache FROM {block} WHERE module = 'block_test' AND delta = 'test_cache'")->fetchField();
- $this->assertEqual($current_caching, DRUPAL_CACHE_PER_ROLE, 'Test block cache mode defaults to DRUPAL_CACHE_PER_ROLE.');
+ $this->assertEqual($current_caching, DRUPAL_CACHE_PER_ROLE, t('Test block cache mode defaults to DRUPAL_CACHE_PER_ROLE.'));
// Disable caching for this block.
variable_set('block_test_caching', DRUPAL_NO_CACHE);
@@ -277,7 +277,7 @@ class BlockTestCase extends DrupalWebTestCase {
drupal_flush_all_caches();
// Verify that the database is updated with the new caching mode.
$current_caching = db_query("SELECT cache FROM {block} WHERE module = 'block_test' AND delta = 'test_cache'")->fetchField();
- $this->assertEqual($current_caching, DRUPAL_NO_CACHE, "Test block's database entry updated to DRUPAL_NO_CACHE.");
+ $this->assertEqual($current_caching, DRUPAL_NO_CACHE, t("Test block's database entry updated to DRUPAL_NO_CACHE."));
}
}
@@ -328,7 +328,7 @@ class NewDefaultThemeBlocks extends DrupalWebTestCase {
$themes['admin'] = $admin_theme;
}
$count = db_query_range('SELECT 1 FROM {block} WHERE theme NOT IN (:themes)', 0, 1, array(':themes' => $themes))->fetchField();
- $this->assertFalse($count, 'Only the default theme and the admin theme have blocks.');
+ $this->assertFalse($count, t('Only the default theme and the admin theme have blocks.'));
// Populate list of all blocks for matching against new theme.
$blocks = array();
@@ -346,7 +346,7 @@ class NewDefaultThemeBlocks extends DrupalWebTestCase {
$result = db_query('SELECT * FROM {block} WHERE theme = :theme', array(':theme' => 'stark'));
foreach ($result as $block) {
unset($block->theme, $block->bid);
- $this->assertEqual($blocks[$block->module][$block->delta], $block, 'Block ' . $block->module . '-' . $block->delta . ' matched');
+ $this->assertEqual($blocks[$block->module][$block->delta], $block, t('Block %name matched', array('%name' => $block->module . '-' . $block->delta)));
}
}
}
@@ -373,13 +373,13 @@ class BlockAdminThemeTestCase extends DrupalWebTestCase {
// Ensure that access to block admin page is denied when theme is disabled.
$this->drupalGet('admin/structure/block/list/stark');
- $this->assertResponse(403, 'The block admin page for a disabled theme can not be accessed');
+ $this->assertResponse(403, t('The block admin page for a disabled theme can not be accessed'));
// Enable admin theme and confirm that tab is accessible.
$edit['admin_theme'] = 'stark';
$this->drupalPost('admin/appearance', $edit, t('Save configuration'));
$this->drupalGet('admin/structure/block/list/stark');
- $this->assertResponse(200, 'The block admin page for the admin theme can be accessed');
+ $this->assertResponse(200, t('The block admin page for the admin theme can be accessed'));
}
}
@@ -433,20 +433,20 @@ class BlockCacheTestCase extends DrupalWebTestCase {
variable_set('block_test_content', $current_content);
$this->drupalLogin($this->normal_user);
$this->drupalGet('');
- $this->assertText($current_content, 'Block content displays.');
+ $this->assertText($current_content, t('Block content displays.'));
// Change the content, but the cached copy should still be served.
$old_content = $current_content;
$current_content = $this->randomName();
variable_set('block_test_content', $current_content);
$this->drupalGet('');
- $this->assertText($old_content, 'Block is served from the cache.');
+ $this->assertText($old_content, t('Block is served from the cache.'));
// Clear the cache and verify that the stale data is no longer there.
cache_clear_all();
$this->drupalGet('');
- $this->assertNoText($old_content, 'Block cache clear removes stale cache data.');
- $this->assertText($current_content, 'Fresh block content is displayed after clearing the cache.');
+ $this->assertNoText($old_content, t('Block cache clear removes stale cache data.'));
+ $this->assertText($current_content, t('Fresh block content is displayed after clearing the cache.'));
// Test whether the cached data is served for the correct users.
$old_content = $current_content;
@@ -454,19 +454,19 @@ class BlockCacheTestCase extends DrupalWebTestCase {
variable_set('block_test_content', $current_content);
$this->drupalLogout();
$this->drupalGet('');
- $this->assertNoText($old_content, 'Anonymous user does not see content cached per-role for normal user.');
+ $this->assertNoText($old_content, t('Anonymous user does not see content cached per-role for normal user.'));
$this->drupalLogin($this->normal_user_alt);
$this->drupalGet('');
- $this->assertText($old_content, 'User with the same roles sees per-role cached content.');
+ $this->assertText($old_content, t('User with the same roles sees per-role cached content.'));
$this->drupalLogin($this->admin_user);
$this->drupalGet('');
- $this->assertNoText($old_content, 'Admin user does not see content cached per-role for normal user.');
+ $this->assertNoText($old_content, t('Admin user does not see content cached per-role for normal user.'));
$this->drupalLogin($this->normal_user);
$this->drupalGet('');
- $this->assertText($old_content, 'Block is served from the per-role cache.');
+ $this->assertText($old_content, t('Block is served from the per-role cache.'));
}
/**
@@ -478,7 +478,7 @@ class BlockCacheTestCase extends DrupalWebTestCase {
variable_set('block_test_content', $current_content);
$this->drupalGet('');
- $this->assertText($current_content, 'Block content displays.');
+ $this->assertText($current_content, t('Block content displays.'));
$old_content = $current_content;
$current_content = $this->randomName();
@@ -486,7 +486,7 @@ class BlockCacheTestCase extends DrupalWebTestCase {
$this->drupalLogout();
$this->drupalGet('user');
- $this->assertText($old_content, 'Block content served from global cache.');
+ $this->assertText($old_content, t('Block content served from global cache.'));
}
/**
@@ -499,13 +499,13 @@ class BlockCacheTestCase extends DrupalWebTestCase {
// If DRUPAL_NO_CACHE has no effect, the next request would be cached.
$this->drupalGet('');
- $this->assertText($current_content, 'Block content displays.');
+ $this->assertText($current_content, t('Block content displays.'));
// A cached copy should not be served.
$current_content = $this->randomName();
variable_set('block_test_content', $current_content);
$this->drupalGet('');
- $this->assertText($current_content, 'DRUPAL_NO_CACHE prevents blocks from being cached.');
+ $this->assertText($current_content, t('DRUPAL_NO_CACHE prevents blocks from being cached.'));
}
/**
@@ -518,22 +518,22 @@ class BlockCacheTestCase extends DrupalWebTestCase {
$this->drupalLogin($this->normal_user);
$this->drupalGet('');
- $this->assertText($current_content, 'Block content displays.');
+ $this->assertText($current_content, t('Block content displays.'));
$old_content = $current_content;
$current_content = $this->randomName();
variable_set('block_test_content', $current_content);
$this->drupalGet('');
- $this->assertText($old_content, 'Block is served from per-user cache.');
+ $this->assertText($old_content, t('Block is served from per-user cache.'));
$this->drupalLogin($this->normal_user_alt);
$this->drupalGet('');
- $this->assertText($current_content, 'Per-user block cache is not served for other users.');
+ $this->assertText($current_content, t('Per-user block cache is not served for other users.'));
$this->drupalLogin($this->normal_user);
$this->drupalGet('');
- $this->assertText($old_content, 'Per-user block cache is persistent.');
+ $this->assertText($old_content, t('Per-user block cache is persistent.'));
}
/**
@@ -545,16 +545,16 @@ class BlockCacheTestCase extends DrupalWebTestCase {
variable_set('block_test_content', $current_content);
$this->drupalGet('node');
- $this->assertText($current_content, 'Block content displays on the node page.');
+ $this->assertText($current_content, t('Block content displays on the node page.'));
$old_content = $current_content;
$current_content = $this->randomName();
variable_set('block_test_content', $current_content);
$this->drupalGet('user');
- $this->assertNoText($old_content, 'Block content cached for the node page does not show up for the user page.');
+ $this->assertNoText($old_content, t('Block content cached for the node page does not show up for the user page.'));
$this->drupalGet('node');
- $this->assertText($old_content, 'Block content cached for the node page.');
+ $this->assertText($old_content, t('Block content cached for the node page.'));
}
/**
@@ -568,7 +568,7 @@ class BlockCacheTestCase extends DrupalWebTestCase {
$current_mode = db_query("SELECT cache FROM {block} WHERE module = 'block_test'")->fetchField();
if ($current_mode != $cache_mode) {
- $this->fail('Unable to set cache mode to ' . $cache_mode . '. Current mode: ' . $current_mode);
+ $this->fail(t('Unable to set cache mode to %mode. Current mode: %current_mode', array('%mode' => $cache_mode, '%current_mode' => $current_mode)));
}
}
}
@@ -607,6 +607,6 @@ class BlockHTMLIdTestCase extends DrupalWebTestCase {
*/
function testHTMLId() {
$this->drupalGet('');
- $this->assertRaw('block-block-test-test-html-id', 'HTML id for test block is valid.');
+ $this->assertRaw('block-block-test-test-html-id', t('HTML id for test block is valid.'));
}
}
diff --git a/modules/blog/blog.test b/modules/blog/blog.test
index be0e89fdc..500a9d74f 100644
--- a/modules/blog/blog.test
+++ b/modules/blog/blog.test
@@ -38,8 +38,8 @@ class BlogTestCase extends DrupalWebTestCase {
$this->drupalGet('blog/' . $this->big_user->uid);
$this->assertResponse(200);
- $this->assertTitle(t("@name's blog", array('@name' => format_username($this->big_user))) . ' | Drupal', 'Blog title was displayed');
- $this->assertText(t('You are not allowed to post a new blog entry.'), 'No new entries can be posted without the right permission');
+ $this->assertTitle(t("@name's blog", array('@name' => format_username($this->big_user))) . ' | Drupal', t('Blog title was displayed'));
+ $this->assertText(t('You are not allowed to post a new blog entry.'), t('No new entries can be posted without the right permission'));
}
/**
@@ -50,8 +50,8 @@ class BlogTestCase extends DrupalWebTestCase {
$this->drupalGet('blog/' . $this->own_user->uid);
$this->assertResponse(200);
- $this->assertTitle(t("@name's blog", array('@name' => format_username($this->own_user))) . ' | Drupal', 'Blog title was displayed');
- $this->assertText(t('@author has not created any blog entries.', array('@author' => format_username($this->own_user))), 'Users blog displayed with no entries');
+ $this->assertTitle(t("@name's blog", array('@name' => format_username($this->own_user))) . ' | Drupal', t('Blog title was displayed'));
+ $this->assertText(t('@author has not created any blog entries.', array('@author' => format_username($this->own_user))), t('Users blog displayed with no entries'));
}
/**
@@ -69,7 +69,7 @@ class BlogTestCase extends DrupalWebTestCase {
$edit = array();
$edit['blog_block_count'] = 5;
$this->drupalPost('admin/structure/block/manage/blog/recent/configure', $edit, t('Save block'));
- $this->assertEqual(variable_get('blog_block_count', 10), 5, 'Number of recent blog posts changed.');
+ $this->assertEqual(variable_get('blog_block_count', 10), 5, t('Number of recent blog posts changed.'));
// Do basic tests for each user.
$this->doBasicTests($this->any_user, TRUE);
@@ -128,31 +128,31 @@ class BlogTestCase extends DrupalWebTestCase {
$this->drupalGet('admin/help/blog');
$this->assertResponse($response2);
if ($response2 == 200) {
- $this->assertTitle(t('Blog | Drupal'), 'Blog help node was displayed');
- $this->assertText(t('Blog'), 'Blog help node was displayed');
+ $this->assertTitle(t('Blog | Drupal'), t('Blog help node was displayed'));
+ $this->assertText(t('Blog'), t('Blog help node was displayed'));
}
// Verify the blog block was displayed.
$this->drupalGet('');
$this->assertResponse(200);
- $this->assertText(t('Recent blog posts'), 'Blog block was displayed');
+ $this->assertText(t('Recent blog posts'), t('Blog block was displayed'));
// View blog node.
$this->drupalGet('node/' . $node->nid);
$this->assertResponse(200);
- $this->assertTitle($node->title . ' | Drupal', 'Blog node was displayed');
+ $this->assertTitle($node->title . ' | Drupal', t('Blog node was displayed'));
$breadcrumb = array(
l(t('Home'), NULL),
l(t('Blogs'), 'blog'),
l(t("!name's blog", array('!name' => format_username($node_user))), 'blog/' . $node_user->uid),
);
- $this->assertRaw(theme('breadcrumb', array('breadcrumb' => $breadcrumb)), 'Breadcrumbs were displayed');
+ $this->assertRaw(theme('breadcrumb', array('breadcrumb' => $breadcrumb)), t('Breadcrumbs were displayed'));
// View blog edit node.
$this->drupalGet('node/' . $node->nid . '/edit');
$this->assertResponse($response);
if ($response == 200) {
- $this->assertTitle('Edit Blog entry ' . $node->title . ' | Drupal', 'Blog edit node was displayed');
+ $this->assertTitle('Edit Blog entry ' . $node->title . ' | Drupal', t('Blog edit node was displayed'));
}
if ($response == 200) {
@@ -162,12 +162,12 @@ class BlogTestCase extends DrupalWebTestCase {
$edit["title"] = 'node/' . $node->nid;
$edit["body[$langcode][0][value]"] = $this->randomName(256);
$this->drupalPost('node/' . $node->nid . '/edit', $edit, t('Save'));
- $this->assertRaw(t('Blog entry %title has been updated.', array('%title' => $edit["title"])), 'Blog node was edited');
+ $this->assertRaw(t('Blog entry %title has been updated.', array('%title' => $edit["title"])), t('Blog node was edited'));
// Delete blog node.
$this->drupalPost('node/' . $node->nid . '/delete', array(), t('Delete'));
$this->assertResponse($response);
- $this->assertRaw(t('Blog entry %title has been deleted.', array('%title' => $edit["title"])), 'Blog node was deleted');
+ $this->assertRaw(t('Blog entry %title has been deleted.', array('%title' => $edit["title"])), t('Blog node was deleted'));
}
}
@@ -181,29 +181,29 @@ class BlogTestCase extends DrupalWebTestCase {
// Confirm blog entries link exists on the user page.
$this->drupalGet('user/' . $user->uid);
$this->assertResponse(200);
- $this->assertText(t('View recent blog entries'), 'View recent blog entries link was displayed');
+ $this->assertText(t('View recent blog entries'), t('View recent blog entries link was displayed'));
// Confirm the recent blog entries link goes to the user's blog page.
$this->clickLink('View recent blog entries');
- $this->assertTitle(t("@name's blog | Drupal", array('@name' => format_username($user))), 'View recent blog entries link target was correct');
+ $this->assertTitle(t("@name's blog | Drupal", array('@name' => format_username($user))), t('View recent blog entries link target was correct'));
// Confirm a blog page was displayed.
$this->drupalGet('blog');
$this->assertResponse(200);
- $this->assertTitle('Blogs | Drupal', 'Blog page was displayed');
- $this->assertText(t('Home'), 'Breadcrumbs were displayed');
+ $this->assertTitle('Blogs | Drupal', t('Blog page was displayed'));
+ $this->assertText(t('Home'), t('Breadcrumbs were displayed'));
$this->assertLink(t('Create new blog entry'));
// Confirm a blog page was displayed per user.
$this->drupalGet('blog/' . $user->uid);
- $this->assertTitle(t("@name's blog | Drupal", array('@name' => format_username($user))), 'User blog node was displayed');
+ $this->assertTitle(t("@name's blog | Drupal", array('@name' => format_username($user))), t('User blog node was displayed'));
// Confirm a blog feed was displayed.
$this->drupalGet('blog/feed');
- $this->assertTitle(t('Drupal blogs'), 'Blog feed was displayed');
+ $this->assertTitle(t('Drupal blogs'), t('Blog feed was displayed'));
// Confirm a blog feed was displayed per user.
$this->drupalGet('blog/' . $user->uid . '/feed');
- $this->assertTitle(t("@name's blog", array('@name' => format_username($user))), 'User blog feed was displayed');
+ $this->assertTitle(t("@name's blog", array('@name' => format_username($user))), t('User blog feed was displayed'));
}
}
diff --git a/modules/book/book.test b/modules/book/book.test
index 685a6fce4..a544617d4 100644
--- a/modules/book/book.test
+++ b/modules/book/book.test
@@ -5,10 +5,10 @@ class BookTestCase extends DrupalWebTestCase {
protected $book;
// $book_author is a user with permission to author a book.
protected $book_author;
- // $web_user is a user with permission to view a book
+ // $web_user is a user with permission to view a book
// and access the printer-friendly version.
protected $web_user;
-
+
public static function getInfo() {
return array(
'name' => 'Book functionality',
@@ -19,12 +19,12 @@ class BookTestCase extends DrupalWebTestCase {
function setUp() {
parent::setUp('book');
-
+
// Create users.
$this->book_author = $this->drupalCreateUser(array('create new books', 'create book content', 'edit own book content', 'add content to books'));
$this->web_user = $this->drupalCreateUser(array('access printer-friendly version'));
}
-
+
/**
* Create a new book with a page hierarchy.
*/
@@ -52,7 +52,7 @@ class BookTestCase extends DrupalWebTestCase {
$nodes[] = $this->createBookNode($book->nid); // Node 4.
$this->drupalLogout();
-
+
return $nodes;
}
@@ -63,7 +63,7 @@ class BookTestCase extends DrupalWebTestCase {
// Create new book.
$nodes = $this->createBook();
$book = $this->book;
-
+
$this->drupalLogin($this->web_user);
// Check that book pages display along with the correct outlines and
@@ -119,23 +119,23 @@ class BookTestCase extends DrupalWebTestCase {
// Check outline structure.
if ($nodes !== NULL) {
- $this->assertPattern($this->generateOutlinePattern($nodes), 'Node ' . $number . ' outline confirmed.');
+ $this->assertPattern($this->generateOutlinePattern($nodes), t('Node ' . $number . ' outline confirmed.'));
}
else {
- $this->pass('Node ' . $number . ' doesn\'t have outline.');
+ $this->pass(t('Node ' . $number . ' doesn\'t have outline.'));
}
// Check previous, up, and next links.
if ($previous) {
- $this->assertRaw(l('‹ ' . $previous->title, 'node/' . $previous->nid, array('attributes' => array('class' => array('page-previous'), 'title' => t('Go to previous page')))), 'Previous page link found.');
+ $this->assertRaw(l('‹ ' . $previous->title, 'node/' . $previous->nid, array('attributes' => array('class' => array('page-previous'), 'title' => t('Go to previous page')))), t('Previous page link found.'));
}
if ($up) {
- $this->assertRaw(l('up', 'node/' . $up->nid, array('attributes' => array('class' => array('page-up'), 'title' => t('Go to parent page')))), 'Up page link found.');
+ $this->assertRaw(l('up', 'node/' . $up->nid, array('attributes' => array('class' => array('page-up'), 'title' => t('Go to parent page')))), t('Up page link found.'));
}
if ($next) {
- $this->assertRaw(l($next->title . ' ›', 'node/' . $next->nid, array('attributes' => array('class' => array('page-next'), 'title' => t('Go to next page')))), 'Next page link found.');
+ $this->assertRaw(l($next->title . ' ›', 'node/' . $next->nid, array('attributes' => array('class' => array('page-next'), 'title' => t('Go to next page')))), t('Next page link found.'));
}
// Compute the expected breadcrumb.
@@ -153,12 +153,12 @@ class BookTestCase extends DrupalWebTestCase {
}
// Compare expected and got breadcrumbs.
- $this->assertIdentical($expected_breadcrumb, $got_breadcrumb, 'The breadcrumb is correctly displayed on the page.');
+ $this->assertIdentical($expected_breadcrumb, $got_breadcrumb, t('The breadcrumb is correctly displayed on the page.'));
// Check printer friendly version.
$this->drupalGet('book/export/html/' . $node->nid);
- $this->assertText($node->title, 'Printer friendly title found.');
- $this->assertRaw(check_markup($node->body[LANGUAGE_NONE][0]['value'], $node->body[LANGUAGE_NONE][0]['format']), 'Printer friendly body found.');
+ $this->assertText($node->title, t('Printer friendly title found.'));
+ $this->assertRaw(check_markup($node->body[LANGUAGE_NONE][0]['value'], $node->body[LANGUAGE_NONE][0]['format']), t('Printer friendly body found.'));
$number++;
}
@@ -206,44 +206,44 @@ class BookTestCase extends DrupalWebTestCase {
// Check to make sure the book node was created.
$node = $this->drupalGetNodeByTitle($edit['title']);
- $this->assertNotNull(($node === FALSE ? NULL : $node), 'Book node found in database.');
+ $this->assertNotNull(($node === FALSE ? NULL : $node), t('Book node found in database.'));
$number++;
return $node;
}
-
+
/**
* Tests book export ("printer-friendly version") functionality.
*/
function testBookExport() {
// Create a book.
$nodes = $this->createBook();
-
+
// Login as web user and view printer-friendly version.
$this->drupalLogin($this->web_user);
$this->drupalGet('node/' . $this->book->nid);
$this->clickLink(t('Printer-friendly version'));
-
+
// Make sure each part of the book is there.
foreach ($nodes as $node) {
- $this->assertText($node->title, 'Node title found in printer friendly version.');
- $this->assertRaw(check_markup($node->body[LANGUAGE_NONE][0]['value'], $node->body[LANGUAGE_NONE][0]['format']), 'Node body found in printer friendly version.');
+ $this->assertText($node->title, t('Node title found in printer friendly version.'));
+ $this->assertRaw(check_markup($node->body[LANGUAGE_NONE][0]['value'], $node->body[LANGUAGE_NONE][0]['format']), t('Node body found in printer friendly version.'));
}
-
+
// Make sure we can't export an unsupported format.
$this->drupalGet('book/export/foobar/' . $this->book->nid);
- $this->assertResponse('404', 'Unsupported export format returned "not found".');
-
+ $this->assertResponse('404', t('Unsupported export format returned "not found".'));
+
// Make sure an anonymous user cannot view printer-friendly version.
$this->drupalLogout();
-
+
// Load the book and verify there is no printer-friendly version link.
$this->drupalGet('node/' . $this->book->nid);
- $this->assertNoLink(t('Printer-friendly version'), 'Anonymous user is not shown link to printer-friendly version.');
-
+ $this->assertNoLink(t('Printer-friendly version'), t('Anonymous user is not shown link to printer-friendly version.'));
+
// Try getting the URL directly, and verify it fails.
$this->drupalGet('book/export/html/' . $this->book->nid);
- $this->assertResponse('403', 'Anonymous user properly forbidden.');
+ $this->assertResponse('403', t('Anonymous user properly forbidden.'));
}
}
@@ -267,12 +267,12 @@ class BookBlockTestCase extends DrupalWebTestCase {
function testBookNavigationBlock() {
// Set block title to confirm that the interface is availble.
$this->drupalPost('admin/structure/block/manage/book/navigation/configure', array('title' => $this->randomName(8)), t('Save block'));
- $this->assertText(t('The block configuration has been saved.'), 'Block configuration set.');
+ $this->assertText(t('The block configuration has been saved.'), t('Block configuration set.'));
// Set the block to a region to confirm block is availble.
$edit = array();
$edit['book_navigation[region]'] = 'footer';
$this->drupalPost('admin/structure/block', $edit, t('Save blocks'));
- $this->assertText(t('The block settings have been updated.'), 'Block successfully move to footer region.');
+ $this->assertText(t('The block settings have been updated.'), t('Block successfully move to footer region.'));
}
}
diff --git a/modules/comment/comment.test b/modules/comment/comment.test
index 55882c234..54a39bf01 100644
--- a/modules/comment/comment.test
+++ b/modules/comment/comment.test
@@ -44,7 +44,7 @@ class CommentHelperCase extends DrupalWebTestCase {
$edit['subject'] = $subject;
}
else {
- $this->assertNoFieldByName('subject', '', 'Subject field not found.');
+ $this->assertNoFieldByName('subject', '', t('Subject field not found.'));
}
if ($contact !== NULL && is_array($contact)) {
@@ -53,19 +53,19 @@ class CommentHelperCase extends DrupalWebTestCase {
switch ($preview_mode) {
case DRUPAL_REQUIRED:
// Preview required so no save button should be found.
- $this->assertNoFieldByName('op', t('Save'), 'Save button not found.');
+ $this->assertNoFieldByName('op', t('Save'), t('Save button not found.'));
$this->drupalPost(NULL, $edit, t('Preview'));
// Don't break here so that we can test post-preview field presence and
// function below.
case DRUPAL_OPTIONAL:
- $this->assertFieldByName('op', t('Preview'), 'Preview button found.');
- $this->assertFieldByName('op', t('Save'), 'Save button found.');
+ $this->assertFieldByName('op', t('Preview'), t('Preview button found.'));
+ $this->assertFieldByName('op', t('Save'), t('Save button found.'));
$this->drupalPost(NULL, $edit, t('Save'));
break;
case DRUPAL_DISABLED:
- $this->assertNoFieldByName('op', t('Preview'), 'Preview button not found.');
- $this->assertFieldByName('op', t('Save'), 'Save button found.');
+ $this->assertNoFieldByName('op', t('Preview'), t('Preview button not found.'));
+ $this->assertFieldByName('op', t('Save'), t('Save button found.'));
$this->drupalPost(NULL, $edit, t('Save'));
break;
}
@@ -79,7 +79,7 @@ class CommentHelperCase extends DrupalWebTestCase {
$this->assertText($subject, 'Comment subject posted.');
}
$this->assertText($comment, 'Comment body posted.');
- $this->assertTrue((!empty($match) && !empty($match[1])), 'Comment id found.');
+ $this->assertTrue((!empty($match) && !empty($match[1])), t('Comment id found.'));
}
if (isset($match[1])) {
@@ -103,7 +103,7 @@ class CommentHelperCase extends DrupalWebTestCase {
$regex .= $comment->comment . '(.*?)'; // Match comment.
$regex .= '/s';
- return (boolean) preg_match($regex, $this->drupalGetContent());
+ return (boolean)preg_match($regex, $this->drupalGetContent());
}
else {
return FALSE;
@@ -118,7 +118,7 @@ class CommentHelperCase extends DrupalWebTestCase {
*/
function deleteComment($comment) {
$this->drupalPost('comment/' . $comment->id . '/delete', array(), t('Delete'));
- $this->assertText(t('The comment and all its replies have been deleted.'), 'Comment deleted.');
+ $this->assertText(t('The comment and all its replies have been deleted.'), t('Comment deleted.'));
}
/**
@@ -196,7 +196,7 @@ class CommentHelperCase extends DrupalWebTestCase {
*/
function setCommentSettings($name, $value, $message) {
variable_set($name . '_article', $value);
- $this->assertTrue(TRUE, $message); // Display status message.
+ $this->assertTrue(TRUE, t($message)); // Display status message.
}
/**
@@ -226,10 +226,10 @@ class CommentHelperCase extends DrupalWebTestCase {
if ($operation == 'delete') {
$this->drupalPost(NULL, array(), t('Delete comments'));
- $this->assertRaw(t('Deleted @count comments.', array('@count' => 1)), 'Operation "' . $operation . '" was performed on comment.');
+ $this->assertRaw(t('Deleted @count comments.', array('@count' => 1)), t('Operation "' . $operation . '" was performed on comment.'));
}
else {
- $this->assertText(t('The update has been performed.'), 'Operation "' . $operation . '" was performed on comment.');
+ $this->assertText(t('The update has been performed.'), t('Operation "' . $operation . '" was performed on comment.'));
}
}
@@ -276,7 +276,7 @@ class CommentInterfaceTest extends CommentHelperCase {
$comment_text = $this->randomName();
$comment = $this->postComment($this->node, $comment_text);
$comment_loaded = comment_load($comment->id);
- $this->assertTrue($this->commentExists($comment), 'Comment found.');
+ $this->assertTrue($this->commentExists($comment), t('Comment found.'));
// Set comments to have subject and preview to required.
$this->drupalLogout();
@@ -291,12 +291,12 @@ class CommentInterfaceTest extends CommentHelperCase {
$comment_text = $this->randomName();
$comment = $this->postComment($this->node, $comment_text, $subject_text, TRUE);
$comment_loaded = comment_load($comment->id);
- $this->assertTrue($this->commentExists($comment), 'Comment found.');
+ $this->assertTrue($this->commentExists($comment), t('Comment found.'));
// Check comment display.
$this->drupalGet('node/' . $this->node->nid . '/' . $comment->id);
- $this->assertText($subject_text, 'Individual comment subject found.');
- $this->assertText($comment_text, 'Individual comment body found.');
+ $this->assertText($subject_text, t('Individual comment subject found.'));
+ $this->assertText($comment_text, t('Individual comment body found.'));
// Set comments to have subject and preview to optional.
$this->drupalLogout();
@@ -309,60 +309,60 @@ class CommentInterfaceTest extends CommentHelperCase {
// subject though field enabled.
$this->drupalLogin($this->web_user);
$this->drupalGet('comment/reply/' . $this->node->nid . '/' . $comment->id);
- $this->assertText($subject_text, 'Individual comment-reply subject found.');
- $this->assertText($comment_text, 'Individual comment-reply body found.');
+ $this->assertText($subject_text, t('Individual comment-reply subject found.'));
+ $this->assertText($comment_text, t('Individual comment-reply body found.'));
$reply = $this->postComment(NULL, $this->randomName(), '', TRUE);
$reply_loaded = comment_load($reply->id);
- $this->assertTrue($this->commentExists($reply, TRUE), 'Reply found.');
- $this->assertEqual($comment->id, $reply_loaded->pid, 'Pid of a reply to a comment is set correctly.');
- $this->assertEqual(rtrim($comment_loaded->thread, '/') . '.00/', $reply_loaded->thread, 'Thread of reply grows correctly.');
+ $this->assertTrue($this->commentExists($reply, TRUE), t('Reply found.'));
+ $this->assertEqual($comment->id, $reply_loaded->pid, t('Pid of a reply to a comment is set correctly.'));
+ $this->assertEqual(rtrim($comment_loaded->thread, '/') . '.00/', $reply_loaded->thread, t('Thread of reply grows correctly.'));
// Second reply to comment #3 creating comment #4.
$this->drupalGet('comment/reply/' . $this->node->nid . '/' . $comment->id);
- $this->assertText($subject_text, 'Individual comment-reply subject found.');
- $this->assertText($comment_text, 'Individual comment-reply body found.');
+ $this->assertText($subject_text, t('Individual comment-reply subject found.'));
+ $this->assertText($comment_text, t('Individual comment-reply body found.'));
$reply = $this->postComment(NULL, $this->randomName(), $this->randomName(), TRUE);
$reply_loaded = comment_load($reply->id);
- $this->assertTrue($this->commentExists($reply, TRUE), 'Second reply found.');
- $this->assertEqual(rtrim($comment_loaded->thread, '/') . '.01/', $reply_loaded->thread, 'Thread of second reply grows correctly.');
+ $this->assertTrue($this->commentExists($reply, TRUE), t('Second reply found.'));
+ $this->assertEqual(rtrim($comment_loaded->thread, '/') . '.01/', $reply_loaded->thread, t('Thread of second reply grows correctly.'));
// Edit reply.
$this->drupalGet('comment/' . $reply->id . '/edit');
$reply = $this->postComment(NULL, $this->randomName(), $this->randomName(), TRUE);
- $this->assertTrue($this->commentExists($reply, TRUE), 'Modified reply found.');
+ $this->assertTrue($this->commentExists($reply, TRUE), t('Modified reply found.'));
// Correct link count
$this->drupalGet('node');
- $this->assertRaw('4 comments', 'Link to the 4 comments exist.');
+ $this->assertRaw('4 comments', t('Link to the 4 comments exist.'));
// Confirm a new comment is posted to the correct page.
$this->setCommentsPerPage(2);
$comment_new_page = $this->postComment($this->node, $this->randomName(), $this->randomName(), TRUE);
- $this->assertTrue($this->commentExists($comment_new_page), 'Page one exists. %s');
+ $this->assertTrue($this->commentExists($comment_new_page), t('Page one exists. %s'));
$this->drupalGet('node/' . $this->node->nid, array('query' => array('page' => 1)));
- $this->assertTrue($this->commentExists($reply, TRUE), 'Page two exists. %s');
+ $this->assertTrue($this->commentExists($reply, TRUE), t('Page two exists. %s'));
$this->setCommentsPerPage(50);
// Attempt to post to node with comments disabled.
$this->node = $this->drupalCreateNode(array('type' => 'article', 'promote' => 1, 'comment' => COMMENT_NODE_HIDDEN));
- $this->assertTrue($this->node, 'Article node created.');
+ $this->assertTrue($this->node, t('Article node created.'));
$this->drupalGet('comment/reply/' . $this->node->nid);
- $this->assertText('This discussion is closed', 'Posting to node with comments disabled');
- $this->assertNoField('edit-comment', 'Comment body field found.');
+ $this->assertText('This discussion is closed', t('Posting to node with comments disabled'));
+ $this->assertNoField('edit-comment', t('Comment body field found.'));
// Attempt to post to node with read-only comments.
$this->node = $this->drupalCreateNode(array('type' => 'article', 'promote' => 1, 'comment' => COMMENT_NODE_CLOSED));
- $this->assertTrue($this->node, 'Article node created.');
+ $this->assertTrue($this->node, t('Article node created.'));
$this->drupalGet('comment/reply/' . $this->node->nid);
- $this->assertText('This discussion is closed', 'Posting to node with comments read-only');
- $this->assertNoField('edit-comment', 'Comment body field found.');
+ $this->assertText('This discussion is closed', t('Posting to node with comments read-only'));
+ $this->assertNoField('edit-comment', t('Comment body field found.'));
// Attempt to post to node with comments enabled (check field names etc).
$this->node = $this->drupalCreateNode(array('type' => 'article', 'promote' => 1, 'comment' => COMMENT_NODE_OPEN));
- $this->assertTrue($this->node, 'Article node created.');
+ $this->assertTrue($this->node, t('Article node created.'));
$this->drupalGet('comment/reply/' . $this->node->nid);
- $this->assertNoText('This discussion is closed', 'Posting to node with comments enabled');
- $this->assertField('edit-comment-body-' . $langcode . '-0-value', 'Comment body field found.');
+ $this->assertNoText('This discussion is closed', t('Posting to node with comments enabled'));
+ $this->assertField('edit-comment-body-' . $langcode . '-0-value', t('Comment body field found.'));
// Delete comment and make sure that reply is also removed.
$this->drupalLogout();
@@ -371,8 +371,8 @@ class CommentInterfaceTest extends CommentHelperCase {
$this->deleteComment($comment_new_page);
$this->drupalGet('node/' . $this->node->nid);
- $this->assertFalse($this->commentExists($comment), 'Comment not found.');
- $this->assertFalse($this->commentExists($reply, TRUE), 'Reply not found.');
+ $this->assertFalse($this->commentExists($comment), t('Comment not found.'));
+ $this->assertFalse($this->commentExists($reply, TRUE), t('Reply not found.'));
// Enabled comment form on node page.
$this->drupalLogin($this->admin_user);
@@ -383,7 +383,7 @@ class CommentInterfaceTest extends CommentHelperCase {
$this->drupalLogin($this->web_user);
$this->drupalGet('node/' . $this->node->nid);
$form_comment = $this->postComment(NULL, $this->randomName(), $this->randomName(), TRUE);
- $this->assertTrue($this->commentExists($form_comment), 'Form comment found.');
+ $this->assertTrue($this->commentExists($form_comment), t('Form comment found.'));
// Disable comment form on node page.
$this->drupalLogout();
@@ -426,13 +426,13 @@ class CommentPreviewTest extends CommentHelperCase {
$this->drupalPost('node/' . $this->node->nid, $edit, t('Preview'));
// Check that the preview is displaying the title and body.
- $this->assertTitle(t('Preview comment | Drupal'), 'Page title is "Preview comment".');
- $this->assertText($edit['subject'], 'Subject displayed.');
- $this->assertText($edit['comment_body[' . $langcode . '][0][value]'], 'Comment displayed.');
+ $this->assertTitle(t('Preview comment | Drupal'), t('Page title is "Preview comment".'));
+ $this->assertText($edit['subject'], t('Subject displayed.'));
+ $this->assertText($edit['comment_body[' . $langcode . '][0][value]'], t('Comment displayed.'));
// Check that the title and body fields are displayed with the correct values.
- $this->assertFieldByName('subject', $edit['subject'], 'Subject field displayed.');
- $this->assertFieldByName('comment_body[' . $langcode . '][0][value]', $edit['comment_body[' . $langcode . '][0][value]'], 'Comment field displayed.');
+ $this->assertFieldByName('subject', $edit['subject'], t('Subject field displayed.'));
+ $this->assertFieldByName('comment_body[' . $langcode . '][0][value]', $edit['comment_body[' . $langcode . '][0][value]'], t('Comment field displayed.'));
}
/**
@@ -457,17 +457,17 @@ class CommentPreviewTest extends CommentHelperCase {
$this->drupalPost('comment/' . $comment->id . '/edit', $edit, t('Preview'));
// Check that the preview is displaying the subject, comment, author and date correctly.
- $this->assertTitle(t('Preview comment | Drupal'), 'Page title is "Preview comment".');
- $this->assertText($edit['subject'], 'Subject displayed.');
- $this->assertText($edit['comment_body[' . $langcode . '][0][value]'], 'Comment displayed.');
- $this->assertText($edit['name'], 'Author displayed.');
- $this->assertText($expected_date, 'Date displayed.');
+ $this->assertTitle(t('Preview comment | Drupal'), t('Page title is "Preview comment".'));
+ $this->assertText($edit['subject'], t('Subject displayed.'));
+ $this->assertText($edit['comment_body[' . $langcode . '][0][value]'], t('Comment displayed.'));
+ $this->assertText($edit['name'], t('Author displayed.'));
+ $this->assertText($expected_date, t('Date displayed.'));
// Check that the title and body fields are displayed with the correct values.
- $this->assertFieldByName('subject', $edit['subject'], 'Subject field displayed.');
- $this->assertFieldByName('comment_body[' . $langcode . '][0][value]', $edit['comment_body[' . $langcode . '][0][value]'], 'Comment field displayed.');
- $this->assertFieldByName('name', $edit['name'], 'Author field displayed.');
- $this->assertFieldByName('date', $edit['date'], 'Date field displayed.');
+ $this->assertFieldByName('subject', $edit['subject'], t('Subject field displayed.'));
+ $this->assertFieldByName('comment_body[' . $langcode . '][0][value]', $edit['comment_body[' . $langcode . '][0][value]'], t('Comment field displayed.'));
+ $this->assertFieldByName('name', $edit['name'], t('Author field displayed.'));
+ $this->assertFieldByName('date', $edit['date'], t('Date field displayed.'));
}
}
@@ -502,7 +502,7 @@ class CommentAnonymous extends CommentHelperCase {
// Post anonymous comment without contact info.
$anonymous_comment1 = $this->postComment($this->node, $this->randomName(), $this->randomName());
- $this->assertTrue($this->commentExists($anonymous_comment1), 'Anonymous comment without contact info found.');
+ $this->assertTrue($this->commentExists($anonymous_comment1), t('Anonymous comment without contact info found.'));
// Allow contact info.
$this->drupalLogin($this->admin_user);
@@ -511,15 +511,15 @@ class CommentAnonymous extends CommentHelperCase {
// Attempt to edit anonymous comment.
$this->drupalGet('comment/' . $anonymous_comment1->id . '/edit');
$edited_comment = $this->postComment(NULL, $this->randomName(), $this->randomName());
- $this->assertTrue($this->commentExists($edited_comment, FALSE), 'Modified reply found.');
+ $this->assertTrue($this->commentExists($edited_comment, FALSE), t('Modified reply found.'));
$this->drupalLogout();
// Post anonymous comment with contact info (optional).
$this->drupalGet('comment/reply/' . $this->node->nid);
- $this->assertTrue($this->commentContactInfoAvailable(), 'Contact information available.');
+ $this->assertTrue($this->commentContactInfoAvailable(), t('Contact information available.'));
$anonymous_comment2 = $this->postComment($this->node, $this->randomName(), $this->randomName());
- $this->assertTrue($this->commentExists($anonymous_comment2), 'Anonymous comment with contact info (optional) found.');
+ $this->assertTrue($this->commentExists($anonymous_comment2), t('Anonymous comment with contact info (optional) found.'));
// Require contact info.
$this->drupalLogin($this->admin_user);
@@ -528,41 +528,41 @@ class CommentAnonymous extends CommentHelperCase {
// Try to post comment with contact info (required).
$this->drupalGet('comment/reply/' . $this->node->nid);
- $this->assertTrue($this->commentContactInfoAvailable(), 'Contact information available.');
+ $this->assertTrue($this->commentContactInfoAvailable(), t('Contact information available.'));
$anonymous_comment3 = $this->postComment($this->node, $this->randomName(), $this->randomName(), TRUE);
- $this->assertText(t('E-mail field is required.'), 'E-mail required.'); // Name should have 'Anonymous' for value by default.
- $this->assertFalse($this->commentExists($anonymous_comment3), 'Anonymous comment with contact info (required) not found.');
+ $this->assertText(t('E-mail field is required.'), t('E-mail required.')); // Name should have 'Anonymous' for value by default.
+ $this->assertFalse($this->commentExists($anonymous_comment3), t('Anonymous comment with contact info (required) not found.'));
// Post comment with contact info (required).
$author_name = $this->randomName();
$author_mail = $this->randomName() . '@example.com';
$anonymous_comment3 = $this->postComment($this->node, $this->randomName(), $this->randomName(), array('name' => $author_name, 'mail' => $author_mail));
- $this->assertTrue($this->commentExists($anonymous_comment3), 'Anonymous comment with contact info (required) found.');
+ $this->assertTrue($this->commentExists($anonymous_comment3), t('Anonymous comment with contact info (required) found.'));
// Make sure the user data appears correctly when editing the comment.
$this->drupalLogin($this->admin_user);
$this->drupalGet('comment/' . $anonymous_comment3->id . '/edit');
- $this->assertRaw($author_name, "The anonymous user's name is correct when editing the comment.");
- $this->assertRaw($author_mail, "The anonymous user's e-mail address is correct when editing the comment.");
+ $this->assertRaw($author_name, t("The anonymous user's name is correct when editing the comment."));
+ $this->assertRaw($author_mail, t("The anonymous user's e-mail address is correct when editing the comment."));
// Unpublish comment.
$this->performCommentOperation($anonymous_comment3, 'unpublish');
$this->drupalGet('admin/content/comment/approval');
- $this->assertRaw('comments[' . $anonymous_comment3->id . ']', 'Comment was unpublished.');
+ $this->assertRaw('comments[' . $anonymous_comment3->id . ']', t('Comment was unpublished.'));
// Publish comment.
$this->performCommentOperation($anonymous_comment3, 'publish', TRUE);
$this->drupalGet('admin/content/comment');
- $this->assertRaw('comments[' . $anonymous_comment3->id . ']', 'Comment was published.');
+ $this->assertRaw('comments[' . $anonymous_comment3->id . ']', t('Comment was published.'));
// Delete comment.
$this->performCommentOperation($anonymous_comment3, 'delete');
$this->drupalGet('admin/content/comment');
- $this->assertNoRaw('comments[' . $anonymous_comment3->id . ']', 'Comment was deleted.');
+ $this->assertNoRaw('comments[' . $anonymous_comment3->id . ']', t('Comment was deleted.'));
$this->drupalLogout();
// Reset.
@@ -576,14 +576,14 @@ class CommentAnonymous extends CommentHelperCase {
// NOTE: if authenticated user has permission to post comments, then a
// "Login or register to post comments" type link may be shown.
$this->drupalGet('node/' . $this->node->nid);
- $this->assertNoPattern('/<div ([^>]*?)id="comments"([^>]*?)>/', 'Comments were not displayed.');
- $this->assertNoLink('Add new comment', 'Link to add comment was found.');
+ $this->assertNoPattern('/<div ([^>]*?)id="comments"([^>]*?)>/', t('Comments were not displayed.'));
+ $this->assertNoLink('Add new comment', t('Link to add comment was found.'));
// Attempt to view node-comment form while disallowed.
$this->drupalGet('comment/reply/' . $this->node->nid);
- $this->assertText('You are not authorized to view comments', 'Error attempting to post comment.');
- $this->assertNoFieldByName('subject', '', 'Subject field not found.');
- $this->assertNoFieldByName('comment[value]', '', 'Comment field not found.');
+ $this->assertText('You are not authorized to view comments', t('Error attempting to post comment.'));
+ $this->assertNoFieldByName('subject', '', t('Subject field not found.'));
+ $this->assertNoFieldByName('comment[value]', '', t('Comment field not found.'));
user_role_change_permissions(DRUPAL_ANONYMOUS_RID, array(
'access comments' => TRUE,
@@ -591,9 +591,9 @@ class CommentAnonymous extends CommentHelperCase {
'post comments without approval' => FALSE,
));
$this->drupalGet('node/' . $this->node->nid);
- $this->assertPattern('/<div ([^>]*?)id="comments"([^>]*?)>/', 'Comments were displayed.');
- $this->assertLink('Log in', 1, 'Link to log in was found.');
- $this->assertLink('register', 1, 'Link to register was found.');
+ $this->assertPattern('/<div ([^>]*?)id="comments"([^>]*?)>/', t('Comments were displayed.'));
+ $this->assertLink('Log in', 1, t('Link to log in was found.'));
+ $this->assertLink('register', 1, t('Link to register was found.'));
}
}
@@ -637,22 +637,22 @@ class CommentPagerTest extends CommentHelperCase {
// Check the first page of the node, and confirm the correct comments are
// shown.
$this->drupalGet('node/' . $node->nid);
- $this->assertRaw(t('next'), 'Paging links found.');
- $this->assertTrue($this->commentExists($comments[0]), 'Comment 1 appears on page 1.');
- $this->assertFalse($this->commentExists($comments[1]), 'Comment 2 does not appear on page 1.');
- $this->assertFalse($this->commentExists($comments[2]), 'Comment 3 does not appear on page 1.');
+ $this->assertRaw(t('next'), t('Paging links found.'));
+ $this->assertTrue($this->commentExists($comments[0]), t('Comment 1 appears on page 1.'));
+ $this->assertFalse($this->commentExists($comments[1]), t('Comment 2 does not appear on page 1.'));
+ $this->assertFalse($this->commentExists($comments[2]), t('Comment 3 does not appear on page 1.'));
// Check the second page.
$this->drupalGet('node/' . $node->nid, array('query' => array('page' => 1)));
- $this->assertTrue($this->commentExists($comments[1]), 'Comment 2 appears on page 2.');
- $this->assertFalse($this->commentExists($comments[0]), 'Comment 1 does not appear on page 2.');
- $this->assertFalse($this->commentExists($comments[2]), 'Comment 3 does not appear on page 2.');
+ $this->assertTrue($this->commentExists($comments[1]), t('Comment 2 appears on page 2.'));
+ $this->assertFalse($this->commentExists($comments[0]), t('Comment 1 does not appear on page 2.'));
+ $this->assertFalse($this->commentExists($comments[2]), t('Comment 3 does not appear on page 2.'));
// Check the third page.
$this->drupalGet('node/' . $node->nid, array('query' => array('page' => 2)));
- $this->assertTrue($this->commentExists($comments[2]), 'Comment 3 appears on page 3.');
- $this->assertFalse($this->commentExists($comments[0]), 'Comment 1 does not appear on page 3.');
- $this->assertFalse($this->commentExists($comments[1]), 'Comment 2 does not appear on page 3.');
+ $this->assertTrue($this->commentExists($comments[2]), t('Comment 3 appears on page 3.'));
+ $this->assertFalse($this->commentExists($comments[0]), t('Comment 1 does not appear on page 3.'));
+ $this->assertFalse($this->commentExists($comments[1]), t('Comment 2 does not appear on page 3.'));
// Post a reply to the oldest comment and test again.
$replies = array();
@@ -664,21 +664,21 @@ class CommentPagerTest extends CommentHelperCase {
// We are still in flat view - the replies should not be on the first page,
// even though they are replies to the oldest comment.
$this->drupalGet('node/' . $node->nid, array('query' => array('page' => 0)));
- $this->assertFalse($this->commentExists($reply, TRUE), 'In flat mode, reply does not appear on page 1.');
+ $this->assertFalse($this->commentExists($reply, TRUE), t('In flat mode, reply does not appear on page 1.'));
// If we switch to threaded mode, the replies on the oldest comment
// should be bumped to the first page and comment 6 should be bumped
// to the second page.
$this->setCommentSettings('comment_default_mode', COMMENT_MODE_THREADED, t('Switched to threaded mode.'));
$this->drupalGet('node/' . $node->nid, array('query' => array('page' => 0)));
- $this->assertTrue($this->commentExists($reply, TRUE), 'In threaded mode, reply appears on page 1.');
- $this->assertFalse($this->commentExists($comments[1]), 'In threaded mode, comment 2 has been bumped off of page 1.');
+ $this->assertTrue($this->commentExists($reply, TRUE), t('In threaded mode, reply appears on page 1.'));
+ $this->assertFalse($this->commentExists($comments[1]), t('In threaded mode, comment 2 has been bumped off of page 1.'));
// If (# replies > # comments per page) in threaded expanded view,
// the overage should be bumped.
$reply2 = $this->postComment(NULL, $this->randomName(), $this->randomName(), TRUE);
$this->drupalGet('node/' . $node->nid, array('query' => array('page' => 0)));
- $this->assertFalse($this->commentExists($reply2, TRUE), 'In threaded mode where # replies > # comments per page, the newest reply does not appear on page 1.');
+ $this->assertFalse($this->commentExists($reply2, TRUE), t('In threaded mode where # replies > # comments per page, the newest reply does not appear on page 1.'));
$this->drupalLogout();
}
@@ -780,7 +780,7 @@ class CommentPagerTest extends CommentHelperCase {
$result_order[] = substr($anchor['id'], 8);
}
- return $this->assertIdentical($expected_cids, $result_order, 'Comment order: expected ' . implode(',', $expected_cids) . ', returned ' . implode(',', $result_order) . '.');
+ return $this->assertIdentical($expected_cids, $result_order, t('Comment order: expected @expected, returned @returned.', array('@expected' => implode(',', $expected_cids), '@returned' => implode(',', $result_order))));
}
/**
@@ -840,7 +840,7 @@ class CommentPagerTest extends CommentHelperCase {
foreach ($expected_pages as $new_replies => $expected_page) {
$returned = comment_new_page_count($node->comment_count, $new_replies, $node);
$returned_page = is_array($returned) ? $returned['page'] : 0;
- $this->assertIdentical($expected_page, $returned_page, 'Flat mode, ' . $new_replies . ' replies: expected page ' . $expected_page . ', returned page ' . $returned_page . '.');
+ $this->assertIdentical($expected_page, $returned_page, t('Flat mode, @new replies: expected page @expected, returned page @returned.', array('@new' => $new_replies, '@expected' => $expected_page, '@returned' => $returned_page)));
}
$this->setCommentSettings('comment_default_mode', COMMENT_MODE_THREADED, t('Switched to threaded mode.'));
@@ -858,7 +858,7 @@ class CommentPagerTest extends CommentHelperCase {
foreach ($expected_pages as $new_replies => $expected_page) {
$returned = comment_new_page_count($node->comment_count, $new_replies, $node);
$returned_page = is_array($returned) ? $returned['page'] : 0;
- $this->assertEqual($expected_page, $returned_page, 'Threaded mode, ' . $new_replies . ' replies: expected page ' . $expected_page . ', returned page ' . $returned_page . '.');
+ $this->assertEqual($expected_page, $returned_page, t('Threaded mode, @new replies: expected page @expected, returned page @returned.', array('@new' => $new_replies, '@expected' => $expected_page, '@returned' => $returned_page)));
}
}
}
@@ -895,7 +895,7 @@ class CommentApprovalTest extends CommentHelperCase {
$subject = $this->randomName();
$body = $this->randomName();
$this->postComment($this->node, $body, $subject, TRUE); // Set $contact to true so that it won't check for id and message.
- $this->assertText(t('Your comment has been queued for review by site administrators and will be published after approval.'), 'Comment requires approval.');
+ $this->assertText(t('Your comment has been queued for review by site administrators and will be published after approval.'), t('Comment requires approval.'));
// Get unapproved comment id.
$this->drupalLogin($this->admin_user);
@@ -903,7 +903,7 @@ class CommentApprovalTest extends CommentHelperCase {
$anonymous_comment4 = (object) array('id' => $anonymous_comment4, 'subject' => $subject, 'comment' => $body);
$this->drupalLogout();
- $this->assertFalse($this->commentExists($anonymous_comment4), 'Anonymous comment was not published.');
+ $this->assertFalse($this->commentExists($anonymous_comment4), t('Anonymous comment was not published.'));
// Approve comment.
$this->drupalLogin($this->admin_user);
@@ -911,7 +911,7 @@ class CommentApprovalTest extends CommentHelperCase {
$this->drupalLogout();
$this->drupalGet('node/' . $this->node->nid);
- $this->assertTrue($this->commentExists($anonymous_comment4), 'Anonymous comment visible.');
+ $this->assertTrue($this->commentExists($anonymous_comment4), t('Anonymous comment visible.'));
// Post 2 anonymous comments without contact info.
$comments[] = $this->postComment($this->node, $this->randomName(), $this->randomName(), TRUE);
@@ -920,13 +920,13 @@ class CommentApprovalTest extends CommentHelperCase {
// Publish multiple comments in one operation.
$this->drupalLogin($this->admin_user);
$this->drupalGet('admin/content/comment/approval');
- $this->assertText(t('Unapproved comments (@count)', array('@count' => 2)), 'Two unapproved comments waiting for approval.');
+ $this->assertText(t('Unapproved comments (@count)', array('@count' => 2)), t('Two unapproved comments waiting for approval.'));
$edit = array(
"comments[{$comments[0]->id}]" => 1,
"comments[{$comments[1]->id}]" => 1,
);
$this->drupalPost(NULL, $edit, t('Update'));
- $this->assertText(t('Unapproved comments (@count)', array('@count' => 0)), 'All comments were approved.');
+ $this->assertText(t('Unapproved comments (@count)', array('@count' => 0)), t('All comments were approved.'));
// Delete multiple comments in one operation.
$edit = array(
@@ -936,9 +936,9 @@ class CommentApprovalTest extends CommentHelperCase {
"comments[{$anonymous_comment4->id}]" => 1,
);
$this->drupalPost(NULL, $edit, t('Update'));
- $this->assertText(t('Are you sure you want to delete these comments and all their children?'), 'Confirmation required.');
+ $this->assertText(t('Are you sure you want to delete these comments and all their children?'), t('Confirmation required.'));
$this->drupalPost(NULL, $edit, t('Delete comments'));
- $this->assertText(t('No comments available.'), 'All comments were deleted.');
+ $this->assertText(t('No comments available.'), t('All comments were deleted.'));
}
/**
@@ -959,7 +959,7 @@ class CommentApprovalTest extends CommentHelperCase {
$subject = $this->randomName();
$body = $this->randomName();
$this->postComment($this->node, $body, $subject, TRUE); // Set $contact to true so that it won't check for id and message.
- $this->assertText(t('Your comment has been queued for review by site administrators and will be published after approval.'), 'Comment requires approval.');
+ $this->assertText(t('Your comment has been queued for review by site administrators and will be published after approval.'), t('Comment requires approval.'));
// Get unapproved comment id.
$this->drupalLogin($this->admin_user);
@@ -967,20 +967,20 @@ class CommentApprovalTest extends CommentHelperCase {
$anonymous_comment4 = (object) array('id' => $anonymous_comment4, 'subject' => $subject, 'comment' => $body);
$this->drupalLogout();
- $this->assertFalse($this->commentExists($anonymous_comment4), 'Anonymous comment was not published.');
+ $this->assertFalse($this->commentExists($anonymous_comment4), t('Anonymous comment was not published.'));
// Approve comment.
$this->drupalLogin($this->admin_user);
$this->drupalGet('comment/1/approve');
- $this->assertResponse(403, 'Forged comment approval was denied.');
+ $this->assertResponse(403, t('Forged comment approval was denied.'));
$this->drupalGet('comment/1/approve', array('query' => array('token' => 'forged')));
- $this->assertResponse(403, 'Forged comment approval was denied.');
+ $this->assertResponse(403, t('Forged comment approval was denied.'));
$this->drupalGet('node/' . $this->node->nid);
$this->clickLink(t('approve'));
$this->drupalLogout();
$this->drupalGet('node/' . $this->node->nid);
- $this->assertTrue($this->commentExists($anonymous_comment4), 'Anonymous comment visible.');
+ $this->assertTrue($this->commentExists($anonymous_comment4), t('Anonymous comment visible.'));
}
}
@@ -1007,7 +1007,7 @@ class CommentBlockFunctionalTest extends CommentHelperCase {
'comment_recent[region]' => 'sidebar_first',
);
$this->drupalPost('admin/structure/block', $edit, t('Save blocks'));
- $this->assertText(t('The block settings have been updated.'), 'Block saved to first sidebar region.');
+ $this->assertText(t('The block settings have been updated.'), t('Block saved to first sidebar region.'));
// Set block title and variables.
$block = array(
@@ -1015,7 +1015,7 @@ class CommentBlockFunctionalTest extends CommentHelperCase {
'comment_block_count' => 2,
);
$this->drupalPost('admin/structure/block/manage/comment/recent/configure', $block, t('Save block'));
- $this->assertText(t('The block configuration has been saved.'), 'Block saved.');
+ $this->assertText(t('The block configuration has been saved.'), t('Block saved.'));
// Add some test comments, one without a subject.
$comment1 = $this->postComment($this->node, $this->randomName(), $this->randomName());
@@ -1027,20 +1027,20 @@ class CommentBlockFunctionalTest extends CommentHelperCase {
$this->drupalLogout();
user_role_revoke_permissions(DRUPAL_ANONYMOUS_RID, array('access comments'));
$this->drupalGet('');
- $this->assertNoText($block['title'], 'Block was not found.');
+ $this->assertNoText($block['title'], t('Block was not found.'));
user_role_grant_permissions(DRUPAL_ANONYMOUS_RID, array('access comments'));
// Test that a user with the 'access comments' permission can see the
// block.
$this->drupalLogin($this->web_user);
$this->drupalGet('');
- $this->assertText($block['title'], 'Block was found.');
+ $this->assertText($block['title'], t('Block was found.'));
// Test the only the 2 latest comments are shown and in the proper order.
- $this->assertNoText($comment1->subject, 'Comment not found in block.');
- $this->assertText($comment2->subject, 'Comment found in block.');
- $this->assertText($comment3->comment, 'Comment found in block.');
- $this->assertTrue(strpos($this->drupalGetContent(), $comment3->comment) < strpos($this->drupalGetContent(), $comment2->subject), 'Comments were ordered correctly in block.');
+ $this->assertNoText($comment1->subject, t('Comment not found in block.'));
+ $this->assertText($comment2->subject, t('Comment found in block.'));
+ $this->assertText($comment3->comment, t('Comment found in block.'));
+ $this->assertTrue(strpos($this->drupalGetContent(), $comment3->comment) < strpos($this->drupalGetContent(), $comment2->subject), t('Comments were ordered correctly in block.'));
// Set the number of recent comments to show to 10.
$this->drupalLogout();
@@ -1049,30 +1049,30 @@ class CommentBlockFunctionalTest extends CommentHelperCase {
'comment_block_count' => 10,
);
$this->drupalPost('admin/structure/block/manage/comment/recent/configure', $block, t('Save block'));
- $this->assertText(t('The block configuration has been saved.'), 'Block saved.');
+ $this->assertText(t('The block configuration has been saved.'), t('Block saved.'));
// Post an additional comment.
$comment4 = $this->postComment($this->node, $this->randomName(), $this->randomName());
// Test that all four comments are shown.
- $this->assertText($comment1->subject, 'Comment found in block.');
- $this->assertText($comment2->subject, 'Comment found in block.');
- $this->assertText($comment3->comment, 'Comment found in block.');
- $this->assertText($comment4->subject, 'Comment found in block.');
+ $this->assertText($comment1->subject, t('Comment found in block.'));
+ $this->assertText($comment2->subject, t('Comment found in block.'));
+ $this->assertText($comment3->comment, t('Comment found in block.'));
+ $this->assertText($comment4->subject, t('Comment found in block.'));
// Test that links to comments work when comments are across pages.
$this->setCommentsPerPage(1);
$this->drupalGet('');
$this->clickLink($comment1->subject);
- $this->assertText($comment1->subject, 'Comment link goes to correct page.');
+ $this->assertText($comment1->subject, t('Comment link goes to correct page.'));
$this->drupalGet('');
$this->clickLink($comment2->subject);
- $this->assertText($comment2->subject, 'Comment link goes to correct page.');
+ $this->assertText($comment2->subject, t('Comment link goes to correct page.'));
$this->clickLink($comment4->subject);
- $this->assertText($comment4->subject, 'Comment link goes to correct page.');
+ $this->assertText($comment4->subject, t('Comment link goes to correct page.'));
// Check that when viewing a comment page from a link to the comment, that
// rel="canonical" is added to the head of the document.
- $this->assertRaw('<link rel="canonical"', 'Canonical URL was found in the HTML head');
+ $this->assertRaw('<link rel="canonical"', t('Canonical URL was found in the HTML head'));
}
}
@@ -1097,13 +1097,13 @@ class CommentRSSUnitTest extends CommentHelperCase {
$comment = $this->postComment($this->node, $this->randomName(), $this->randomName());
$this->drupalGet('rss.xml');
$raw = '<comments>' . url('node/' . $this->node->nid, array('fragment' => 'comments', 'absolute' => TRUE)) . '</comments>';
- $this->assertRaw($raw, 'Comments as part of RSS feed.');
+ $this->assertRaw($raw, t('Comments as part of RSS feed.'));
// Hide comments from RSS feed and check presence.
$this->node->comment = COMMENT_NODE_HIDDEN;
node_save($this->node);
$this->drupalGet('rss.xml');
- $this->assertNoRaw($raw, 'Hidden comments is not a part of RSS feed.');
+ $this->assertNoRaw($raw, t('Hidden comments is not a part of RSS feed.'));
}
}
@@ -1137,14 +1137,14 @@ class CommentContentRebuild extends CommentHelperCase {
$comment_text = $this->randomName();
$comment = $this->postComment($this->node, $comment_text, $subject_text, TRUE);
$comment_loaded = comment_load($comment->id);
- $this->assertTrue($this->commentExists($comment), 'Comment found.');
+ $this->assertTrue($this->commentExists($comment), t('Comment found.'));
// Add the property to the content array and then see if it still exists on build.
$comment_loaded->content['test_property'] = array('#value' => $this->randomString());
$built_content = comment_view($comment_loaded, $this->node);
// This means that the content was rebuilt as the added test property no longer exists.
- $this->assertFalse(isset($built_content['test_property']), 'Comment content was emptied before being built.');
+ $this->assertFalse(isset($built_content['test_property']), t('Comment content was emptied before being built.'));
}
}
@@ -1210,11 +1210,11 @@ class CommentTokenReplaceTestCase extends CommentHelperCase {
$tests['[comment:author:name]'] = check_plain($this->admin_user->name);
// Test to make sure that we generated something for each token.
- $this->assertFalse(in_array(0, array_map('strlen', $tests)), 'No empty tokens generated.');
+ $this->assertFalse(in_array(0, array_map('strlen', $tests)), t('No empty tokens generated.'));
foreach ($tests as $input => $expected) {
$output = token_replace($input, array('comment' => $comment), array('language' => $language));
- $this->assertFalse(strcmp($output, $expected), 'Sanitized comment token ' . $input . ' replaced.');
+ $this->assertFalse(strcmp($output, $expected), t('Sanitized comment token %token replaced.', array('%token' => $input)));
}
// Generate and test unsanitized tokens.
@@ -1230,7 +1230,7 @@ class CommentTokenReplaceTestCase extends CommentHelperCase {
foreach ($tests as $input => $expected) {
$output = token_replace($input, array('comment' => $comment), array('language' => $language, 'sanitize' => FALSE));
- $this->assertFalse(strcmp($output, $expected), 'Unsanitized comment token ' . $input . ' replaced.');
+ $this->assertFalse(strcmp($output, $expected), t('Unsanitized comment token %token replaced.', array('%token' => $input)));
}
// Load node so comment_count gets computed.
@@ -1243,7 +1243,7 @@ class CommentTokenReplaceTestCase extends CommentHelperCase {
foreach ($tests as $input => $expected) {
$output = token_replace($input, array('node' => $node), array('language' => $language));
- $this->assertFalse(strcmp($output, $expected), 'Node comment token ' . $input . ' replaced.');
+ $this->assertFalse(strcmp($output, $expected), t('Node comment token %token replaced.', array('%token' => $input)));
}
}
}
diff --git a/modules/contact/contact.test b/modules/contact/contact.test
index 04020947d..80a157b87 100644
--- a/modules/contact/contact.test
+++ b/modules/contact/contact.test
@@ -33,7 +33,7 @@ class ContactSitewideTestCase extends DrupalWebTestCase {
$edit = array();
$edit['contact_default_status'] = TRUE;
$this->drupalPost('admin/config/people/accounts', $edit, t('Save configuration'));
- $this->assertText(t('The configuration options have been saved.'), 'Setting successfully saved.');
+ $this->assertText(t('The configuration options have been saved.'), t('Setting successfully saved.'));
// Delete old categories to ensure that new categories are used.
$this->deleteCategories();
@@ -53,21 +53,21 @@ class ContactSitewideTestCase extends DrupalWebTestCase {
$invalid_recipients = array('invalid', 'invalid@', 'invalid@site.', '@site.', '@site.com');
foreach ($invalid_recipients as $invalid_recipient) {
$this->addCategory($this->randomName(16), $invalid_recipient, '', FALSE);
- $this->assertRaw(t('%recipient is an invalid e-mail address.', array('%recipient' => $invalid_recipient)), 'Caught invalid recipient (' . $invalid_recipient . ').');
+ $this->assertRaw(t('%recipient is an invalid e-mail address.', array('%recipient' => $invalid_recipient)), t('Caught invalid recipient (' . $invalid_recipient . ').'));
}
// Test validation of empty category and recipients fields.
$this->addCategory($category = '', '', '', TRUE);
- $this->assertText(t('Category field is required.'), 'Caught empty category field');
- $this->assertText(t('Recipients field is required.'), 'Caught empty recipients field.');
+ $this->assertText(t('Category field is required.'), t('Caught empty category field'));
+ $this->assertText(t('Recipients field is required.'), t('Caught empty recipients field.'));
// Create first valid category.
$recipients = array('simpletest@example.com', 'simpletest2@example.com', 'simpletest3@example.com');
$this->addCategory($category = $this->randomName(16), implode(',', array($recipients[0])), '', TRUE);
- $this->assertRaw(t('Category %category has been saved.', array('%category' => $category)), 'Category successfully saved.');
+ $this->assertRaw(t('Category %category has been saved.', array('%category' => $category)), t('Category successfully saved.'));
// Make sure the newly created category is included in the list of categories.
- $this->assertNoUniqueText($category, 'New category included in categories list.');
+ $this->assertNoUniqueText($category, t('New category included in categories list.'));
// Test update contact form category.
$categories = $this->getCategories();
@@ -77,80 +77,80 @@ class ContactSitewideTestCase extends DrupalWebTestCase {
$this->assertEqual($category_array['recipients'], $recipients_str);
$this->assertEqual($category_array['reply'], $reply);
$this->assertFalse($category_array['selected']);
- $this->assertRaw(t('Category %category has been saved.', array('%category' => $category)), 'Category successfully saved.');
+ $this->assertRaw(t('Category %category has been saved.', array('%category' => $category)), t('Category successfully saved.'));
// Ensure that the contact form is shown without a category selection input.
user_role_grant_permissions(DRUPAL_ANONYMOUS_RID, array('access site-wide contact form'));
$this->drupalLogout();
$this->drupalGet('contact');
- $this->assertText(t('Your e-mail address'), 'Contact form is shown when there is one category.');
- $this->assertNoText(t('Category'), 'When there is only one category, the category selection element is hidden.');
+ $this->assertText(t('Your e-mail address'), t('Contact form is shown when there is one category.'));
+ $this->assertNoText(t('Category'), t('When there is only one category, the category selection element is hidden.'));
$this->drupalLogin($admin_user);
// Add more categories.
$this->addCategory($category = $this->randomName(16), implode(',', array($recipients[0], $recipients[1])), '', FALSE);
- $this->assertRaw(t('Category %category has been saved.', array('%category' => $category)), 'Category successfully saved.');
+ $this->assertRaw(t('Category %category has been saved.', array('%category' => $category)), t('Category successfully saved.'));
$this->addCategory($category = $this->randomName(16), implode(',', array($recipients[0], $recipients[1], $recipients[2])), '', FALSE);
- $this->assertRaw(t('Category %category has been saved.', array('%category' => $category)), 'Category successfully saved.');
+ $this->assertRaw(t('Category %category has been saved.', array('%category' => $category)), t('Category successfully saved.'));
// Try adding a category that already exists.
$this->addCategory($category, '', '', FALSE);
- $this->assertNoRaw(t('Category %category has been saved.', array('%category' => $category)), 'Category not saved.');
- $this->assertRaw(t('A contact form with category %category already exists.', array('%category' => $category)), 'Duplicate category error found.');
+ $this->assertNoRaw(t('Category %category has been saved.', array('%category' => $category)), t('Category not saved.'));
+ $this->assertRaw(t('A contact form with category %category already exists.', array('%category' => $category)), t('Duplicate category error found.'));
// Clear flood table in preparation for flood test and allow other checks to complete.
db_delete('flood')->execute();
$num_records_after = db_query("SELECT COUNT(*) FROM {flood}")->fetchField();
- $this->assertIdentical($num_records_after, '0', 'Flood table emptied.');
+ $this->assertIdentical($num_records_after, '0', t('Flood table emptied.'));
$this->drupalLogout();
// Check to see that anonymous user cannot see contact page without permission.
user_role_revoke_permissions(DRUPAL_ANONYMOUS_RID, array('access site-wide contact form'));
$this->drupalGet('contact');
- $this->assertResponse(403, 'Access denied to anonymous user without permission.');
+ $this->assertResponse(403, t('Access denied to anonymous user without permission.'));
// Give anonymous user permission and see that page is viewable.
user_role_grant_permissions(DRUPAL_ANONYMOUS_RID, array('access site-wide contact form'));
$this->drupalGet('contact');
- $this->assertResponse(200, 'Access granted to anonymous user with permission.');
+ $this->assertResponse(200, t('Access granted to anonymous user with permission.'));
// Submit contact form with invalid values.
$this->submitContact('', $recipients[0], $this->randomName(16), $categories[0], $this->randomName(64));
- $this->assertText(t('Your name field is required.'), 'Name required.');
+ $this->assertText(t('Your name field is required.'), t('Name required.'));
$this->submitContact($this->randomName(16), '', $this->randomName(16), $categories[0], $this->randomName(64));
- $this->assertText(t('Your e-mail address field is required.'), 'E-mail required.');
+ $this->assertText(t('Your e-mail address field is required.'), t('E-mail required.'));
$this->submitContact($this->randomName(16), $invalid_recipients[0], $this->randomName(16), $categories[0], $this->randomName(64));
- $this->assertText(t('You must enter a valid e-mail address.'), 'Valid e-mail required.');
+ $this->assertText(t('You must enter a valid e-mail address.'), t('Valid e-mail required.'));
$this->submitContact($this->randomName(16), $recipients[0], '', $categories[0], $this->randomName(64));
- $this->assertText(t('Subject field is required.'), 'Subject required.');
+ $this->assertText(t('Subject field is required.'), t('Subject required.'));
$this->submitContact($this->randomName(16), $recipients[0], $this->randomName(16), $categories[0], '');
- $this->assertText(t('Message field is required.'), 'Message required.');
+ $this->assertText(t('Message field is required.'), t('Message required.'));
// Test contact form with no default category selected.
db_update('contact')
->fields(array('selected' => 0))
->execute();
$this->drupalGet('contact');
- $this->assertRaw(t('- Please choose -'), 'Without selected categories the visitor is asked to chose a category.');
+ $this->assertRaw(t('- Please choose -'), t('Without selected categories the visitor is asked to chose a category.'));
// Submit contact form with invalid category id (cid 0).
$this->submitContact($this->randomName(16), $recipients[0], $this->randomName(16), 0, '');
- $this->assertText(t('You must select a valid category.'), 'Valid category required.');
+ $this->assertText(t('You must select a valid category.'), t('Valid category required.'));
// Submit contact form with correct values and check flood interval.
for ($i = 0; $i < $flood_limit; $i++) {
$this->submitContact($this->randomName(16), $recipients[0], $this->randomName(16), $categories[0], $this->randomName(64));
- $this->assertText(t('Your message has been sent.'), 'Message sent.');
+ $this->assertText(t('Your message has been sent.'), t('Message sent.'));
}
// Submit contact form one over limit.
$this->drupalGet('contact');
- $this->assertResponse(403, 'Access denied to anonymous user after reaching message treshold.');
- $this->assertRaw(t('You cannot send more than %number messages in @interval. Try again later.', array('%number' => variable_get('contact_threshold_limit', 3), '@interval' => format_interval(600))), 'Message threshold reached.');
+ $this->assertResponse(403, t('Access denied to anonymous user after reaching message treshold.'));
+ $this->assertRaw(t('You cannot send more than %number messages in @interval. Try again later.', array('%number' => variable_get('contact_threshold_limit', 3), '@interval' => format_interval(600))), t('Message threshold reached.'));
// Delete created categories.
$this->drupalLogin($admin_user);
@@ -158,8 +158,8 @@ class ContactSitewideTestCase extends DrupalWebTestCase {
}
/**
- * Test auto-reply on the site-wide contact form.
- */
+ * Test auto-reply on the site-wide contact form.
+ */
function testAutoReply() {
// Create and login administrative user.
$admin_user = $this->drupalCreateUser(array('access site-wide contact form', 'administer contact forms', 'administer permissions', 'administer users'));
@@ -179,8 +179,8 @@ class ContactSitewideTestCase extends DrupalWebTestCase {
// We are testing the auto-reply, so there should be one e-mail going to the sender.
$captured_emails = $this->drupalGetMails(array('id' => 'contact_page_autoreply', 'to' => $email, 'from' => 'foo@example.com'));
- $this->assertEqual(count($captured_emails), 1, 'Auto-reply e-mail was sent to the sender for category "foo".', 'Contact');
- $this->assertEqual($captured_emails[0]['body'], drupal_html_to_text($foo_autoreply), 'Auto-reply e-mail body is correct for category "foo".', 'Contact');
+ $this->assertEqual(count($captured_emails), 1, t('Auto-reply e-mail was sent to the sender for category "foo".'), t('Contact'));
+ $this->assertEqual($captured_emails[0]['body'], drupal_html_to_text($foo_autoreply), t('Auto-reply e-mail body is correct for category "foo".'), t('Contact'));
// Test the auto-reply for category 'bar'.
$email = $this->randomName(32) . '@example.com';
@@ -188,14 +188,14 @@ class ContactSitewideTestCase extends DrupalWebTestCase {
// Auto-reply for category 'bar' should result in one auto-reply e-mail to the sender.
$captured_emails = $this->drupalGetMails(array('id' => 'contact_page_autoreply', 'to' => $email, 'from' => 'bar@example.com'));
- $this->assertEqual(count($captured_emails), 1, 'Auto-reply e-mail was sent to the sender for category "bar".', 'Contact');
- $this->assertEqual($captured_emails[0]['body'], drupal_html_to_text($bar_autoreply), 'Auto-reply e-mail body is correct for category "bar".', 'Contact');
+ $this->assertEqual(count($captured_emails), 1, t('Auto-reply e-mail was sent to the sender for category "bar".'), t('Contact'));
+ $this->assertEqual($captured_emails[0]['body'], drupal_html_to_text($bar_autoreply), t('Auto-reply e-mail body is correct for category "bar".'), t('Contact'));
// Verify that no auto-reply is sent when the auto-reply field is left blank.
$email = $this->randomName(32) . '@example.com';
$this->submitContact($this->randomName(16), $email, $this->randomString(64), 4, $this->randomString(128));
$captured_emails = $this->drupalGetMails(array('id' => 'contact_page_autoreply', 'to' => $email, 'from' => 'no_autoreply@example.com'));
- $this->assertEqual(count($captured_emails), 0, 'No auto-reply e-mail was sent to the sender for category "no-autoreply".', 'Contact');
+ $this->assertEqual(count($captured_emails), 0, t('No auto-reply e-mail was sent to the sender for category "no-autoreply".'), t('Contact'));
}
/**
@@ -261,7 +261,7 @@ class ContactSitewideTestCase extends DrupalWebTestCase {
foreach ($categories as $category) {
$category_name = db_query("SELECT category FROM {contact} WHERE cid = :cid", array(':cid' => $category))->fetchField();
$this->drupalPost('admin/structure/contact/delete/' . $category, array(), t('Delete'));
- $this->assertRaw(t('Category %category has been deleted.', array('%category' => $category_name)), 'Category deleted sucessfully.');
+ $this->assertRaw(t('Category %category has been deleted.', array('%category' => $category_name)), t('Category deleted sucessfully.'));
}
}
@@ -336,7 +336,7 @@ class ContactPersonalTestCase extends DrupalWebTestCase {
$this->drupalLogin($this->admin_user);
$edit = array('contact_default_status' => FALSE);
$this->drupalPost('admin/config/people/accounts', $edit, t('Save configuration'));
- $this->assertText(t('The configuration options have been saved.'), 'Setting successfully saved.');
+ $this->assertText(t('The configuration options have been saved.'), t('Setting successfully saved.'));
$this->drupalLogout();
// Re-create our contacted user with personal contact forms disabled by
@@ -388,7 +388,7 @@ class ContactPersonalTestCase extends DrupalWebTestCase {
}
// Submit contact form one over limit.
- $this->drupalGet('user/' . $this->contact_user->uid . '/contact');
+ $this->drupalGet('user/' . $this->contact_user->uid. '/contact');
$this->assertRaw(t('You cannot send more than %number messages in @interval. Try again later.', array('%number' => $flood_limit, '@interval' => format_interval(variable_get('contact_threshold_window', 3600)))), 'Normal user denied access to flooded contact form.');
// Test that the admin user can still access the contact form even though
diff --git a/modules/dashboard/dashboard.test b/modules/dashboard/dashboard.test
index 3b6961485..6d9a21e4f 100644
--- a/modules/dashboard/dashboard.test
+++ b/modules/dashboard/dashboard.test
@@ -47,14 +47,14 @@ class DashboardAccessTestCase extends DrupalWebTestCase {
// Ensure admin access.
$this->drupalGet('admin');
- $this->assertResponse(200, 'Admin has access to the dashboard.');
- $this->assertRaw($custom_block['title'], 'Admin has access to a dashboard block.');
+ $this->assertResponse(200, t('Admin has access to the dashboard.'));
+ $this->assertRaw($custom_block['title'], t('Admin has access to a dashboard block.'));
// Ensure non-admin access is denied.
$normal_user = $this->drupalCreateUser();
$this->drupalLogin($normal_user);
$this->drupalGet('admin');
- $this->assertResponse(403, 'Non-admin has no access to the dashboard.');
- $this->assertNoText($custom_block['title'], 'Non-admin has no access to a dashboard block.');
+ $this->assertResponse(403, t('Non-admin has no access to the dashboard.'));
+ $this->assertNoText($custom_block['title'], t('Non-admin has no access to a dashboard block.'));
}
}
diff --git a/modules/dblog/dblog.test b/modules/dblog/dblog.test
index c26c6324e..92f0dd4d3 100644
--- a/modules/dblog/dblog.test
+++ b/modules/dblog/dblog.test
@@ -55,10 +55,10 @@ class DBLogTestCase extends DrupalWebTestCase {
// Check row limit variable.
$current_limit = variable_get('dblog_row_limit', 1000);
- $this->assertTrue($current_limit == $row_limit, '[Cache] Row limit variable of ' . $current_limit . ' equals row limit of ' . $row_limit);
+ $this->assertTrue($current_limit == $row_limit, t('[Cache] Row limit variable of @count equals row limit of @limit', array('@count' => $current_limit, '@limit' => $row_limit)));
// Verify dblog row limit equals specified row limit.
$current_limit = unserialize(db_query("SELECT value FROM {variable} WHERE name = :dblog_limit", array(':dblog_limit' => 'dblog_row_limit'))->fetchField());
- $this->assertTrue($current_limit == $row_limit, '[Variable table] Row limit variable of ' . $current_limit . ' equals row limit of ' . $row_limit);
+ $this->assertTrue($current_limit == $row_limit, t('[Variable table] Row limit variable of @count equals row limit of @limit', array('@count' => $current_limit, '@limit' => $row_limit)));
}
/**
@@ -71,13 +71,13 @@ class DBLogTestCase extends DrupalWebTestCase {
$this->generateLogEntries($row_limit + 10);
// Verify dblog row count exceeds row limit.
$count = db_query('SELECT COUNT(wid) FROM {watchdog}')->fetchField();
- $this->assertTrue($count > $row_limit, 'Dblog row count of ' . $count . ' exceeds row limit of ' . $row_limit);
+ $this->assertTrue($count > $row_limit, t('Dblog row count of @count exceeds row limit of @limit', array('@count' => $count, '@limit' => $row_limit)));
// Run cron job.
$this->cronRun();
// Verify dblog row count equals row limit plus one because cron adds a record after it runs.
$count = db_query('SELECT COUNT(wid) FROM {watchdog}')->fetchField();
- $this->assertTrue($count == $row_limit + 1, 'Dblog row count of ' . $count . ' equals row limit of ' . $row_limit . ' plus one');
+ $this->assertTrue($count == $row_limit + 1, t('Dblog row count of @count equals row limit of @limit plus one', array('@count' => $count, '@limit' => $row_limit)));
}
/**
@@ -125,35 +125,35 @@ class DBLogTestCase extends DrupalWebTestCase {
$this->drupalGet('admin/help/dblog');
$this->assertResponse($response);
if ($response == 200) {
- $this->assertText(t('Database logging'), 'DBLog help was displayed');
+ $this->assertText(t('Database logging'), t('DBLog help was displayed'));
}
// View dblog report node.
$this->drupalGet('admin/reports/dblog');
$this->assertResponse($response);
if ($response == 200) {
- $this->assertText(t('Recent log entries'), 'DBLog report was displayed');
+ $this->assertText(t('Recent log entries'), t('DBLog report was displayed'));
}
// View dblog page-not-found report node.
$this->drupalGet('admin/reports/page-not-found');
$this->assertResponse($response);
if ($response == 200) {
- $this->assertText(t('Top ' . $quote . 'page not found' . $quote . ' errors'), 'DBLog page-not-found report was displayed');
+ $this->assertText(t('Top ' . $quote . 'page not found' . $quote . ' errors'), t('DBLog page-not-found report was displayed'));
}
// View dblog access-denied report node.
$this->drupalGet('admin/reports/access-denied');
$this->assertResponse($response);
if ($response == 200) {
- $this->assertText(t('Top ' . $quote . 'access denied' . $quote . ' errors'), 'DBLog access-denied report was displayed');
+ $this->assertText(t('Top ' . $quote . 'access denied' . $quote . ' errors'), t('DBLog access-denied report was displayed'));
}
// View dblog event node.
$this->drupalGet('admin/reports/event/1');
$this->assertResponse($response);
if ($response == 200) {
- $this->assertText(t('Details'), 'DBLog event node was displayed');
+ $this->assertText(t('Details'), t('DBLog event node was displayed'));
}
}
@@ -192,7 +192,7 @@ class DBLogTestCase extends DrupalWebTestCase {
$this->assertResponse(200);
// Retrieve user object.
$user = user_load_by_name($name);
- $this->assertTrue($user != NULL, 'User ' . $name . ' was loaded');
+ $this->assertTrue($user != NULL, t('User @name was loaded', array('@name' => $name)));
$user->pass_raw = $pass; // Needed by drupalLogin.
// Login user.
$this->drupalLogin($user);
@@ -204,7 +204,7 @@ class DBLogTestCase extends DrupalWebTestCase {
$ids[] = $row->wid;
}
$count_before = (isset($ids)) ? count($ids) : 0;
- $this->assertTrue($count_before > 0, 'DBLog contains ' . $count_before . ' records for ' . $user->name);
+ $this->assertTrue($count_before > 0, t('DBLog contains @count records for @name', array('@count' => $count_before, '@name' => $user->name)));
// Login the admin user.
$this->drupalLogin($this->big_user);
@@ -238,12 +238,12 @@ class DBLogTestCase extends DrupalWebTestCase {
$link = drupal_substr($value, strpos($value, 'admin/reports/event/'));
$this->drupalGet($link);
// Check for full message text on the details page.
- $this->assertRaw($message, 'DBLog event details was found: [delete user]');
+ $this->assertRaw($message, t('DBLog event details was found: [delete user]'));
break;
}
}
}
- $this->assertTrue($link, 'DBLog event was recorded: [delete user]');
+ $this->assertTrue($link, t('DBLog event was recorded: [delete user]'));
// Visit random URL (to generate page not found event).
$not_found_url = $this->randomName(60);
$this->drupalGet($not_found_url);
@@ -252,7 +252,7 @@ class DBLogTestCase extends DrupalWebTestCase {
$this->drupalGet('admin/reports/page-not-found');
$this->assertResponse(200);
// Check that full-length url displayed.
- $this->assertText($not_found_url, 'DBLog event was recorded: [page not found]');
+ $this->assertText($not_found_url, t('DBLog event was recorded: [page not found]'));
}
/**
@@ -275,7 +275,7 @@ class DBLogTestCase extends DrupalWebTestCase {
$this->assertResponse(200);
// Retrieve node object.
$node = $this->drupalGetNodeByTitle($title);
- $this->assertTrue($node != NULL, 'Node ' . $title . ' was loaded');
+ $this->assertTrue($node != NULL, t('Node @title was loaded', array('@title' => $title)));
// Edit node.
$edit = $this->getContentUpdate($type);
$this->drupalPost('node/' . $node->nid . '/edit', $edit, t('Save'));
@@ -308,13 +308,13 @@ class DBLogTestCase extends DrupalWebTestCase {
$this->drupalGet('admin/reports/access-denied');
$this->assertResponse(200);
// Access denied.
- $this->assertText(t('admin/reports/dblog'), 'DBLog event was recorded: [access denied]');
+ $this->assertText(t('admin/reports/dblog'), t('DBLog event was recorded: [access denied]'));
// View dblog page-not-found report node.
$this->drupalGet('admin/reports/page-not-found');
$this->assertResponse(200);
// Page not found.
- $this->assertText(t('node/@nid', array('@nid' => $node->nid)), 'DBLog event was recorded: [page not found]');
+ $this->assertText(t('node/@nid', array('@nid' => $node->nid)), t('DBLog event was recorded: [page not found]'));
}
/**
@@ -332,14 +332,14 @@ class DBLogTestCase extends DrupalWebTestCase {
'choice[new:0][chtext]' => $this->randomName(32),
'choice[new:1][chtext]' => $this->randomName(32),
);
- break;
+ break;
default:
$content = array(
"title" => $this->randomName(8),
"body[$langcode][0][value]" => $this->randomName(32),
);
- break;
+ break;
}
return $content;
}
@@ -357,14 +357,14 @@ class DBLogTestCase extends DrupalWebTestCase {
'choice[chid:1][chtext]' => $this->randomName(32),
'choice[chid:2][chtext]' => $this->randomName(32),
);
- break;
+ break;
default:
$langcode = LANGUAGE_NONE;
$content = array(
"body[$langcode][0][value]" => $this->randomName(32),
);
- break;
+ break;
}
return $content;
}
@@ -391,14 +391,14 @@ class DBLogTestCase extends DrupalWebTestCase {
// Add a watchdog entry.
dblog_watchdog($log);
// Make sure the table count has actually incremented.
- $this->assertEqual($count + 1, db_query('SELECT COUNT(*) FROM {watchdog}')->fetchField(), 'dblog_watchdog() added an entry to the dblog ' . $count);
+ $this->assertEqual($count + 1, db_query('SELECT COUNT(*) FROM {watchdog}')->fetchField(), t('dblog_watchdog() added an entry to the dblog :count', array(':count' => $count)));
// Login the admin user.
$this->drupalLogin($this->big_user);
// Now post to clear the db table.
$this->drupalPost('admin/reports/dblog', array(), t('Clear log messages'));
// Count rows in watchdog that previously related to the deleted user.
$count = db_query('SELECT COUNT(*) FROM {watchdog}')->fetchField();
- $this->assertEqual($count, 0, 'DBLog contains ' . $count . ' records after a clear.');
+ $this->assertEqual($count, 0, t('DBLog contains :count records after a clear.', array(':count' => $count)));
}
/**
diff --git a/modules/field/modules/field_sql_storage/field_sql_storage.test b/modules/field/modules/field_sql_storage/field_sql_storage.test
index ac3568403..6af10a0b7 100644
--- a/modules/field/modules/field_sql_storage/field_sql_storage.test
+++ b/modules/field/modules/field_sql_storage/field_sql_storage.test
@@ -41,7 +41,7 @@ class FieldSqlStorageTestCase extends DrupalWebTestCase {
$t1 = _field_sql_storage_etid('t1');
$t2 = _field_sql_storage_etid('t2');
- $this->assertEqual($t1 + 1, $t2, 'Entity type ids are sequential');
+ $this->assertEqual($t1+1, $t2, 'Entity type ids are sequential');
$this->assertIdentical(variable_get('field_sql_storage_t1_etid', NULL), $t1, 'First entity type variable is correct');
$this->assertIdentical(variable_get('field_sql_storage_t2_etid', NULL), $t2, 'Second entity type variable is correct');
$this->assertEqual(db_query("SELECT etid FROM {field_config_entity_type} WHERE type='t1'")->fetchField(), $t1, 'First entity type in database is correct');
@@ -141,7 +141,7 @@ class FieldSqlStorageTestCase extends DrupalWebTestCase {
$rows = db_select($this->table, 't')->fields('t')->execute()->fetchAllAssoc('delta', PDO::FETCH_ASSOC);
foreach ($values as $delta => $value) {
if ($delta < $this->field['cardinality']) {
- $this->assertEqual($rows[$delta][$this->field_name . '_value'], $value['value'], "Value $delta is inserted correctly");
+ $this->assertEqual($rows[$delta][$this->field_name . '_value'], $value['value'], t("Value $delta is inserted correctly"));
}
else {
$this->assertFalse(array_key_exists($delta, $rows), "No extraneous value gets inserted.");
@@ -160,7 +160,7 @@ class FieldSqlStorageTestCase extends DrupalWebTestCase {
$rows = db_select($this->table, 't')->fields('t')->execute()->fetchAllAssoc('delta', PDO::FETCH_ASSOC);
foreach ($values as $delta => $value) {
if ($delta < $this->field['cardinality']) {
- $this->assertEqual($rows[$delta][$this->field_name . '_value'], $value['value'], "Value $delta is updated correctly");
+ $this->assertEqual($rows[$delta][$this->field_name . '_value'], $value['value'], t("Value $delta is updated correctly"));
}
else {
$this->assertFalse(array_key_exists($delta, $rows), "No extraneous value gets updated.");
@@ -190,7 +190,7 @@ class FieldSqlStorageTestCase extends DrupalWebTestCase {
$rows = db_select($this->table, 't')->fields('t')->execute()->fetchAllAssoc('delta', PDO::FETCH_ASSOC);
foreach ($values as $delta => $value) {
if ($delta < $this->field['cardinality']) {
- $this->assertEqual($rows[$delta][$this->field_name . '_value'], $value['value'], "Update with no field_name entry leaves value $delta untouched");
+ $this->assertEqual($rows[$delta][$this->field_name . '_value'], $value['value'], t("Update with no field_name entry leaves value $delta untouched"));
}
}
@@ -198,7 +198,7 @@ class FieldSqlStorageTestCase extends DrupalWebTestCase {
$entity->{$this->field_name} = NULL;
field_attach_update($entity_type, $entity);
$rows = db_select($this->table, 't')->fields('t')->execute()->fetchAllAssoc('delta', PDO::FETCH_ASSOC);
- $this->assertEqual(count($rows), 0, "Update with an empty field_name entry empties the field.");
+ $this->assertEqual(count($rows), 0, t("Update with an empty field_name entry empties the field."));
}
/**
@@ -313,10 +313,10 @@ class FieldSqlStorageTestCase extends DrupalWebTestCase {
$field['settings']['scale'] = 3;
try {
field_update_field($field);
- $this->fail('Cannot update field schema with data.');
+ $this->fail(t('Cannot update field schema with data.'));
}
catch (FieldException $e) {
- $this->pass('Cannot update field schema with data.');
+ $this->pass(t('Cannot update field schema with data.'));
}
}
@@ -335,8 +335,8 @@ class FieldSqlStorageTestCase extends DrupalWebTestCase {
// Verify the indexes we will create do not exist yet.
foreach ($tables as $table) {
- $this->assertFalse(Database::getConnection()->schema()->indexExists($table, 'value'), "No index named value exists in $table");
- $this->assertFalse(Database::getConnection()->schema()->indexExists($table, 'value_format'), "No index named value_format exists in $table");
+ $this->assertFalse(Database::getConnection()->schema()->indexExists($table, 'value'), t("No index named value exists in $table"));
+ $this->assertFalse(Database::getConnection()->schema()->indexExists($table, 'value_format'), t("No index named value_format exists in $table"));
}
// Add data so the table cannot be dropped.
@@ -348,21 +348,21 @@ class FieldSqlStorageTestCase extends DrupalWebTestCase {
$field = array('field_name' => $field_name, 'indexes' => array('value' => array('value')));
field_update_field($field);
foreach ($tables as $table) {
- $this->assertTrue(Database::getConnection()->schema()->indexExists($table, "{$field_name}_value"), "Index on value created in $table");
+ $this->assertTrue(Database::getConnection()->schema()->indexExists($table, "{$field_name}_value"), t("Index on value created in $table"));
}
// Add a different index, removing the existing custom one.
$field = array('field_name' => $field_name, 'indexes' => array('value_format' => array('value', 'format')));
field_update_field($field);
foreach ($tables as $table) {
- $this->assertTrue(Database::getConnection()->schema()->indexExists($table, "{$field_name}_value_format"), "Index on value_format created in $table");
- $this->assertFalse(Database::getConnection()->schema()->indexExists($table, "{$field_name}_value"), "Index on value removed in $table");
+ $this->assertTrue(Database::getConnection()->schema()->indexExists($table, "{$field_name}_value_format"), t("Index on value_format created in $table"));
+ $this->assertFalse(Database::getConnection()->schema()->indexExists($table, "{$field_name}_value"), t("Index on value removed in $table"));
}
// Verify that the tables were not dropped.
$entity = field_test_create_stub_entity(0, 0, $instance['bundle']);
field_attach_load('test_entity', array(0 => $entity));
- $this->assertEqual($entity->{$field_name}[LANGUAGE_NONE][0]['value'], 'field data', "Index changes performed without dropping the tables");
+ $this->assertEqual($entity->{$field_name}[LANGUAGE_NONE][0]['value'], 'field data', t("Index changes performed without dropping the tables"));
}
/**
@@ -377,19 +377,19 @@ class FieldSqlStorageTestCase extends DrupalWebTestCase {
$instance = field_info_instance($this->instance['entity_type'], $this->instance['field_name'], $this->instance['bundle']);
// The storage details are indexed by a storage engine type.
- $this->assertTrue(array_key_exists('sql', $field['storage']['details']), 'The storage type is SQL.');
+ $this->assertTrue(array_key_exists('sql', $field['storage']['details']), t('The storage type is SQL.'));
// The SQL details are indexed by table name.
$details = $field['storage']['details']['sql'];
- $this->assertTrue(array_key_exists($current, $details[FIELD_LOAD_CURRENT]), 'Table name is available in the instance array.');
- $this->assertTrue(array_key_exists($revision, $details[FIELD_LOAD_REVISION]), 'Revision table name is available in the instance array.');
+ $this->assertTrue(array_key_exists($current, $details[FIELD_LOAD_CURRENT]), t('Table name is available in the instance array.'));
+ $this->assertTrue(array_key_exists($revision, $details[FIELD_LOAD_REVISION]), t('Revision table name is available in the instance array.'));
// Test current and revision storage details together because the columns
// are the same.
foreach ((array) $this->field['columns'] as $column_name => $attributes) {
$storage_column_name = _field_sql_storage_columnname($this->field['field_name'], $column_name);
- $this->assertEqual($details[FIELD_LOAD_CURRENT][$current][$column_name], $storage_column_name, 'Column name ' . $column_name . ' matches the definition in ' . $current . '.');
- $this->assertEqual($details[FIELD_LOAD_REVISION][$revision][$column_name], $storage_column_name, 'Column name ' . $column_name . ' matches the definition in ' . $revision . '.');
+ $this->assertEqual($details[FIELD_LOAD_CURRENT][$current][$column_name], $storage_column_name, t('Column name %value matches the definition in %bin.', array('%value' => $column_name, '%bin' => $current)));
+ $this->assertEqual($details[FIELD_LOAD_REVISION][$revision][$column_name], $storage_column_name, t('Column name %value matches the definition in %bin.', array('%value' => $column_name, '%bin' => $revision)));
}
}
}
diff --git a/modules/field/modules/list/tests/list.test b/modules/field/modules/list/tests/list.test
index 2491e93d4..13d20059e 100644
--- a/modules/field/modules/list/tests/list.test
+++ b/modules/field/modules/list/tests/list.test
@@ -52,28 +52,28 @@ class ListFieldTestCase extends FieldTestCase {
// All three options appear.
$entity = field_test_create_stub_entity();
$form = drupal_get_form('field_test_entity_form', $entity);
- $this->assertTrue(!empty($form[$this->field_name][$langcode][1]), 'Option 1 exists');
- $this->assertTrue(!empty($form[$this->field_name][$langcode][2]), 'Option 2 exists');
- $this->assertTrue(!empty($form[$this->field_name][$langcode][3]), 'Option 3 exists');
+ $this->assertTrue(!empty($form[$this->field_name][$langcode][1]), t('Option 1 exists'));
+ $this->assertTrue(!empty($form[$this->field_name][$langcode][2]), t('Option 2 exists'));
+ $this->assertTrue(!empty($form[$this->field_name][$langcode][3]), t('Option 3 exists'));
// Removed options do not appear.
$this->field['settings']['allowed_values'] = "2|Two";
field_update_field($this->field);
$entity = field_test_create_stub_entity();
$form = drupal_get_form('field_test_entity_form', $entity);
- $this->assertTrue(empty($form[$this->field_name][$langcode][1]), 'Option 1 does not exist');
- $this->assertTrue(!empty($form[$this->field_name][$langcode][2]), 'Option 2 exists');
- $this->assertTrue(empty($form[$this->field_name][$langcode][3]), 'Option 3 does not exist');
+ $this->assertTrue(empty($form[$this->field_name][$langcode][1]), t('Option 1 does not exist'));
+ $this->assertTrue(!empty($form[$this->field_name][$langcode][2]), t('Option 2 exists'));
+ $this->assertTrue(empty($form[$this->field_name][$langcode][3]), t('Option 3 does not exist'));
// Completely new options appear.
$this->field['settings']['allowed_values'] = "10|Update\n20|Twenty";
field_update_field($this->field);
$form = drupal_get_form('field_test_entity_form', $entity);
- $this->assertTrue(empty($form[$this->field_name][$langcode][1]), 'Option 1 does not exist');
- $this->assertTrue(empty($form[$this->field_name][$langcode][2]), 'Option 2 does not exist');
- $this->assertTrue(empty($form[$this->field_name][$langcode][3]), 'Option 3 does not exist');
- $this->assertTrue(!empty($form[$this->field_name][$langcode][10]), 'Option 10 exists');
- $this->assertTrue(!empty($form[$this->field_name][$langcode][20]), 'Option 20 exists');
+ $this->assertTrue(empty($form[$this->field_name][$langcode][1]), t('Option 1 does not exist'));
+ $this->assertTrue(empty($form[$this->field_name][$langcode][2]), t('Option 2 does not exist'));
+ $this->assertTrue(empty($form[$this->field_name][$langcode][3]), t('Option 3 does not exist'));
+ $this->assertTrue(!empty($form[$this->field_name][$langcode][10]), t('Option 10 exists'));
+ $this->assertTrue(!empty($form[$this->field_name][$langcode][20]), t('Option 20 exists'));
// Options are reset when a new field with the same name is created.
field_delete_field($this->field_name);
@@ -91,15 +91,15 @@ class ListFieldTestCase extends FieldTestCase {
$this->instance = field_create_instance($this->instance);
$entity = field_test_create_stub_entity();
$form = drupal_get_form('field_test_entity_form', $entity);
- $this->assertTrue(!empty($form[$this->field_name][$langcode][1]), 'Option 1 exists');
- $this->assertTrue(!empty($form[$this->field_name][$langcode][2]), 'Option 2 exists');
- $this->assertTrue(!empty($form[$this->field_name][$langcode][3]), 'Option 3 exists');
+ $this->assertTrue(!empty($form[$this->field_name][$langcode][1]), t('Option 1 exists'));
+ $this->assertTrue(!empty($form[$this->field_name][$langcode][2]), t('Option 2 exists'));
+ $this->assertTrue(!empty($form[$this->field_name][$langcode][3]), t('Option 3 exists'));
}
}
/**
- * List module UI tests.
- */
+* List module UI tests.
+*/
class ListFieldUITestCase extends FieldTestCase {
public static function getInfo() {
return array(
@@ -139,21 +139,21 @@ class ListFieldUITestCase extends FieldTestCase {
//Check that non-integer keys are rejected.
$edit = array($element_name => "1.1|one\n");
$this->drupalPost($admin_path, $edit, t('Save settings'));
- $this->assertText("keys must be integers", 'Form validation failed.');
+ $this->assertText("keys must be integers", t('Form validation failed.'));
// Test 'List (number)' field type.
$admin_path = $this->createListFieldAndEdit('list_number');
//Check that non-numeric keys are rejected.
$edit = array($element_name => "1|one\nB|two");
$this->drupalPost($admin_path, $edit, t('Save settings'));
- $this->assertText("each key must be a valid integer or decimal", 'Form validation failed.');
+ $this->assertText("each key must be a valid integer or decimal", t('Form validation failed.'));
//Test 'List (text)' field type.
$admin_path = $this->createListFieldAndEdit('list_text');
//Check that over long keys are rejected.
$edit = array($element_name => "1|one\n" . $this->randomName(256) . "|two");
$this->drupalPost($admin_path, $edit, t('Save settings'));
- $this->assertText("each key must be a string at most 255 characters long", 'Form validation failed.');
+ $this->assertText("each key must be a string at most 255 characters long", t('Form validation failed.'));
}
/**
diff --git a/modules/field/modules/options/options.test b/modules/field/modules/options/options.test
index a593d023b..8cbfd5bc7 100644
--- a/modules/field/modules/options/options.test
+++ b/modules/field/modules/options/options.test
@@ -77,11 +77,11 @@ class OptionsWidgetsTestCase extends FieldTestCase {
field_test_entity_save($entity);
// With no field data, no buttons are checked.
- $this->drupalGet('test-entity/' . $entity->ftid . '/edit');
+ $this->drupalGet('test-entity/' . $entity->ftid .'/edit');
$this->assertNoFieldChecked("edit-card-1-$langcode-0");
$this->assertNoFieldChecked("edit-card-1-$langcode-1");
$this->assertNoFieldChecked("edit-card-1-$langcode-2");
- $this->assertRaw('Some dangerous &amp; unescaped <strong>markup</strong>', 'Option text was properly filtered.');
+ $this->assertRaw('Some dangerous &amp; unescaped <strong>markup</strong>', t('Option text was properly filtered.'));
// Select first option.
$edit = array("card_1[$langcode]" => 0);
@@ -89,7 +89,7 @@ class OptionsWidgetsTestCase extends FieldTestCase {
$this->assertFieldValues($entity_init, 'card_1', $langcode, array(0));
// Check that the selected button is checked.
- $this->drupalGet('test-entity/' . $entity->ftid . '/edit');
+ $this->drupalGet('test-entity/' . $entity->ftid .'/edit');
$this->assertFieldChecked("edit-card-1-$langcode-0");
$this->assertNoFieldChecked("edit-card-1-$langcode-1");
$this->assertNoFieldChecked("edit-card-1-$langcode-2");
@@ -104,7 +104,7 @@ class OptionsWidgetsTestCase extends FieldTestCase {
field_update_field($this->card_1);
$instance['required'] = TRUE;
field_update_instance($instance);
- $this->drupalGet('test-entity/' . $entity->ftid . '/edit');
+ $this->drupalGet('test-entity/' . $entity->ftid .'/edit');
$this->assertFieldChecked("edit-card-1-$langcode-99");
}
@@ -134,11 +134,11 @@ class OptionsWidgetsTestCase extends FieldTestCase {
field_test_entity_save($entity);
// Display form: with no field data, nothing is checked.
- $this->drupalGet('test-entity/' . $entity->ftid . '/edit');
+ $this->drupalGet('test-entity/' . $entity->ftid .'/edit');
$this->assertNoFieldChecked("edit-card-2-$langcode-0");
$this->assertNoFieldChecked("edit-card-2-$langcode-1");
$this->assertNoFieldChecked("edit-card-2-$langcode-2");
- $this->assertRaw('Some dangerous &amp; unescaped <strong>markup</strong>', 'Option text was properly filtered.');
+ $this->assertRaw('Some dangerous &amp; unescaped <strong>markup</strong>', t('Option text was properly filtered.'));
// Submit form: select first and third options.
$edit = array(
@@ -150,7 +150,7 @@ class OptionsWidgetsTestCase extends FieldTestCase {
$this->assertFieldValues($entity_init, 'card_2', $langcode, array(0, 2));
// Display form: check that the right options are selected.
- $this->drupalGet('test-entity/' . $entity->ftid . '/edit');
+ $this->drupalGet('test-entity/' . $entity->ftid .'/edit');
$this->assertFieldChecked("edit-card-2-$langcode-0");
$this->assertNoFieldChecked("edit-card-2-$langcode-1");
$this->assertFieldChecked("edit-card-2-$langcode-2");
@@ -165,7 +165,7 @@ class OptionsWidgetsTestCase extends FieldTestCase {
$this->assertFieldValues($entity_init, 'card_2', $langcode, array(0));
// Display form: check that the right options are selected.
- $this->drupalGet('test-entity/' . $entity->ftid . '/edit');
+ $this->drupalGet('test-entity/' . $entity->ftid .'/edit');
$this->assertFieldChecked("edit-card-2-$langcode-0");
$this->assertNoFieldChecked("edit-card-2-$langcode-1");
$this->assertNoFieldChecked("edit-card-2-$langcode-2");
@@ -177,7 +177,7 @@ class OptionsWidgetsTestCase extends FieldTestCase {
"card_2[$langcode][2]" => TRUE,
);
$this->drupalPost(NULL, $edit, t('Save'));
- $this->assertText('this field cannot hold more than 2 values', 'Validation error was displayed.');
+ $this->assertText('this field cannot hold more than 2 values', t('Validation error was displayed.'));
// Submit form: uncheck all options.
$edit = array(
@@ -194,7 +194,7 @@ class OptionsWidgetsTestCase extends FieldTestCase {
field_update_field($this->card_2);
$instance['required'] = TRUE;
field_update_instance($instance);
- $this->drupalGet('test-entity/' . $entity->ftid . '/edit');
+ $this->drupalGet('test-entity/' . $entity->ftid .'/edit');
$this->assertFieldChecked("edit-card-2-$langcode-99");
}
@@ -221,11 +221,11 @@ class OptionsWidgetsTestCase extends FieldTestCase {
field_test_entity_save($entity);
// Display form: with no field data, nothing is selected.
- $this->drupalGet('test-entity/' . $entity->ftid . '/edit');
+ $this->drupalGet('test-entity/' . $entity->ftid .'/edit');
$this->assertNoOptionSelected("edit-card-1-$langcode", 0);
$this->assertNoOptionSelected("edit-card-1-$langcode", 1);
$this->assertNoOptionSelected("edit-card-1-$langcode", 2);
- $this->assertRaw('Some dangerous &amp; unescaped markup', 'Option text was properly filtered.');
+ $this->assertRaw('Some dangerous &amp; unescaped markup', t('Option text was properly filtered.'));
// Submit form: select first option.
$edit = array("card_1[$langcode]" => 0);
@@ -233,21 +233,21 @@ class OptionsWidgetsTestCase extends FieldTestCase {
$this->assertFieldValues($entity_init, 'card_1', $langcode, array(0));
// Display form: check that the right options are selected.
- $this->drupalGet('test-entity/' . $entity->ftid . '/edit');
+ $this->drupalGet('test-entity/' . $entity->ftid .'/edit');
$this->assertOptionSelected("edit-card-1-$langcode", 0);
$this->assertNoOptionSelected("edit-card-1-$langcode", 1);
$this->assertNoOptionSelected("edit-card-1-$langcode", 2);
// Submit form: Unselect the option.
$edit = array("card_1[$langcode]" => '_none');
- $this->drupalPost('test-entity/' . $entity->ftid . '/edit', $edit, t('Save'));
+ $this->drupalPost('test-entity/' . $entity->ftid .'/edit', $edit, t('Save'));
$this->assertFieldValues($entity_init, 'card_1', $langcode, array());
// A required select list does not have an empty key.
$instance['required'] = TRUE;
field_update_instance($instance);
- $this->drupalGet('test-entity/' . $entity->ftid . '/edit');
- $this->assertFalse($this->xpath('//select[@id=:id]//option[@value=""]', array(':id' => 'edit-card-1-' . $langcode)), 'A required select list does not have an empty key.');
+ $this->drupalGet('test-entity/' . $entity->ftid .'/edit');
+ $this->assertFalse($this->xpath('//select[@id=:id]//option[@value=""]', array(':id' => 'edit-card-1-' . $langcode)), t('A required select list does not have an empty key.'));
// We do not have to test that a required select list with one option is
// auto-selected because the browser does it for us.
@@ -261,12 +261,12 @@ class OptionsWidgetsTestCase extends FieldTestCase {
field_update_instance($instance);
// Display form: with no field data, nothing is selected
- $this->drupalGet('test-entity/' . $entity->ftid . '/edit');
+ $this->drupalGet('test-entity/' . $entity->ftid .'/edit');
$this->assertNoOptionSelected("edit-card-1-$langcode", 0);
$this->assertNoOptionSelected("edit-card-1-$langcode", 1);
$this->assertNoOptionSelected("edit-card-1-$langcode", 2);
- $this->assertRaw('Some dangerous &amp; unescaped markup', 'Option text was properly filtered.');
- $this->assertRaw('Group 1', 'Option groups are displayed.');
+ $this->assertRaw('Some dangerous &amp; unescaped markup', t('Option text was properly filtered.'));
+ $this->assertRaw('Group 1', t('Option groups are displayed.'));
// Submit form: select first option.
$edit = array("card_1[$langcode]" => 0);
@@ -274,14 +274,14 @@ class OptionsWidgetsTestCase extends FieldTestCase {
$this->assertFieldValues($entity_init, 'card_1', $langcode, array(0));
// Display form: check that the right options are selected.
- $this->drupalGet('test-entity/' . $entity->ftid . '/edit');
+ $this->drupalGet('test-entity/' . $entity->ftid .'/edit');
$this->assertOptionSelected("edit-card-1-$langcode", 0);
$this->assertNoOptionSelected("edit-card-1-$langcode", 1);
$this->assertNoOptionSelected("edit-card-1-$langcode", 2);
// Submit form: Unselect the option.
$edit = array("card_1[$langcode]" => '_none');
- $this->drupalPost('test-entity/' . $entity->ftid . '/edit', $edit, t('Save'));
+ $this->drupalPost('test-entity/' . $entity->ftid .'/edit', $edit, t('Save'));
$this->assertFieldValues($entity_init, 'card_1', $langcode, array());
}
@@ -308,11 +308,11 @@ class OptionsWidgetsTestCase extends FieldTestCase {
field_test_entity_save($entity);
// Display form: with no field data, nothing is selected.
- $this->drupalGet('test-entity/' . $entity->ftid . '/edit');
+ $this->drupalGet('test-entity/' . $entity->ftid .'/edit');
$this->assertNoOptionSelected("edit-card-2-$langcode", 0);
$this->assertNoOptionSelected("edit-card-2-$langcode", 1);
$this->assertNoOptionSelected("edit-card-2-$langcode", 2);
- $this->assertRaw('Some dangerous &amp; unescaped markup', 'Option text was properly filtered.');
+ $this->assertRaw('Some dangerous &amp; unescaped markup', t('Option text was properly filtered.'));
// Submit form: select first and third options.
$edit = array("card_2[$langcode][]" => array(0 => 0, 2 => 2));
@@ -320,7 +320,7 @@ class OptionsWidgetsTestCase extends FieldTestCase {
$this->assertFieldValues($entity_init, 'card_2', $langcode, array(0, 2));
// Display form: check that the right options are selected.
- $this->drupalGet('test-entity/' . $entity->ftid . '/edit');
+ $this->drupalGet('test-entity/' . $entity->ftid .'/edit');
$this->assertOptionSelected("edit-card-2-$langcode", 0);
$this->assertNoOptionSelected("edit-card-2-$langcode", 1);
$this->assertOptionSelected("edit-card-2-$langcode", 2);
@@ -331,7 +331,7 @@ class OptionsWidgetsTestCase extends FieldTestCase {
$this->assertFieldValues($entity_init, 'card_2', $langcode, array(0));
// Display form: check that the right options are selected.
- $this->drupalGet('test-entity/' . $entity->ftid . '/edit');
+ $this->drupalGet('test-entity/' . $entity->ftid .'/edit');
$this->assertOptionSelected("edit-card-2-$langcode", 0);
$this->assertNoOptionSelected("edit-card-2-$langcode", 1);
$this->assertNoOptionSelected("edit-card-2-$langcode", 2);
@@ -339,7 +339,7 @@ class OptionsWidgetsTestCase extends FieldTestCase {
// Submit form: select the three options while the field accepts only 2.
$edit = array("card_2[$langcode][]" => array(0 => 0, 1 => 1, 2 => 2));
$this->drupalPost(NULL, $edit, t('Save'));
- $this->assertText('this field cannot hold more than 2 values', 'Validation error was displayed.');
+ $this->assertText('this field cannot hold more than 2 values', t('Validation error was displayed.'));
// Submit form: uncheck all options.
$edit = array("card_2[$langcode][]" => array());
@@ -351,19 +351,19 @@ class OptionsWidgetsTestCase extends FieldTestCase {
// Check that the 'none' option has no efect if actual options are selected
// as well.
$edit = array("card_2[$langcode][]" => array('_none' => '_none', 0 => 0));
- $this->drupalPost('test-entity/' . $entity->ftid . '/edit', $edit, t('Save'));
+ $this->drupalPost('test-entity/' . $entity->ftid .'/edit', $edit, t('Save'));
$this->assertFieldValues($entity_init, 'card_2', $langcode, array(0));
// Check that selecting the 'none' option empties the field.
$edit = array("card_2[$langcode][]" => array('_none' => '_none'));
- $this->drupalPost('test-entity/' . $entity->ftid . '/edit', $edit, t('Save'));
+ $this->drupalPost('test-entity/' . $entity->ftid .'/edit', $edit, t('Save'));
$this->assertFieldValues($entity_init, 'card_2', $langcode, array());
// A required select list does not have an empty key.
$instance['required'] = TRUE;
field_update_instance($instance);
- $this->drupalGet('test-entity/' . $entity->ftid . '/edit');
- $this->assertFalse($this->xpath('//select[@id=:id]//option[@value=""]', array(':id' => 'edit-card-2-' . $langcode)), 'A required select list does not have an empty key.');
+ $this->drupalGet('test-entity/' . $entity->ftid .'/edit');
+ $this->assertFalse($this->xpath('//select[@id=:id]//option[@value=""]', array(':id' => 'edit-card-2-' . $langcode)), t('A required select list does not have an empty key.'));
// We do not have to test that a required select list with one option is
// auto-selected because the browser does it for us.
@@ -378,12 +378,12 @@ class OptionsWidgetsTestCase extends FieldTestCase {
field_update_instance($instance);
// Display form: with no field data, nothing is selected.
- $this->drupalGet('test-entity/' . $entity->ftid . '/edit');
+ $this->drupalGet('test-entity/' . $entity->ftid .'/edit');
$this->assertNoOptionSelected("edit-card-2-$langcode", 0);
$this->assertNoOptionSelected("edit-card-2-$langcode", 1);
$this->assertNoOptionSelected("edit-card-2-$langcode", 2);
- $this->assertRaw('Some dangerous &amp; unescaped markup', 'Option text was properly filtered.');
- $this->assertRaw('Group 1', 'Option groups are displayed.');
+ $this->assertRaw('Some dangerous &amp; unescaped markup', t('Option text was properly filtered.'));
+ $this->assertRaw('Group 1', t('Option groups are displayed.'));
// Submit form: select first option.
$edit = array("card_2[$langcode][]" => array(0 => 0));
@@ -391,14 +391,14 @@ class OptionsWidgetsTestCase extends FieldTestCase {
$this->assertFieldValues($entity_init, 'card_2', $langcode, array(0));
// Display form: check that the right options are selected.
- $this->drupalGet('test-entity/' . $entity->ftid . '/edit');
+ $this->drupalGet('test-entity/' . $entity->ftid .'/edit');
$this->assertOptionSelected("edit-card-2-$langcode", 0);
$this->assertNoOptionSelected("edit-card-2-$langcode", 1);
$this->assertNoOptionSelected("edit-card-2-$langcode", 2);
// Submit form: Unselect the option.
$edit = array("card_2[$langcode][]" => array('_none' => '_none'));
- $this->drupalPost('test-entity/' . $entity->ftid . '/edit', $edit, t('Save'));
+ $this->drupalPost('test-entity/' . $entity->ftid .'/edit', $edit, t('Save'));
$this->assertFieldValues($entity_init, 'card_2', $langcode, array());
}
@@ -425,9 +425,9 @@ class OptionsWidgetsTestCase extends FieldTestCase {
field_test_entity_save($entity);
// Display form: with no field data, option is unchecked.
- $this->drupalGet('test-entity/' . $entity->ftid . '/edit');
+ $this->drupalGet('test-entity/' . $entity->ftid .'/edit');
$this->assertNoFieldChecked("edit-bool-$langcode");
- $this->assertRaw('Some dangerous &amp; unescaped <strong>markup</strong>', 'Option text was properly filtered.');
+ $this->assertRaw('Some dangerous &amp; unescaped <strong>markup</strong>', t('Option text was properly filtered.'));
// Submit form: check the option.
$edit = array("bool[$langcode]" => TRUE);
@@ -435,7 +435,7 @@ class OptionsWidgetsTestCase extends FieldTestCase {
$this->assertFieldValues($entity_init, 'bool', $langcode, array(0));
// Display form: check that the right options are selected.
- $this->drupalGet('test-entity/' . $entity->ftid . '/edit');
+ $this->drupalGet('test-entity/' . $entity->ftid .'/edit');
$this->assertFieldChecked("edit-bool-$langcode");
// Submit form: uncheck the option.
@@ -444,7 +444,7 @@ class OptionsWidgetsTestCase extends FieldTestCase {
$this->assertFieldValues($entity_init, 'bool', $langcode, array(1));
// Display form: with 'off' value, option is unchecked.
- $this->drupalGet('test-entity/' . $entity->ftid . '/edit');
+ $this->drupalGet('test-entity/' . $entity->ftid .'/edit');
$this->assertNoFieldChecked("edit-bool-$langcode");
}
}
diff --git a/modules/field/modules/text/text.test b/modules/field/modules/text/text.test
index a4ead6e48..51e2ce44a 100644
--- a/modules/field/modules/text/text.test
+++ b/modules/field/modules/text/text.test
@@ -106,8 +106,8 @@ class TextFieldTestCase extends DrupalWebTestCase {
// Display creation form.
$this->drupalGet('test-entity/add/test-bundle');
- $this->assertFieldByName("{$this->field_name}[$langcode][0][value]", '', 'Widget is displayed');
- $this->assertNoFieldByName("{$this->field_name}[$langcode][0][format]", '1', 'Format selector is not displayed');
+ $this->assertFieldByName("{$this->field_name}[$langcode][0][value]", '', t('Widget is displayed'));
+ $this->assertNoFieldByName("{$this->field_name}[$langcode][0][format]", '1', t('Format selector is not displayed'));
// Submit with some value.
$value = $this->randomName();
@@ -117,7 +117,7 @@ class TextFieldTestCase extends DrupalWebTestCase {
$this->drupalPost(NULL, $edit, t('Save'));
preg_match('|test-entity/(\d+)/edit|', $this->url, $match);
$id = $match[1];
- $this->assertRaw(t('test_entity @id has been created.', array('@id' => $id)), 'Entity was created');
+ $this->assertRaw(t('test_entity @id has been created.', array('@id' => $id)), t('Entity was created'));
// Display the entity.
$entity = field_test_entity_test_load($id);
@@ -175,8 +175,8 @@ class TextFieldTestCase extends DrupalWebTestCase {
// Display the creation form. Since the user only has access to one format,
// no format selector will be displayed.
$this->drupalGet('test-entity/add/test-bundle');
- $this->assertFieldByName("{$this->field_name}[$langcode][0][value]", '', 'Widget is displayed');
- $this->assertNoFieldByName("{$this->field_name}[$langcode][0][format]", '', 'Format selector is not displayed');
+ $this->assertFieldByName("{$this->field_name}[$langcode][0][value]", '', t('Widget is displayed'));
+ $this->assertNoFieldByName("{$this->field_name}[$langcode][0][format]", '', t('Format selector is not displayed'));
// Submit with data that should be filtered.
$value = '<em>' . $this->randomName() . '</em>';
@@ -186,14 +186,14 @@ class TextFieldTestCase extends DrupalWebTestCase {
$this->drupalPost(NULL, $edit, t('Save'));
preg_match('|test-entity/(\d+)/edit|', $this->url, $match);
$id = $match[1];
- $this->assertRaw(t('test_entity @id has been created.', array('@id' => $id)), 'Entity was created');
+ $this->assertRaw(t('test_entity @id has been created.', array('@id' => $id)), t('Entity was created'));
// Display the entity.
$entity = field_test_entity_test_load($id);
$entity->content = field_attach_view($entity_type, $entity, 'full');
$this->content = drupal_render($entity->content);
- $this->assertNoRaw($value, 'HTML tags are not displayed.');
- $this->assertRaw(check_plain($value), 'Escaped HTML is displayed correctly.');
+ $this->assertNoRaw($value, t('HTML tags are not displayed.'));
+ $this->assertRaw(check_plain($value), t('Escaped HTML is displayed correctly.'));
// Create a new text format that does not escape HTML, and grant the user
// access to it.
@@ -211,21 +211,21 @@ class TextFieldTestCase extends DrupalWebTestCase {
// Display edition form.
// We should now have a 'text format' selector.
$this->drupalGet('test-entity/' . $id . '/edit');
- $this->assertFieldByName("{$this->field_name}[$langcode][0][value]", '', 'Widget is displayed');
- $this->assertFieldByName("{$this->field_name}[$langcode][0][format]", '', 'Format selector is displayed');
+ $this->assertFieldByName("{$this->field_name}[$langcode][0][value]", '', t('Widget is displayed'));
+ $this->assertFieldByName("{$this->field_name}[$langcode][0][format]", '', t('Format selector is displayed'));
// Edit and change the text format to the new one that was created.
$edit = array(
"{$this->field_name}[$langcode][0][format]" => $format_id,
);
$this->drupalPost(NULL, $edit, t('Save'));
- $this->assertRaw(t('test_entity @id has been updated.', array('@id' => $id)), 'Entity was updated');
+ $this->assertRaw(t('test_entity @id has been updated.', array('@id' => $id)), t('Entity was updated'));
// Display the entity.
$entity = field_test_entity_test_load($id);
$entity->content = field_attach_view($entity_type, $entity, 'full');
$this->content = drupal_render($entity->content);
- $this->assertRaw($value, 'Value is displayed unfiltered');
+ $this->assertRaw($value, t('Value is displayed unfiltered'));
}
}
@@ -359,9 +359,9 @@ class TextSummaryTestCase extends DrupalWebTestCase {
// Test text_summary() for different sizes.
for ($i = 0; $i <= 37; $i++) {
- $this->callTextSummary($text, $expected[$i], NULL, $i);
- $this->callTextSummary($text, $expected_lb[$i], 1, $i);
- $this->callTextSummary($text, $expected_lb[$i], 2, $i);
+ $this->callTextSummary($text, $expected[$i], NULL, $i);
+ $this->callTextSummary($text, $expected_lb[$i], 1, $i);
+ $this->callTextSummary($text, $expected_lb[$i], 2, $i);
}
}
@@ -370,7 +370,7 @@ class TextSummaryTestCase extends DrupalWebTestCase {
*/
function callTextSummary($text, $expected, $format = NULL, $size = NULL) {
$summary = text_summary($text, $format, $size);
- $this->assertIdentical($summary, $expected, 'Generated summary "' . $summary . '" matches expected "' . $expected . '".');
+ $this->assertIdentical($summary, $expected, t('Generated summary "@summary" matches expected "@expected".', array('@summary' => $summary, '@expected' => $expected)));
}
}
@@ -398,7 +398,7 @@ class TextTranslationTestCase extends DrupalWebTestCase {
// Set "Article" content type to use multilingual support with translation.
$edit = array('language_content_type' => 2);
$this->drupalPost('admin/structure/types/manage/article', $edit, t('Save content type'));
- $this->assertRaw(t('The content type %type has been updated.', array('%type' => 'Article')), 'Article content type has been updated.');
+ $this->assertRaw(t('The content type %type has been updated.', array('%type' => 'Article')), t('Article content type has been updated.'));
}
/**
@@ -410,7 +410,7 @@ class TextTranslationTestCase extends DrupalWebTestCase {
$edit = array('field[cardinality]' => -1);
$this->drupalPost('admin/structure/types/manage/article/fields/body', $edit, t('Save settings'));
$this->drupalGet('node/add/article');
- $this->assertFieldByXPath("//input[@name='body_add_more']", t('Add another item'), 'Body field cardinality set to multiple.');
+ $this->assertFieldByXPath("//input[@name='body_add_more']", t('Add another item'), t('Body field cardinality set to multiple.'));
$body = array(
$this->randomName(),
@@ -434,7 +434,7 @@ class TextTranslationTestCase extends DrupalWebTestCase {
"body[$langcode][$delta][format]" => $format--,
);
$this->drupalPost('node/1/edit', $edit, t('Save'));
- $this->assertText($body[$delta], 'The body field with delta ' . $delta . ' has been saved.');
+ $this->assertText($body[$delta], t('The body field with delta @delta has been saved.', array('@delta' => $delta)));
}
// Login as translator.
@@ -444,7 +444,7 @@ class TextTranslationTestCase extends DrupalWebTestCase {
// Translate the article in french.
$this->drupalGet('node/1/translate');
$this->clickLink(t('add translation'));
- $this->assertNoText($body[0], 'The body field with delta ' . 0 . ' is hidden.');
- $this->assertText($body[1], 'The body field with delta ' . 1 . ' is shown.');
+ $this->assertNoText($body[0], t('The body field with delta @delta is hidden.', array('@delta' => 0)));
+ $this->assertText($body[1], t('The body field with delta @delta is shown.', array('@delta' => 1)));
}
}
diff --git a/modules/field/tests/field.test b/modules/field/tests/field.test
index 8038233be..7fbdba694 100644
--- a/modules/field/tests/field.test
+++ b/modules/field/tests/field.test
@@ -65,9 +65,9 @@ class FieldTestCase extends DrupalWebTestCase {
$e = clone $entity;
field_attach_load('test_entity', array($e->ftid => $e));
$values = isset($e->{$field_name}[$langcode]) ? $e->{$field_name}[$langcode] : array();
- $this->assertEqual(count($values), count($expected_values), 'Expected number of values were saved.');
+ $this->assertEqual(count($values), count($expected_values), t('Expected number of values were saved.'));
foreach ($expected_values as $key => $value) {
- $this->assertEqual($values[$key][$column], $value, 'Value ' . $value . ' was saved correctly.');
+ $this->assertEqual($values[$key][$column], $value, t('Value @value was saved correctly.', array('@value' => $value)));
}
}
}
@@ -166,12 +166,12 @@ class FieldAttachStorageTestCase extends FieldAttachTestCase {
$entity = field_test_create_stub_entity(0, 0, $this->instance['bundle']);
field_attach_load($entity_type, array(0 => $entity));
// Number of values per field loaded equals the field cardinality.
- $this->assertEqual(count($entity->{$this->field_name}[$langcode]), $this->field['cardinality'], 'Current revision: expected number of values');
+ $this->assertEqual(count($entity->{$this->field_name}[$langcode]), $this->field['cardinality'], t('Current revision: expected number of values'));
for ($delta = 0; $delta < $this->field['cardinality']; $delta++) {
// The field value loaded matches the one inserted or updated.
- $this->assertEqual($entity->{$this->field_name}[$langcode][$delta]['value'], $values[$current_revision][$delta]['value'], 'Current revision: expected value ' . $delta . ' was found.');
+ $this->assertEqual($entity->{$this->field_name}[$langcode][$delta]['value'] , $values[$current_revision][$delta]['value'], t('Current revision: expected value %delta was found.', array('%delta' => $delta)));
// The value added in hook_field_load() is found.
- $this->assertEqual($entity->{$this->field_name}[$langcode][$delta]['additional_key'], 'additional_value', 'Current revision: extra information for value ' . $delta . ' was found');
+ $this->assertEqual($entity->{$this->field_name}[$langcode][$delta]['additional_key'], 'additional_value', t('Current revision: extra information for value %delta was found', array('%delta' => $delta)));
}
// Confirm each revision loads the correct data.
@@ -179,12 +179,12 @@ class FieldAttachStorageTestCase extends FieldAttachTestCase {
$entity = field_test_create_stub_entity(0, $revision_id, $this->instance['bundle']);
field_attach_load_revision($entity_type, array(0 => $entity));
// Number of values per field loaded equals the field cardinality.
- $this->assertEqual(count($entity->{$this->field_name}[$langcode]), $this->field['cardinality'], 'Revision ' . $revision_id . ': expected number of values.');
+ $this->assertEqual(count($entity->{$this->field_name}[$langcode]), $this->field['cardinality'], t('Revision %revision_id: expected number of values.', array('%revision_id' => $revision_id)));
for ($delta = 0; $delta < $this->field['cardinality']; $delta++) {
// The field value loaded matches the one inserted or updated.
- $this->assertEqual($entity->{$this->field_name}[$langcode][$delta]['value'], $values[$revision_id][$delta]['value'], 'Revision ' . $revision_id . ': expected value ' . $delta . ' was found.');
+ $this->assertEqual($entity->{$this->field_name}[$langcode][$delta]['value'], $values[$revision_id][$delta]['value'], t('Revision %revision_id: expected value %delta was found.', array('%revision_id' => $revision_id, '%delta' => $delta)));
// The value added in hook_field_load() is found.
- $this->assertEqual($entity->{$this->field_name}[$langcode][$delta]['additional_key'], 'additional_value', 'Revision ' . $revision_id . ': extra information for value ' . $delta . ' was found');
+ $this->assertEqual($entity->{$this->field_name}[$langcode][$delta]['additional_key'], 'additional_value', t('Revision %revision_id: extra information for value %delta was found', array('%revision_id' => $revision_id, '%delta' => $delta)));
}
}
}
@@ -250,19 +250,19 @@ class FieldAttachStorageTestCase extends FieldAttachTestCase {
$instances = field_info_instances($entity_type, $bundles[$index]);
foreach ($instances as $field_name => $instance) {
// The field value loaded matches the one inserted.
- $this->assertEqual($entity->{$field_name}[$langcode][0]['value'], $values[$index][$field_name], 'Entity ' . $index . ': expected value was found.');
+ $this->assertEqual($entity->{$field_name}[$langcode][0]['value'], $values[$index][$field_name], t('Entity %index: expected value was found.', array('%index' => $index)));
// The value added in hook_field_load() is found.
- $this->assertEqual($entity->{$field_name}[$langcode][0]['additional_key'], 'additional_value', 'Entity ' . $index . ': extra information was found');
+ $this->assertEqual($entity->{$field_name}[$langcode][0]['additional_key'], 'additional_value', t('Entity %index: extra information was found', array('%index' => $index)));
}
}
// Check that the single-field load option works.
$entity = field_test_create_stub_entity(1, 1, $bundles[1]);
field_attach_load($entity_type, array(1 => $entity), FIELD_LOAD_CURRENT, array('field_id' => $field_ids[1]));
- $this->assertEqual($entity->{$field_names[1]}[$langcode][0]['value'], $values[1][$field_names[1]], 'Entity ' . 1 . ': expected value was found.');
- $this->assertEqual($entity->{$field_names[1]}[$langcode][0]['additional_key'], 'additional_value', 'Entity ' . 1 . ': extra information was found');
- $this->assert(!isset($entity->{$field_names[2]}), 'Entity ' . 2 . ': field ' . $field_names[2] . ' is not loaded.');
- $this->assert(!isset($entity->{$field_names[3]}), 'Entity ' . 3 . ': field ' . $field_names[3] . ' is not loaded.');
+ $this->assertEqual($entity->{$field_names[1]}[$langcode][0]['value'], $values[1][$field_names[1]], t('Entity %index: expected value was found.', array('%index' => 1)));
+ $this->assertEqual($entity->{$field_names[1]}[$langcode][0]['additional_key'], 'additional_value', t('Entity %index: extra information was found', array('%index' => 1)));
+ $this->assert(!isset($entity->{$field_names[2]}), t('Entity %index: field %field_name is not loaded.', array('%index' => 2, '%field_name' => $field_names[2])));
+ $this->assert(!isset($entity->{$field_names[3]}), t('Entity %index: field %field_name is not loaded.', array('%index' => 3, '%field_name' => $field_names[3])));
}
/**
@@ -312,7 +312,7 @@ class FieldAttachStorageTestCase extends FieldAttachTestCase {
$entity = clone($entity_init);
field_attach_load($entity_type, array($entity->ftid => $entity));
foreach ($fields as $field) {
- $this->assertEqual($values[$field['field_name']], $entity->{$field['field_name']}[$langcode], $field['storage']['type'] . ' storage: expected values were found.');
+ $this->assertEqual($values[$field['field_name']], $entity->{$field['field_name']}[$langcode], t('%storage storage: expected values were found.', array('%storage' => $field['storage']['type'])));
}
}
@@ -341,20 +341,20 @@ class FieldAttachStorageTestCase extends FieldAttachTestCase {
$instance = field_info_instance($instance['entity_type'], $instance['field_name'], $instance['bundle']);
// The storage details are indexed by a storage engine type.
- $this->assertTrue(array_key_exists('drupal_variables', $field['storage']['details']), 'The storage type is Drupal variables.');
+ $this->assertTrue(array_key_exists('drupal_variables', $field['storage']['details']), t('The storage type is Drupal variables.'));
$details = $field['storage']['details']['drupal_variables'];
// The field_test storage details are indexed by variable name. The details
// are altered, so moon and mars are correct for this test.
- $this->assertTrue(array_key_exists('moon', $details[FIELD_LOAD_CURRENT]), 'Moon is available in the instance array.');
- $this->assertTrue(array_key_exists('mars', $details[FIELD_LOAD_REVISION]), 'Mars is available in the instance array.');
+ $this->assertTrue(array_key_exists('moon', $details[FIELD_LOAD_CURRENT]), t('Moon is available in the instance array.'));
+ $this->assertTrue(array_key_exists('mars', $details[FIELD_LOAD_REVISION]), t('Mars is available in the instance array.'));
// Test current and revision storage details together because the columns
// are the same.
foreach ((array) $field['columns'] as $column_name => $attributes) {
- $this->assertEqual($details[FIELD_LOAD_CURRENT]['moon'][$column_name], $column_name, 'Column name ' . $column_name . ' matches the definition in ' . 'moon[FIELD_LOAD_CURRENT]' . '.');
- $this->assertEqual($details[FIELD_LOAD_REVISION]['mars'][$column_name], $column_name, 'Column name ' . $column_name . ' matches the definition in ' . 'mars[FIELD_LOAD_REVISION]' . '.');
+ $this->assertEqual($details[FIELD_LOAD_CURRENT]['moon'][$column_name], $column_name, t('Column name %value matches the definition in %bin.', array('%value' => $column_name, '%bin' => 'moon[FIELD_LOAD_CURRENT]')));
+ $this->assertEqual($details[FIELD_LOAD_REVISION]['mars'][$column_name], $column_name, t('Column name %value matches the definition in %bin.', array('%value' => $column_name, '%bin' => 'mars[FIELD_LOAD_REVISION]')));
}
}
@@ -372,7 +372,7 @@ class FieldAttachStorageTestCase extends FieldAttachTestCase {
$entity = clone($entity_init);
field_attach_load($entity_type, array($entity->ftid => $entity));
- $this->assertTrue(empty($entity->{$this->field_name}), 'Insert: missing field results in no value saved');
+ $this->assertTrue(empty($entity->{$this->field_name}), t('Insert: missing field results in no value saved'));
// Insert: Field is NULL.
field_cache_clear();
@@ -382,7 +382,7 @@ class FieldAttachStorageTestCase extends FieldAttachTestCase {
$entity = clone($entity_init);
field_attach_load($entity_type, array($entity->ftid => $entity));
- $this->assertTrue(empty($entity->{$this->field_name}), 'Insert: NULL field results in no value saved');
+ $this->assertTrue(empty($entity->{$this->field_name}), t('Insert: NULL field results in no value saved'));
// Add some real data.
field_cache_clear();
@@ -393,7 +393,7 @@ class FieldAttachStorageTestCase extends FieldAttachTestCase {
$entity = clone($entity_init);
field_attach_load($entity_type, array($entity->ftid => $entity));
- $this->assertEqual($entity->{$this->field_name}[$langcode], $values, 'Field data saved');
+ $this->assertEqual($entity->{$this->field_name}[$langcode], $values, t('Field data saved'));
// Update: Field is missing. Data should survive.
field_cache_clear();
@@ -402,7 +402,7 @@ class FieldAttachStorageTestCase extends FieldAttachTestCase {
$entity = clone($entity_init);
field_attach_load($entity_type, array($entity->ftid => $entity));
- $this->assertEqual($entity->{$this->field_name}[$langcode], $values, 'Update: missing field leaves existing values in place');
+ $this->assertEqual($entity->{$this->field_name}[$langcode], $values, t('Update: missing field leaves existing values in place'));
// Update: Field is NULL. Data should be wiped.
field_cache_clear();
@@ -412,7 +412,7 @@ class FieldAttachStorageTestCase extends FieldAttachTestCase {
$entity = clone($entity_init);
field_attach_load($entity_type, array($entity->ftid => $entity));
- $this->assertTrue(empty($entity->{$this->field_name}), 'Update: NULL field removes existing values');
+ $this->assertTrue(empty($entity->{$this->field_name}), t('Update: NULL field removes existing values'));
// Re-add some data.
field_cache_clear();
@@ -423,7 +423,7 @@ class FieldAttachStorageTestCase extends FieldAttachTestCase {
$entity = clone($entity_init);
field_attach_load($entity_type, array($entity->ftid => $entity));
- $this->assertEqual($entity->{$this->field_name}[$langcode], $values, 'Field data saved');
+ $this->assertEqual($entity->{$this->field_name}[$langcode], $values, t('Field data saved'));
// Update: Field is empty array. Data should be wiped.
field_cache_clear();
@@ -433,7 +433,7 @@ class FieldAttachStorageTestCase extends FieldAttachTestCase {
$entity = clone($entity_init);
field_attach_load($entity_type, array($entity->ftid => $entity));
- $this->assertTrue(empty($entity->{$this->field_name}), 'Update: empty array removes existing values');
+ $this->assertTrue(empty($entity->{$this->field_name}), t('Update: empty array removes existing values'));
}
/**
@@ -455,7 +455,7 @@ class FieldAttachStorageTestCase extends FieldAttachTestCase {
$entity = clone($entity_init);
field_attach_load($entity_type, array($entity->ftid => $entity));
- $this->assertTrue(empty($entity->{$this->field_name}[$langcode]), 'Insert: NULL field results in no value saved');
+ $this->assertTrue(empty($entity->{$this->field_name}[$langcode]), t('Insert: NULL field results in no value saved'));
// Insert: Field is missing.
field_cache_clear();
@@ -465,7 +465,7 @@ class FieldAttachStorageTestCase extends FieldAttachTestCase {
$entity = clone($entity_init);
field_attach_load($entity_type, array($entity->ftid => $entity));
$values = field_test_default_value($entity_type, $entity, $this->field, $this->instance);
- $this->assertEqual($entity->{$this->field_name}[$langcode], $values, 'Insert: missing field results in default value saved');
+ $this->assertEqual($entity->{$this->field_name}[$langcode], $values, t('Insert: missing field results in default value saved'));
}
/**
@@ -520,7 +520,7 @@ class FieldAttachStorageTestCase extends FieldAttachTestCase {
}
$read = field_test_create_stub_entity(0, 2, $this->instance['bundle']);
field_attach_load($entity_type, array(0 => $read));
- $this->assertIdentical($read->{$this->field_name}, array(), 'The test entity current revision is deleted.');
+ $this->assertIdentical($read->{$this->field_name}, array(), t('The test entity current revision is deleted.'));
}
/**
@@ -759,7 +759,7 @@ class FieldAttachOtherTestCase extends FieldAttachTestCase {
break;
}
}
- $this->assertTrue($result, 'Variable $' . $this->field_name . ' correctly populated.');
+ $this->assertTrue($result, t('Variable $@field_name correctly populated.', array('@field_name' => $this->field_name)));
}
/**
@@ -776,18 +776,18 @@ class FieldAttachOtherTestCase extends FieldAttachTestCase {
$cid = "field:$entity_type:{$entity_init->ftid}";
// Check that no initial cache entry is present.
- $this->assertFalse(cache_get($cid, 'cache_field'), 'Non-cached: no initial cache entry');
+ $this->assertFalse(cache_get($cid, 'cache_field'), t('Non-cached: no initial cache entry'));
// Save, and check that no cache entry is present.
$entity = clone($entity_init);
$entity->{$this->field_name}[$langcode] = $values;
field_attach_insert($entity_type, $entity);
- $this->assertFalse(cache_get($cid, 'cache_field'), 'Non-cached: no cache entry on insert');
+ $this->assertFalse(cache_get($cid, 'cache_field'), t('Non-cached: no cache entry on insert'));
// Load, and check that no cache entry is present.
$entity = clone($entity_init);
field_attach_load($entity_type, array($entity->ftid => $entity));
- $this->assertFalse(cache_get($cid, 'cache_field'), 'Non-cached: no cache entry on load');
+ $this->assertFalse(cache_get($cid, 'cache_field'), t('Non-cached: no cache entry on load'));
// Cacheable entity type.
@@ -798,38 +798,38 @@ class FieldAttachOtherTestCase extends FieldAttachTestCase {
field_create_instance($instance);
// Check that no initial cache entry is present.
- $this->assertFalse(cache_get($cid, 'cache_field'), 'Cached: no initial cache entry');
+ $this->assertFalse(cache_get($cid, 'cache_field'), t('Cached: no initial cache entry'));
// Save, and check that no cache entry is present.
$entity = clone($entity_init);
$entity->{$this->field_name}[$langcode] = $values;
field_attach_insert($entity_type, $entity);
- $this->assertFalse(cache_get($cid, 'cache_field'), 'Cached: no cache entry on insert');
+ $this->assertFalse(cache_get($cid, 'cache_field'), t('Cached: no cache entry on insert'));
// Load a single field, and check that no cache entry is present.
$entity = clone($entity_init);
field_attach_load($entity_type, array($entity->ftid => $entity), FIELD_LOAD_CURRENT, array('field_id' => $this->field_id));
$cache = cache_get($cid, 'cache_field');
- $this->assertFalse(cache_get($cid, 'cache_field'), 'Cached: no cache entry on loading a single field');
+ $this->assertFalse(cache_get($cid, 'cache_field'), t('Cached: no cache entry on loading a single field'));
// Load, and check that a cache entry is present with the expected values.
$entity = clone($entity_init);
field_attach_load($entity_type, array($entity->ftid => $entity));
$cache = cache_get($cid, 'cache_field');
- $this->assertEqual($cache->data[$this->field_name][$langcode], $values, 'Cached: correct cache entry on load');
+ $this->assertEqual($cache->data[$this->field_name][$langcode], $values, t('Cached: correct cache entry on load'));
// Update with different values, and check that the cache entry is wiped.
$values = $this->_generateTestFieldValues($this->field['cardinality']);
$entity = clone($entity_init);
$entity->{$this->field_name}[$langcode] = $values;
field_attach_update($entity_type, $entity);
- $this->assertFalse(cache_get($cid, 'cache_field'), 'Cached: no cache entry on update');
+ $this->assertFalse(cache_get($cid, 'cache_field'), t('Cached: no cache entry on update'));
// Load, and check that a cache entry is present with the expected values.
$entity = clone($entity_init);
field_attach_load($entity_type, array($entity->ftid => $entity));
$cache = cache_get($cid, 'cache_field');
- $this->assertEqual($cache->data[$this->field_name][$langcode], $values, 'Cached: correct cache entry on load');
+ $this->assertEqual($cache->data[$this->field_name][$langcode], $values, t('Cached: correct cache entry on load'));
// Create a new revision, and check that the cache entry is wiped.
$entity_init = field_test_create_stub_entity(1, 2, $this->instance['bundle']);
@@ -838,17 +838,17 @@ class FieldAttachOtherTestCase extends FieldAttachTestCase {
$entity->{$this->field_name}[$langcode] = $values;
field_attach_update($entity_type, $entity);
$cache = cache_get($cid, 'cache_field');
- $this->assertFalse(cache_get($cid, 'cache_field'), 'Cached: no cache entry on new revision creation');
+ $this->assertFalse(cache_get($cid, 'cache_field'), t('Cached: no cache entry on new revision creation'));
// Load, and check that a cache entry is present with the expected values.
$entity = clone($entity_init);
field_attach_load($entity_type, array($entity->ftid => $entity));
$cache = cache_get($cid, 'cache_field');
- $this->assertEqual($cache->data[$this->field_name][$langcode], $values, 'Cached: correct cache entry on load');
+ $this->assertEqual($cache->data[$this->field_name][$langcode], $values, t('Cached: correct cache entry on load'));
// Delete, and check that the cache entry is wiped.
field_attach_delete($entity_type, $entity);
- $this->assertFalse(cache_get($cid, 'cache_field'), 'Cached: no cache entry after delete');
+ $this->assertFalse(cache_get($cid, 'cache_field'), t('Cached: no cache entry after delete'));
}
/**
@@ -898,7 +898,7 @@ class FieldAttachOtherTestCase extends FieldAttachTestCase {
catch (FieldValidationException $e) {
$errors = $e->errors;
}
- $this->assertEqual($errors[$this->field_name][$langcode][0][0]['error'], 'field_cardinality', 'Cardinality validation failed.');
+ $this->assertEqual($errors[$this->field_name][$langcode][0][0]['error'], 'field_cardinality', t('Cardinality validation failed.'));
}
@@ -996,39 +996,39 @@ class FieldInfoTestCase extends FieldTestCase {
$info = field_info_field_types();
foreach ($field_test_info as $t_key => $field_type) {
foreach ($field_type as $key => $val) {
- $this->assertEqual($info[$t_key][$key], $val, "Field type $t_key key $key is $val");
+ $this->assertEqual($info[$t_key][$key], $val, t("Field type $t_key key $key is $val"));
}
- $this->assertEqual($info[$t_key]['module'], 'field_test', "Field type field_test module appears");
+ $this->assertEqual($info[$t_key]['module'], 'field_test', t("Field type field_test module appears"));
}
$info = field_info_formatter_types();
foreach ($formatter_info as $f_key => $formatter) {
foreach ($formatter as $key => $val) {
- $this->assertEqual($info[$f_key][$key], $val, "Formatter type $f_key key $key is $val");
+ $this->assertEqual($info[$f_key][$key], $val, t("Formatter type $f_key key $key is $val"));
}
- $this->assertEqual($info[$f_key]['module'], 'field_test', "Formatter type field_test module appears");
+ $this->assertEqual($info[$f_key]['module'], 'field_test', t("Formatter type field_test module appears"));
}
$info = field_info_widget_types();
foreach ($widget_info as $w_key => $widget) {
foreach ($widget as $key => $val) {
- $this->assertEqual($info[$w_key][$key], $val, "Widget type $w_key key $key is $val");
+ $this->assertEqual($info[$w_key][$key], $val, t("Widget type $w_key key $key is $val"));
}
- $this->assertEqual($info[$w_key]['module'], 'field_test', "Widget type field_test module appears");
+ $this->assertEqual($info[$w_key]['module'], 'field_test', t("Widget type field_test module appears"));
}
$info = field_info_storage_types();
foreach ($storage_info as $s_key => $storage) {
foreach ($storage as $key => $val) {
- $this->assertEqual($info[$s_key][$key], $val, "Storage type $s_key key $key is $val");
+ $this->assertEqual($info[$s_key][$key], $val, t("Storage type $s_key key $key is $val"));
}
- $this->assertEqual($info[$s_key]['module'], 'field_test', "Storage type field_test module appears");
+ $this->assertEqual($info[$s_key]['module'], 'field_test', t("Storage type field_test module appears"));
}
// Verify that no unexpected instances exist.
$core_fields = field_info_fields();
$instances = field_info_instances('test_entity', 'test_bundle');
- $this->assertTrue(empty($instances), 'With no instances, info bundles is empty.');
+ $this->assertTrue(empty($instances), t('With no instances, info bundles is empty.'));
// Create a field, verify it shows up.
$field = array(
@@ -1037,16 +1037,16 @@ class FieldInfoTestCase extends FieldTestCase {
);
field_create_field($field);
$fields = field_info_fields();
- $this->assertEqual(count($fields), count($core_fields) + 1, 'One new field exists');
- $this->assertEqual($fields[$field['field_name']]['field_name'], $field['field_name'], 'info fields contains field name');
- $this->assertEqual($fields[$field['field_name']]['type'], $field['type'], 'info fields contains field type');
- $this->assertEqual($fields[$field['field_name']]['module'], 'field_test', 'info fields contains field module');
+ $this->assertEqual(count($fields), count($core_fields) + 1, t('One new field exists'));
+ $this->assertEqual($fields[$field['field_name']]['field_name'], $field['field_name'], t('info fields contains field name'));
+ $this->assertEqual($fields[$field['field_name']]['type'], $field['type'], t('info fields contains field type'));
+ $this->assertEqual($fields[$field['field_name']]['module'], 'field_test', t('info fields contains field module'));
$settings = array('test_field_setting' => 'dummy test string');
foreach ($settings as $key => $val) {
- $this->assertEqual($fields[$field['field_name']]['settings'][$key], $val, "Field setting $key has correct default value $val");
+ $this->assertEqual($fields[$field['field_name']]['settings'][$key], $val, t("Field setting $key has correct default value $val"));
}
- $this->assertEqual($fields[$field['field_name']]['cardinality'], 1, 'info fields contains cardinality 1');
- $this->assertEqual($fields[$field['field_name']]['active'], 1, 'info fields contains active 1');
+ $this->assertEqual($fields[$field['field_name']]['cardinality'], 1, t('info fields contains cardinality 1'));
+ $this->assertEqual($fields[$field['field_name']]['active'], 1, t('info fields contains active 1'));
// Create an instance, verify that it shows up
$instance = array(
@@ -1064,8 +1064,8 @@ class FieldInfoTestCase extends FieldTestCase {
field_create_instance($instance);
$instances = field_info_instances('test_entity', $instance['bundle']);
- $this->assertEqual(count($instances), 1, 'One instance shows up in info when attached to a bundle.');
- $this->assertTrue($instance < $instances[$instance['field_name']], 'Instance appears in info correctly');
+ $this->assertEqual(count($instances), 1, t('One instance shows up in info when attached to a bundle.'));
+ $this->assertTrue($instance < $instances[$instance['field_name']], t('Instance appears in info correctly'));
}
/**
@@ -1096,7 +1096,7 @@ class FieldInfoTestCase extends FieldTestCase {
// Check that all expected settings are in place.
$field_type = field_info_field_types($field_definition['type']);
- $this->assertIdentical($field['settings'], $field_type['settings'], 'All expected default field settings are present.');
+ $this->assertIdentical($field['settings'], $field_type['settings'], t('All expected default field settings are present.'));
}
/**
@@ -1138,18 +1138,18 @@ class FieldInfoTestCase extends FieldTestCase {
// Check that all expected instance settings are in place.
$field_type = field_info_field_types($field_definition['type']);
- $this->assertIdentical($instance['settings'], $field_type['instance_settings'], 'All expected instance settings are present.');
+ $this->assertIdentical($instance['settings'], $field_type['instance_settings'] , t('All expected instance settings are present.'));
// Check that the default widget is used and expected settings are in place.
- $this->assertIdentical($instance['widget']['type'], $field_type['default_widget'], 'Unavailable widget replaced with default widget.');
+ $this->assertIdentical($instance['widget']['type'], $field_type['default_widget'], t('Unavailable widget replaced with default widget.'));
$widget_type = field_info_widget_types($instance['widget']['type']);
- $this->assertIdentical($instance['widget']['settings'], $widget_type['settings'], 'All expected widget settings are present.');
+ $this->assertIdentical($instance['widget']['settings'], $widget_type['settings'] , t('All expected widget settings are present.'));
// Check that display settings are set for the 'default' mode.
$display = $instance['display']['default'];
- $this->assertIdentical($display['type'], $field_type['default_formatter'], "Formatter is set for the 'default' view mode");
+ $this->assertIdentical($display['type'], $field_type['default_formatter'], t("Formatter is set for the 'default' view mode"));
$formatter_type = field_info_formatter_types($display['type']);
- $this->assertIdentical($display['settings'], $formatter_type['settings'], "Formatter settings are set for the 'default' view mode");
+ $this->assertIdentical($display['settings'], $formatter_type['settings'] , t("Formatter settings are set for the 'default' view mode"));
}
/**
@@ -1172,7 +1172,7 @@ class FieldInfoTestCase extends FieldTestCase {
// Disable coment module. This clears field_info cache.
module_disable(array('comment'));
- $this->assertNull(field_info_instance('comment', 'field', 'comment_node_article'), 'No instances are returned on disabled entity types.');
+ $this->assertNull(field_info_instance('comment', 'field', 'comment_node_article'), t('No instances are returned on disabled entity types.'));
}
/**
@@ -1319,13 +1319,13 @@ class FieldFormTestCase extends FieldTestCase {
$this->assertRaw(t('!name field is required.', array('!name' => $this->instance['label'])), 'Required field with no value fails validation');
}
- // function testFieldFormMultiple() {
- // $this->field = $this->field_multiple;
- // $this->field_name = $this->field['field_name'];
- // $this->instance['field_name'] = $this->field_name;
- // field_create_field($this->field);
- // field_create_instance($this->instance);
- // }
+// function testFieldFormMultiple() {
+// $this->field = $this->field_multiple;
+// $this->field_name = $this->field['field_name'];
+// $this->instance['field_name'] = $this->field_name;
+// field_create_field($this->field);
+// field_create_instance($this->instance);
+// }
function testFieldFormUnlimited() {
$this->field = $this->field_unlimited;
@@ -1469,7 +1469,7 @@ class FieldFormTestCase extends FieldTestCase {
// Display creation form.
$this->drupalGet('test-entity/add/test-bundle');
- $this->assertFieldByName("{$this->field_name}[$langcode]", '', 'Widget is displayed.');
+ $this->assertFieldByName("{$this->field_name}[$langcode]", '', t('Widget is displayed.'));
// Create entity with three values.
$edit = array("{$this->field_name}[$langcode]" => '1, 2, 3');
@@ -1483,12 +1483,12 @@ class FieldFormTestCase extends FieldTestCase {
// Display the form, check that the values are correctly filled in.
$this->drupalGet('test-entity/' . $id . '/edit');
- $this->assertFieldByName("{$this->field_name}[$langcode]", '1, 2, 3', 'Widget is displayed.');
+ $this->assertFieldByName("{$this->field_name}[$langcode]", '1, 2, 3', t('Widget is displayed.'));
// Submit the form with more values than the field accepts.
$edit = array("{$this->field_name}[$langcode]" => '1, 2, 3, 4, 5');
$this->drupalPost(NULL, $edit, t('Save'));
- $this->assertRaw('this field cannot hold more than 4 values', 'Form validation failed.');
+ $this->assertRaw('this field cannot hold more than 4 values', t('Form validation failed.'));
// Check that the field values were not submitted.
$this->assertFieldValues($entity_init, $this->field_name, $langcode, array(1, 2, 3));
}
@@ -1524,7 +1524,7 @@ class FieldFormTestCase extends FieldTestCase {
// Display creation form.
$this->drupalGet('test-entity/add/test-bundle');
- $this->assertNoFieldByName("{$field_name_no_access}[$langcode][0][value]", '', 'Widget is not displayed if field access is denied.');
+ $this->assertNoFieldByName("{$field_name_no_access}[$langcode][0][value]", '', t('Widget is not displayed if field access is denied.'));
// Create entity.
$edit = array("{$field_name}[$langcode][0][value]" => 1);
@@ -1534,8 +1534,8 @@ class FieldFormTestCase extends FieldTestCase {
// Check that the default value was saved.
$entity = field_test_entity_test_load($id);
- $this->assertEqual($entity->{$field_name_no_access}[$langcode][0]['value'], 99, 'Default value was saved for the field with no edit access.');
- $this->assertEqual($entity->{$field_name}[$langcode][0]['value'], 1, 'Entered value vas saved for the field with edit access.');
+ $this->assertEqual($entity->{$field_name_no_access}[$langcode][0]['value'], 99, t('Default value was saved for the field with no edit access.'));
+ $this->assertEqual($entity->{$field_name}[$langcode][0]['value'], 1, t('Entered value vas saved for the field with edit access.'));
// Create a new revision.
$edit = array("{$field_name}[$langcode][0][value]" => 2, 'revision' => TRUE);
@@ -1543,13 +1543,13 @@ class FieldFormTestCase extends FieldTestCase {
// Check that the new revision has the expected values.
$entity = field_test_entity_test_load($id);
- $this->assertEqual($entity->{$field_name_no_access}[$langcode][0]['value'], 99, 'New revision has the expected value for the field with no edit access.');
- $this->assertEqual($entity->{$field_name}[$langcode][0]['value'], 2, 'New revision has the expected value for the field with edit access.');
+ $this->assertEqual($entity->{$field_name_no_access}[$langcode][0]['value'], 99, t('New revision has the expected value for the field with no edit access.'));
+ $this->assertEqual($entity->{$field_name}[$langcode][0]['value'], 2, t('New revision has the expected value for the field with edit access.'));
// Check that the revision is also saved in the revisions table.
$entity = field_test_entity_test_load($id, $entity->ftvid);
- $this->assertEqual($entity->{$field_name_no_access}[$langcode][0]['value'], 99, 'New revision has the expected value for the field with no edit access.');
- $this->assertEqual($entity->{$field_name}[$langcode][0]['value'], 2, 'New revision has the expected value for the field with edit access.');
+ $this->assertEqual($entity->{$field_name_no_access}[$langcode][0]['value'], 99, t('New revision has the expected value for the field with no edit access.'));
+ $this->assertEqual($entity->{$field_name}[$langcode][0]['value'], 2, t('New revision has the expected value for the field with edit access.'));
}
}
@@ -1615,9 +1615,9 @@ class FieldDisplayAPITestCase extends FieldTestCase {
$this->drupalSetContent(drupal_render($output));
$settings = field_info_formatter_settings('field_test_default');
$setting = $settings['test_formatter_setting'];
- $this->assertText($this->label, 'Label was displayed.');
- foreach ($this->values as $delta => $value) {
- $this->assertText($setting . '|' . $value['value'], 'Value ' . $delta . ' was displayed with expected setting.');
+ $this->assertText($this->label, t('Label was displayed.'));
+ foreach($this->values as $delta => $value) {
+ $this->assertText($setting . '|' . $value['value'], t('Value @delta was displayed with expected setting.', array('@delta' => $delta)));
}
// Check that explicit display settings are used.
@@ -1631,12 +1631,12 @@ class FieldDisplayAPITestCase extends FieldTestCase {
$output = field_view_field('test_entity', $this->entity, $this->field_name, $display);
$this->drupalSetContent(drupal_render($output));
$setting = $display['settings']['test_formatter_setting_multiple'];
- $this->assertNoText($this->label, 'Label was not displayed.');
+ $this->assertNoText($this->label, t('Label was not displayed.'));
$array = array();
- foreach ($this->values as $delta => $value) {
+ foreach($this->values as $delta => $value) {
$array[] = $delta . ':' . $value['value'];
}
- $this->assertText($setting . '|' . implode('|', $array), 'Values were displayed with expected setting.');
+ $this->assertText($setting . '|' . implode('|', $array), t('Values were displayed with expected setting.'));
// Check the prepare_view steps are invoked.
$display = array(
@@ -1650,9 +1650,9 @@ class FieldDisplayAPITestCase extends FieldTestCase {
$view = drupal_render($output);
$this->drupalSetContent($view);
$setting = $display['settings']['test_formatter_setting_additional'];
- $this->assertNoText($this->label, 'Label was not displayed.');
+ $this->assertNoText($this->label, t('Label was not displayed.'));
foreach ($this->values as $delta => $value) {
- $this->assertText($setting . '|' . $value['value'] . '|' . ($value['value'] + 1), 'Value ' . $delta . ' was displayed with expected setting.');
+ $this->assertText($setting . '|' . $value['value'] . '|' . ($value['value'] + 1), t('Value @delta was displayed with expected setting.', array('@delta' => $delta)));
}
// View mode: check that display settings specified in the instance are
@@ -1660,9 +1660,9 @@ class FieldDisplayAPITestCase extends FieldTestCase {
$output = field_view_field('test_entity', $this->entity, $this->field_name, 'teaser');
$this->drupalSetContent(drupal_render($output));
$setting = $this->instance['display']['teaser']['settings']['test_formatter_setting'];
- $this->assertText($this->label, 'Label was displayed.');
- foreach ($this->values as $delta => $value) {
- $this->assertText($setting . '|' . $value['value'], 'Value ' . $delta . ' was displayed with expected setting.');
+ $this->assertText($this->label, t('Label was displayed.'));
+ foreach($this->values as $delta => $value) {
+ $this->assertText($setting . '|' . $value['value'], t('Value @delta was displayed with expected setting.', array('@delta' => $delta)));
}
// Unknown view mode: check that display settings for 'default' view mode
@@ -1670,9 +1670,9 @@ class FieldDisplayAPITestCase extends FieldTestCase {
$output = field_view_field('test_entity', $this->entity, $this->field_name, 'unknown_view_mode');
$this->drupalSetContent(drupal_render($output));
$setting = $this->instance['display']['default']['settings']['test_formatter_setting'];
- $this->assertText($this->label, 'Label was displayed.');
- foreach ($this->values as $delta => $value) {
- $this->assertText($setting . '|' . $value['value'], 'Value ' . $delta . ' was displayed with expected setting.');
+ $this->assertText($this->label, t('Label was displayed.'));
+ foreach($this->values as $delta => $value) {
+ $this->assertText($setting . '|' . $value['value'], t('Value @delta was displayed with expected setting.', array('@delta' => $delta)));
}
}
@@ -1687,7 +1687,7 @@ class FieldDisplayAPITestCase extends FieldTestCase {
$item = $this->entity->{$this->field_name}[LANGUAGE_NONE][$delta];
$output = field_view_value('test_entity', $this->entity, $this->field_name, $item);
$this->drupalSetContent(drupal_render($output));
- $this->assertText($setting . '|' . $value['value'], 'Value ' . $delta . ' was displayed with expected setting.');
+ $this->assertText($setting . '|' . $value['value'], t('Value @delta was displayed with expected setting.', array('@delta' => $delta)));
}
// Check that explicit display settings are used.
@@ -1703,7 +1703,7 @@ class FieldDisplayAPITestCase extends FieldTestCase {
$item = $this->entity->{$this->field_name}[LANGUAGE_NONE][$delta];
$output = field_view_value('test_entity', $this->entity, $this->field_name, $item, $display);
$this->drupalSetContent(drupal_render($output));
- $this->assertText($setting . '|0:' . $value['value'], 'Value ' . $delta . ' was displayed with expected setting.');
+ $this->assertText($setting . '|0:' . $value['value'], t('Value @delta was displayed with expected setting.', array('@delta' => $delta)));
}
// Check that prepare_view steps are invoked.
@@ -1719,7 +1719,7 @@ class FieldDisplayAPITestCase extends FieldTestCase {
$item = $this->entity->{$this->field_name}[LANGUAGE_NONE][$delta];
$output = field_view_value('test_entity', $this->entity, $this->field_name, $item, $display);
$this->drupalSetContent(drupal_render($output));
- $this->assertText($setting . '|' . $value['value'] . '|' . ($value['value'] + 1), 'Value ' . $delta . ' was displayed with expected setting.');
+ $this->assertText($setting . '|' . $value['value'] . '|' . ($value['value'] + 1), t('Value @delta was displayed with expected setting.', array('@delta' => $delta)));
}
// View mode: check that display settings specified in the instance are
@@ -1729,7 +1729,7 @@ class FieldDisplayAPITestCase extends FieldTestCase {
$item = $this->entity->{$this->field_name}[LANGUAGE_NONE][$delta];
$output = field_view_value('test_entity', $this->entity, $this->field_name, $item, 'teaser');
$this->drupalSetContent(drupal_render($output));
- $this->assertText($setting . '|' . $value['value'], 'Value ' . $delta . ' was displayed with expected setting.');
+ $this->assertText($setting . '|' . $value['value'], t('Value @delta was displayed with expected setting.', array('@delta' => $delta)));
}
// Unknown view mode: check that display settings for 'default' view mode
@@ -1739,7 +1739,7 @@ class FieldDisplayAPITestCase extends FieldTestCase {
$item = $this->entity->{$this->field_name}[LANGUAGE_NONE][$delta];
$output = field_view_value('test_entity', $this->entity, $this->field_name, $item, 'unknown_view_mode');
$this->drupalSetContent(drupal_render($output));
- $this->assertText($setting . '|' . $value['value'], 'Value ' . $delta . ' was displayed with expected setting.');
+ $this->assertText($setting . '|' . $value['value'], t('Value @delta was displayed with expected setting.', array('@delta' => $delta)));
}
}
}
@@ -1782,26 +1782,26 @@ class FieldCrudTestCase extends FieldTestCase {
$record['data'] = unserialize($record['data']);
// Ensure that basic properties are preserved.
- $this->assertEqual($record['field_name'], $field_definition['field_name'], 'The field name is properly saved.');
- $this->assertEqual($record['type'], $field_definition['type'], 'The field type is properly saved.');
+ $this->assertEqual($record['field_name'], $field_definition['field_name'], t('The field name is properly saved.'));
+ $this->assertEqual($record['type'], $field_definition['type'], t('The field type is properly saved.'));
// Ensure that cardinality defaults to 1.
- $this->assertEqual($record['cardinality'], 1, 'Cardinality defaults to 1.');
+ $this->assertEqual($record['cardinality'], 1, t('Cardinality defaults to 1.'));
// Ensure that default settings are present.
$field_type = field_info_field_types($field_definition['type']);
- $this->assertIdentical($record['data']['settings'], $field_type['settings'], 'Default field settings have been written.');
+ $this->assertIdentical($record['data']['settings'], $field_type['settings'], t('Default field settings have been written.'));
// Ensure that default storage was set.
- $this->assertEqual($record['storage_type'], variable_get('field_storage_default'), 'The field type is properly saved.');
+ $this->assertEqual($record['storage_type'], variable_get('field_storage_default'), t('The field type is properly saved.'));
// Guarantee that the name is unique.
try {
field_create_field($field_definition);
- $this->fail('Cannot create two fields with the same name.');
+ $this->fail(t('Cannot create two fields with the same name.'));
}
catch (FieldException $e) {
- $this->pass('Cannot create two fields with the same name.');
+ $this->pass(t('Cannot create two fields with the same name.'));
}
// Check that field type is required.
@@ -1810,10 +1810,10 @@ class FieldCrudTestCase extends FieldTestCase {
'field_name' => 'field_1',
);
field_create_field($field_definition);
- $this->fail('Cannot create a field with no type.');
+ $this->fail(t('Cannot create a field with no type.'));
}
catch (FieldException $e) {
- $this->pass('Cannot create a field with no type.');
+ $this->pass(t('Cannot create a field with no type.'));
}
// Check that field name is required.
@@ -1822,10 +1822,10 @@ class FieldCrudTestCase extends FieldTestCase {
'type' => 'test_field'
);
field_create_field($field_definition);
- $this->fail('Cannot create an unnamed field.');
+ $this->fail(t('Cannot create an unnamed field.'));
}
catch (FieldException $e) {
- $this->pass('Cannot create an unnamed field.');
+ $this->pass(t('Cannot create an unnamed field.'));
}
// Check that field name must start with a letter or _.
@@ -1835,10 +1835,10 @@ class FieldCrudTestCase extends FieldTestCase {
'type' => 'test_field',
);
field_create_field($field_definition);
- $this->fail('Cannot create a field with a name starting with a digit.');
+ $this->fail(t('Cannot create a field with a name starting with a digit.'));
}
catch (FieldException $e) {
- $this->pass('Cannot create a field with a name starting with a digit.');
+ $this->pass(t('Cannot create a field with a name starting with a digit.'));
}
// Check that field name must only contain lowercase alphanumeric or _.
@@ -1848,10 +1848,10 @@ class FieldCrudTestCase extends FieldTestCase {
'type' => 'test_field',
);
field_create_field($field_definition);
- $this->fail('Cannot create a field with a name containing an illegal character.');
+ $this->fail(t('Cannot create a field with a name containing an illegal character.'));
}
catch (FieldException $e) {
- $this->pass('Cannot create a field with a name containing an illegal character.');
+ $this->pass(t('Cannot create a field with a name containing an illegal character.'));
}
// Check that field name cannot be longer than 32 characters long.
@@ -1861,10 +1861,10 @@ class FieldCrudTestCase extends FieldTestCase {
'type' => 'test_field',
);
field_create_field($field_definition);
- $this->fail('Cannot create a field with a name longer than 32 characters.');
+ $this->fail(t('Cannot create a field with a name longer than 32 characters.'));
}
catch (FieldException $e) {
- $this->pass('Cannot create a field with a name longer than 32 characters.');
+ $this->pass(t('Cannot create a field with a name longer than 32 characters.'));
}
// Check that field name can not be an entity key.
@@ -1875,10 +1875,10 @@ class FieldCrudTestCase extends FieldTestCase {
'field_name' => 'ftvid',
);
$field = field_create_field($field_definition);
- $this->fail('Cannot create a field bearing the name of an entity key.');
+ $this->fail(t('Cannot create a field bearing the name of an entity key.'));
}
catch (FieldException $e) {
- $this->pass('Cannot create a field bearing the name of an entity key.');
+ $this->pass(t('Cannot create a field bearing the name of an entity key.'));
}
}
@@ -1920,7 +1920,7 @@ class FieldCrudTestCase extends FieldTestCase {
// Read the field back.
$field = field_read_field($field_definition['field_name']);
- $this->assertTrue($field_definition < $field, 'The field was properly read.');
+ $this->assertTrue($field_definition < $field, t('The field was properly read.'));
}
/**
@@ -1935,7 +1935,7 @@ class FieldCrudTestCase extends FieldTestCase {
field_create_field($field_definition);
$field = field_read_field($field_definition['field_name']);
$expected_indexes = array('value' => array('value'));
- $this->assertEqual($field['indexes'], $expected_indexes, 'Field type indexes saved by default');
+ $this->assertEqual($field['indexes'], $expected_indexes, t('Field type indexes saved by default'));
// Check that indexes specified by the field definition override the field
// type indexes.
@@ -1949,7 +1949,7 @@ class FieldCrudTestCase extends FieldTestCase {
field_create_field($field_definition);
$field = field_read_field($field_definition['field_name']);
$expected_indexes = array('value' => array());
- $this->assertEqual($field['indexes'], $expected_indexes, 'Field definition indexes override field type indexes');
+ $this->assertEqual($field['indexes'], $expected_indexes, t('Field definition indexes override field type indexes'));
// Check that indexes specified by the field definition add to the field
// type indexes.
@@ -1963,7 +1963,7 @@ class FieldCrudTestCase extends FieldTestCase {
field_create_field($field_definition);
$field = field_read_field($field_definition['field_name']);
$expected_indexes = array('value' => array('value'), 'value_2' => array('value'));
- $this->assertEqual($field['indexes'], $expected_indexes, 'Field definition indexes are merged with field type indexes');
+ $this->assertEqual($field['indexes'], $expected_indexes, t('Field definition indexes are merged with field type indexes'));
}
/**
@@ -1994,41 +1994,41 @@ class FieldCrudTestCase extends FieldTestCase {
// Test that the first field is not deleted, and then delete it.
$field = field_read_field($this->field['field_name'], array('include_deleted' => TRUE));
- $this->assertTrue(!empty($field) && empty($field['deleted']), 'A new field is not marked for deletion.');
+ $this->assertTrue(!empty($field) && empty($field['deleted']), t('A new field is not marked for deletion.'));
field_delete_field($this->field['field_name']);
// Make sure that the field is marked as deleted when it is specifically
// loaded.
$field = field_read_field($this->field['field_name'], array('include_deleted' => TRUE));
- $this->assertTrue(!empty($field['deleted']), 'A deleted field is marked for deletion.');
+ $this->assertTrue(!empty($field['deleted']), t('A deleted field is marked for deletion.'));
// Make sure that this field's instance is marked as deleted when it is
// specifically loaded.
$instance = field_read_instance('test_entity', $this->instance_definition['field_name'], $this->instance_definition['bundle'], array('include_deleted' => TRUE));
- $this->assertTrue(!empty($instance['deleted']), 'An instance for a deleted field is marked for deletion.');
+ $this->assertTrue(!empty($instance['deleted']), t('An instance for a deleted field is marked for deletion.'));
// Try to load the field normally and make sure it does not show up.
$field = field_read_field($this->field['field_name']);
- $this->assertTrue(empty($field), 'A deleted field is not loaded by default.');
+ $this->assertTrue(empty($field), t('A deleted field is not loaded by default.'));
// Try to load the instance normally and make sure it does not show up.
$instance = field_read_instance('test_entity', $this->instance_definition['field_name'], $this->instance_definition['bundle']);
- $this->assertTrue(empty($instance), 'An instance for a deleted field is not loaded by default.');
+ $this->assertTrue(empty($instance), t('An instance for a deleted field is not loaded by default.'));
// Make sure the other field (and its field instance) are not deleted.
$another_field = field_read_field($this->another_field['field_name']);
- $this->assertTrue(!empty($another_field) && empty($another_field['deleted']), 'A non-deleted field is not marked for deletion.');
+ $this->assertTrue(!empty($another_field) && empty($another_field['deleted']), t('A non-deleted field is not marked for deletion.'));
$another_instance = field_read_instance('test_entity', $this->another_instance_definition['field_name'], $this->another_instance_definition['bundle']);
- $this->assertTrue(!empty($another_instance) && empty($another_instance['deleted']), 'An instance of a non-deleted field is not marked for deletion.');
+ $this->assertTrue(!empty($another_instance) && empty($another_instance['deleted']), t('An instance of a non-deleted field is not marked for deletion.'));
// Try to create a new field the same name as a deleted field and
// write data into it.
field_create_field($this->field);
field_create_instance($this->instance_definition);
$field = field_read_field($this->field['field_name']);
- $this->assertTrue(!empty($field) && empty($field['deleted']), 'A new field with a previously used name is created.');
+ $this->assertTrue(!empty($field) && empty($field['deleted']), t('A new field with a previously used name is created.'));
$instance = field_read_instance('test_entity', $this->instance_definition['field_name'], $this->instance_definition['bundle']);
- $this->assertTrue(!empty($instance) && empty($instance['deleted']), 'A new instance for a previously used field name is created.');
+ $this->assertTrue(!empty($instance) && empty($instance['deleted']), t('A new instance for a previously used field name is created.'));
// Save an entity with data for the field
$entity = field_test_create_stub_entity(0, 0, $instance['bundle']);
@@ -2051,10 +2051,10 @@ class FieldCrudTestCase extends FieldTestCase {
$test_field = array('field_name' => 'does_not_exist', 'type' => 'number_decimal');
try {
field_update_field($test_field);
- $this->fail('Cannot update a field that does not exist.');
+ $this->fail(t('Cannot update a field that does not exist.'));
}
catch (FieldException $e) {
- $this->pass('Cannot update a field that does not exist.');
+ $this->pass(t('Cannot update a field that does not exist.'));
}
}
@@ -2065,10 +2065,10 @@ class FieldCrudTestCase extends FieldTestCase {
$test_field = array('field_name' => 'field_type', 'type' => 'number_integer');
try {
field_update_field($test_field);
- $this->fail('Cannot update a field to a different type.');
+ $this->fail(t('Cannot update a field to a different type.'));
}
catch (FieldException $e) {
- $this->pass('Cannot update a field to a different type.');
+ $this->pass(t('Cannot update a field to a different type.'));
}
}
@@ -2126,18 +2126,18 @@ class FieldCrudTestCase extends FieldTestCase {
$field['settings']['changeable']++;
try {
field_update_field($field);
- $this->pass("A changeable setting can be updated.");
+ $this->pass(t("A changeable setting can be updated."));
}
catch (FieldException $e) {
- $this->fail("An unchangeable setting cannot be updated.");
+ $this->fail(t("An unchangeable setting cannot be updated."));
}
$field['settings']['unchangeable']++;
try {
field_update_field($field);
- $this->fail("An unchangeable setting can be updated.");
+ $this->fail(t("An unchangeable setting can be updated."));
}
catch (FieldException $e) {
- $this->pass("An unchangeable setting cannot be updated.");
+ $this->pass(t("An unchangeable setting cannot be updated."));
}
}
@@ -2181,18 +2181,18 @@ class FieldCrudTestCase extends FieldTestCase {
// Read the field.
$field = field_read_field($field_name);
- $this->assertTrue($field_definition <= $field, 'The field was properly read.');
+ $this->assertTrue($field_definition <= $field, t('The field was properly read.'));
module_disable($modules, FALSE);
$fields = field_read_fields(array('field_name' => $field_name), array('include_inactive' => TRUE));
- $this->assertTrue(isset($fields[$field_name]) && $field_definition < $field, 'The field is properly read when explicitly fetching inactive fields.');
+ $this->assertTrue(isset($fields[$field_name]) && $field_definition < $field, t('The field is properly read when explicitly fetching inactive fields.'));
// Re-enable modules one by one, and check that the field is still inactive
// while some modules remain disabled.
while ($modules) {
$field = field_read_field($field_name);
- $this->assertTrue(empty($field), implode(', ', $modules) . ' disabled. The field is marked inactive.');
+ $this->assertTrue(empty($field), t('%modules disabled. The field is marked inactive.', array('%modules' => implode(', ', $modules))));
$module = array_shift($modules);
module_enable(array($module), FALSE);
@@ -2201,7 +2201,7 @@ class FieldCrudTestCase extends FieldTestCase {
// Check that the field is active again after all modules have been
// enabled.
$field = field_read_field($field_name);
- $this->assertTrue($field_definition <= $field, 'The field was was marked active.');
+ $this->assertTrue($field_definition <= $field, t('The field was was marked active.'));
}
}
@@ -2253,35 +2253,35 @@ class FieldInstanceCrudTestCase extends FieldTestCase {
$formatter_type = field_info_formatter_types($field_type['default_formatter']);
// Check that default values are set.
- $this->assertIdentical($record['data']['required'], FALSE, 'Required defaults to false.');
- $this->assertIdentical($record['data']['label'], $this->instance_definition['field_name'], 'Label defaults to field name.');
- $this->assertIdentical($record['data']['description'], '', 'Description defaults to empty string.');
- $this->assertIdentical($record['data']['widget']['type'], $field_type['default_widget'], 'Default widget has been written.');
- $this->assertTrue(isset($record['data']['display']['default']), 'Display for "full" view_mode has been written.');
- $this->assertIdentical($record['data']['display']['default']['type'], $field_type['default_formatter'], 'Default formatter for "full" view_mode has been written.');
+ $this->assertIdentical($record['data']['required'], FALSE, t('Required defaults to false.'));
+ $this->assertIdentical($record['data']['label'], $this->instance_definition['field_name'], t('Label defaults to field name.'));
+ $this->assertIdentical($record['data']['description'], '', t('Description defaults to empty string.'));
+ $this->assertIdentical($record['data']['widget']['type'], $field_type['default_widget'], t('Default widget has been written.'));
+ $this->assertTrue(isset($record['data']['display']['default']), t('Display for "full" view_mode has been written.'));
+ $this->assertIdentical($record['data']['display']['default']['type'], $field_type['default_formatter'], t('Default formatter for "full" view_mode has been written.'));
// Check that default settings are set.
- $this->assertIdentical($record['data']['settings'], $field_type['instance_settings'], 'Default instance settings have been written.');
- $this->assertIdentical($record['data']['widget']['settings'], $widget_type['settings'], 'Default widget settings have been written.');
- $this->assertIdentical($record['data']['display']['default']['settings'], $formatter_type['settings'], 'Default formatter settings for "full" view_mode have been written.');
+ $this->assertIdentical($record['data']['settings'], $field_type['instance_settings'] , t('Default instance settings have been written.'));
+ $this->assertIdentical($record['data']['widget']['settings'], $widget_type['settings'] , t('Default widget settings have been written.'));
+ $this->assertIdentical($record['data']['display']['default']['settings'], $formatter_type['settings'], t('Default formatter settings for "full" view_mode have been written.'));
// Guarantee that the field/bundle combination is unique.
try {
field_create_instance($this->instance_definition);
- $this->fail('Cannot create two instances with the same field / bundle combination.');
+ $this->fail(t('Cannot create two instances with the same field / bundle combination.'));
}
catch (FieldException $e) {
- $this->pass('Cannot create two instances with the same field / bundle combination.');
+ $this->pass(t('Cannot create two instances with the same field / bundle combination.'));
}
// Check that the specified field exists.
try {
$this->instance_definition['field_name'] = $this->randomName();
field_create_instance($this->instance_definition);
- $this->fail('Cannot create an instance of a non-existing field.');
+ $this->fail(t('Cannot create an instance of a non-existing field.'));
}
catch (FieldException $e) {
- $this->pass('Cannot create an instance of a non-existing field.');
+ $this->pass(t('Cannot create an instance of a non-existing field.'));
}
// Create a field restricted to a specific entity type.
@@ -2299,10 +2299,10 @@ class FieldInstanceCrudTestCase extends FieldTestCase {
$instance['field_name'] = $field_restricted['field_name'];
$instance['entity_type'] = 'test_cacheable_entity';
field_create_instance($instance);
- $this->pass('Can create an instance on an entity type allowed by the field.');
+ $this->pass(t('Can create an instance on an entity type allowed by the field.'));
}
catch (FieldException $e) {
- $this->fail('Can create an instance on an entity type allowed by the field.');
+ $this->fail(t('Can create an instance on an entity type allowed by the field.'));
}
// Check that an instance cannot be added to an entity type
@@ -2311,10 +2311,10 @@ class FieldInstanceCrudTestCase extends FieldTestCase {
$instance = $this->instance_definition;
$instance['field_name'] = $field_restricted['field_name'];
field_create_instance($instance);
- $this->fail('Cannot create an instance on an entity type forbidden by the field.');
+ $this->fail(t('Cannot create an instance on an entity type forbidden by the field.'));
}
catch (FieldException $e) {
- $this->pass('Cannot create an instance on an entity type forbidden by the field.');
+ $this->pass(t('Cannot create an instance on an entity type forbidden by the field.'));
}
// TODO: test other failures.
@@ -2328,7 +2328,7 @@ class FieldInstanceCrudTestCase extends FieldTestCase {
// Read the instance back.
$instance = field_read_instance('test_entity', $this->instance_definition['field_name'], $this->instance_definition['bundle']);
- $this->assertTrue($this->instance_definition < $instance, 'The field was properly read.');
+ $this->assertTrue($this->instance_definition < $instance, t('The field was properly read.'));
}
/**
@@ -2344,20 +2344,20 @@ class FieldInstanceCrudTestCase extends FieldTestCase {
$instance['label'] = $this->randomName();
$instance['description'] = $this->randomName();
$instance['settings']['test_instance_setting'] = $this->randomName();
- $instance['widget']['settings']['test_widget_setting'] = $this->randomName();
+ $instance['widget']['settings']['test_widget_setting'] =$this->randomName();
$instance['widget']['weight']++;
$instance['display']['default']['settings']['test_formatter_setting'] = $this->randomName();
$instance['display']['default']['weight']++;
field_update_instance($instance);
$instance_new = field_read_instance('test_entity', $this->instance_definition['field_name'], $this->instance_definition['bundle']);
- $this->assertEqual($instance['required'], $instance_new['required'], '"required" change is saved');
- $this->assertEqual($instance['label'], $instance_new['label'], '"label" change is saved');
- $this->assertEqual($instance['description'], $instance_new['description'], '"description" change is saved');
- $this->assertEqual($instance['widget']['settings']['test_widget_setting'], $instance_new['widget']['settings']['test_widget_setting'], 'Widget setting change is saved');
- $this->assertEqual($instance['widget']['weight'], $instance_new['widget']['weight'], 'Widget weight change is saved');
- $this->assertEqual($instance['display']['default']['settings']['test_formatter_setting'], $instance_new['display']['default']['settings']['test_formatter_setting'], 'Formatter setting change is saved');
- $this->assertEqual($instance['display']['default']['weight'], $instance_new['display']['default']['weight'], 'Widget weight change is saved');
+ $this->assertEqual($instance['required'], $instance_new['required'], t('"required" change is saved'));
+ $this->assertEqual($instance['label'], $instance_new['label'], t('"label" change is saved'));
+ $this->assertEqual($instance['description'], $instance_new['description'], t('"description" change is saved'));
+ $this->assertEqual($instance['widget']['settings']['test_widget_setting'], $instance_new['widget']['settings']['test_widget_setting'], t('Widget setting change is saved'));
+ $this->assertEqual($instance['widget']['weight'], $instance_new['widget']['weight'], t('Widget weight change is saved'));
+ $this->assertEqual($instance['display']['default']['settings']['test_formatter_setting'], $instance_new['display']['default']['settings']['test_formatter_setting'], t('Formatter setting change is saved'));
+ $this->assertEqual($instance['display']['default']['weight'], $instance_new['display']['default']['weight'], t('Widget weight change is saved'));
// Check that changing widget and formatter types updates the default settings.
$instance = field_read_instance('test_entity', $this->instance_definition['field_name'], $this->instance_definition['bundle']);
@@ -2366,13 +2366,13 @@ class FieldInstanceCrudTestCase extends FieldTestCase {
field_update_instance($instance);
$instance_new = field_read_instance('test_entity', $this->instance_definition['field_name'], $this->instance_definition['bundle']);
- $this->assertEqual($instance['widget']['type'], $instance_new['widget']['type'], 'Widget type change is saved.');
+ $this->assertEqual($instance['widget']['type'], $instance_new['widget']['type'] , t('Widget type change is saved.'));
$settings = field_info_widget_settings($instance_new['widget']['type']);
- $this->assertIdentical($settings, array_intersect_key($instance_new['widget']['settings'], $settings), 'Widget type change updates default settings.');
- $this->assertEqual($instance['display']['default']['type'], $instance_new['display']['default']['type'], 'Formatter type change is saved.');
+ $this->assertIdentical($settings, array_intersect_key($instance_new['widget']['settings'], $settings) , t('Widget type change updates default settings.'));
+ $this->assertEqual($instance['display']['default']['type'], $instance_new['display']['default']['type'] , t('Formatter type change is saved.'));
$info = field_info_formatter_types($instance_new['display']['default']['type']);
$settings = $info['settings'];
- $this->assertIdentical($settings, array_intersect_key($instance_new['display']['default']['settings'], $settings), 'Changing formatter type updates default settings.');
+ $this->assertIdentical($settings, array_intersect_key($instance_new['display']['default']['settings'], $settings) , t('Changing formatter type updates default settings.'));
// Check that adding a new view mode is saved and gets default settings.
$instance = field_read_instance('test_entity', $this->instance_definition['field_name'], $this->instance_definition['bundle']);
@@ -2380,11 +2380,11 @@ class FieldInstanceCrudTestCase extends FieldTestCase {
field_update_instance($instance);
$instance_new = field_read_instance('test_entity', $this->instance_definition['field_name'], $this->instance_definition['bundle']);
- $this->assertTrue(isset($instance_new['display']['teaser']), 'Display for the new view_mode has been written.');
- $this->assertIdentical($instance_new['display']['teaser']['type'], $field_type['default_formatter'], 'Default formatter for the new view_mode has been written.');
+ $this->assertTrue(isset($instance_new['display']['teaser']), t('Display for the new view_mode has been written.'));
+ $this->assertIdentical($instance_new['display']['teaser']['type'], $field_type['default_formatter'], t('Default formatter for the new view_mode has been written.'));
$info = field_info_formatter_types($instance_new['display']['teaser']['type']);
$settings = $info['settings'];
- $this->assertIdentical($settings, $instance_new['display']['teaser']['settings'], 'Default formatter settings for the new view_mode have been written.');
+ $this->assertIdentical($settings, $instance_new['display']['teaser']['settings'] , t('Default formatter settings for the new view_mode have been written.'));
// TODO: test failures.
}
@@ -2406,21 +2406,21 @@ class FieldInstanceCrudTestCase extends FieldTestCase {
// Test that the first instance is not deleted, and then delete it.
$instance = field_read_instance('test_entity', $this->instance_definition['field_name'], $this->instance_definition['bundle'], array('include_deleted' => TRUE));
- $this->assertTrue(!empty($instance) && empty($instance['deleted']), 'A new field instance is not marked for deletion.');
+ $this->assertTrue(!empty($instance) && empty($instance['deleted']), t('A new field instance is not marked for deletion.'));
field_delete_instance($instance);
// Make sure the instance is marked as deleted when the instance is
// specifically loaded.
$instance = field_read_instance('test_entity', $this->instance_definition['field_name'], $this->instance_definition['bundle'], array('include_deleted' => TRUE));
- $this->assertTrue(!empty($instance['deleted']), 'A deleted field instance is marked for deletion.');
+ $this->assertTrue(!empty($instance['deleted']), t('A deleted field instance is marked for deletion.'));
// Try to load the instance normally and make sure it does not show up.
$instance = field_read_instance('test_entity', $this->instance_definition['field_name'], $this->instance_definition['bundle']);
- $this->assertTrue(empty($instance), 'A deleted field instance is not loaded by default.');
+ $this->assertTrue(empty($instance), t('A deleted field instance is not loaded by default.'));
// Make sure the other field instance is not deleted.
$another_instance = field_read_instance('test_entity', $this->another_instance_definition['field_name'], $this->another_instance_definition['bundle']);
- $this->assertTrue(!empty($another_instance) && empty($another_instance['deleted']), 'A non-deleted field instance is not marked for deletion.');
+ $this->assertTrue(!empty($another_instance) && empty($another_instance['deleted']), t('A non-deleted field instance is not marked for deletion.'));
}
}
@@ -2487,17 +2487,17 @@ class FieldTranslationsTestCase extends FieldTestCase {
$available_languages = field_available_languages($this->entity_type, $this->field);
foreach ($available_languages as $delta => $langcode) {
if ($langcode != 'xx' && $langcode != 'en') {
- $this->assertTrue(in_array($langcode, $enabled_languages), $langcode . ' is an enabled language.');
+ $this->assertTrue(in_array($langcode, $enabled_languages), t('%language is an enabled language.', array('%language' => $langcode)));
}
}
- $this->assertTrue(in_array('xx', $available_languages), 'xx' . ' was made available.');
- $this->assertFalse(in_array('en', $available_languages), 'en' . ' was made unavailable.');
+ $this->assertTrue(in_array('xx', $available_languages), t('%language was made available.', array('%language' => 'xx')));
+ $this->assertFalse(in_array('en', $available_languages), t('%language was made unavailable.', array('%language' => 'en')));
// Test field_available_languages() behavior for untranslatable fields.
$this->field['translatable'] = FALSE;
$this->field_name = $this->field['field_name'] = $this->instance['field_name'] = drupal_strtolower($this->randomName() . '_field_name');
$available_languages = field_available_languages($this->entity_type, $this->field);
- $this->assertTrue(count($available_languages) == 1 && $available_languages[0] === LANGUAGE_NONE, 'For untranslatable fields only LANGUAGE_NONE is available.');
+ $this->assertTrue(count($available_languages) == 1 && $available_languages[0] === LANGUAGE_NONE, t('For untranslatable fields only LANGUAGE_NONE is available.'));
}
/**
@@ -2529,9 +2529,9 @@ class FieldTranslationsTestCase extends FieldTestCase {
$hash = hash('sha256', serialize(array($entity_type, $entity, $this->field_name, $langcode, $values[$langcode])));
// Check whether the parameters passed to _field_invoke() were correctly
// forwarded to the callback function.
- $this->assertEqual($hash, $result, 'The result for ' . $langcode . ' is correctly stored.');
+ $this->assertEqual($hash, $result, t('The result for %language is correctly stored.', array('%language' => $langcode)));
}
- $this->assertEqual(count($results), count($available_languages), 'No unavailable language has been processed.');
+ $this->assertEqual(count($results), count($available_languages), t('No unavailable language has been processed.'));
}
/**
@@ -2571,9 +2571,9 @@ class FieldTranslationsTestCase extends FieldTestCase {
$hash = hash('sha256', serialize(array($entity_type, $entities[$id], $this->field_name, $langcode, $values[$id][$langcode])));
// Check whether the parameters passed to _field_invoke() were correctly
// forwarded to the callback function.
- $this->assertEqual($hash, $result, 'The result for entity ' . $id . '/' . $langcode . ' is correctly stored.');
+ $this->assertEqual($hash, $result, t('The result for entity %id/%language is correctly stored.', array('%id' => $id, '%language' => $langcode)));
}
- $this->assertEqual(count($results), count($available_languages), 'No unavailable language has been processed for entity ' . $id . '.');
+ $this->assertEqual(count($results), count($available_languages), t('No unavailable language has been processed for entity %id.', array('%id' => $id)));
}
}
@@ -2584,7 +2584,7 @@ class FieldTranslationsTestCase extends FieldTestCase {
// Enable field translations for nodes.
field_test_entity_info_translatable('node', TRUE);
$entity_info = entity_get_info('node');
- $this->assertTrue(count($entity_info['translation']), 'Nodes are translatable.');
+ $this->assertTrue(count($entity_info['translation']), t('Nodes are translatable.'));
// Prepare the field translations.
field_test_entity_info_translatable('test_entity', TRUE);
@@ -2593,7 +2593,7 @@ class FieldTranslationsTestCase extends FieldTestCase {
$entity = field_test_create_stub_entity($eid, $evid, $this->instance['bundle']);
$field_translations = array();
$available_languages = field_available_languages($entity_type, $this->field);
- $this->assertTrue(count($available_languages) > 1, 'Field is translatable.');
+ $this->assertTrue(count($available_languages) > 1, t('Field is translatable.'));
foreach ($available_languages as $langcode) {
$field_translations[$langcode] = $this->_generateTestFieldValues($this->field['cardinality']);
}
@@ -2610,7 +2610,7 @@ class FieldTranslationsTestCase extends FieldTestCase {
foreach ($items as $delta => $item) {
$result = $result && $item['value'] == $entity->{$this->field_name}[$langcode][$delta]['value'];
}
- $this->assertTrue($result, $langcode . ' translation correctly handled.');
+ $this->assertTrue($result, t('%language translation correctly handled.', array('%language' => $langcode)));
}
}
@@ -2654,7 +2654,8 @@ class FieldTranslationsTestCase extends FieldTestCase {
// Index 0 is reserved for the requested language, this way we ensure
// that no field is actually populated with it.
$langcode = $enabled_languages[mt_rand(1, count($enabled_languages) - 1)];
- } while (isset($languages[$langcode]));
+ }
+ while (isset($languages[$langcode]));
$languages[$langcode] = TRUE;
$entity->{$field_name}[$langcode] = $this->_generateTestFieldValues($field['cardinality']);
}
@@ -2666,7 +2667,7 @@ class FieldTranslationsTestCase extends FieldTestCase {
$display_language = field_language($entity_type, $entity, NULL, $requested_language);
foreach ($instances as $instance) {
$field_name = $instance['field_name'];
- $this->assertTrue($display_language[$field_name] == LANGUAGE_NONE, 'The display language for field ' . $field_name . ' is ' . LANGUAGE_NONE . '.');
+ $this->assertTrue($display_language[$field_name] == LANGUAGE_NONE, t('The display language for field %field_name is %language.', array('%field_name' => $field_name, '%language' => LANGUAGE_NONE)));
}
// Test multiple-fields display languages for translatable entities.
@@ -2680,13 +2681,13 @@ class FieldTranslationsTestCase extends FieldTestCase {
// As the requested language was not assinged to any field, if the
// returned language is defined for the current field, core fallback rules
// were successfully applied.
- $this->assertTrue(isset($entity->{$field_name}[$langcode]) && $langcode != $requested_language, 'The display language for the field ' . $field_name . ' is ' . $langcode . '.');
+ $this->assertTrue(isset($entity->{$field_name}[$langcode]) && $langcode != $requested_language, t('The display language for the field %field_name is %language.', array('%field_name' => $field_name, '%language' => $langcode)));
}
// Test single-field display language.
drupal_static_reset('field_language');
$langcode = field_language($entity_type, $entity, $this->field_name, $requested_language);
- $this->assertTrue(isset($entity->{$this->field_name}[$langcode]) && $langcode != $requested_language, 'The display language for the (single) field ' . $field_name . ' is ' . $langcode . '.');
+ $this->assertTrue(isset($entity->{$this->field_name}[$langcode]) && $langcode != $requested_language, t('The display language for the (single) field %field_name is %language.', array('%field_name' => $field_name, '%language' => $langcode)));
}
/**
@@ -2730,7 +2731,7 @@ class FieldTranslationsTestCase extends FieldTestCase {
$entity = field_test_entity_test_load($eid, $evid);
foreach ($available_languages as $langcode => $value) {
$passed = isset($entity->{$field_name}[$langcode]) && $entity->{$field_name}[$langcode][0]['value'] == $value + 1;
- $this->assertTrue($passed, 'The ' . $langcode . ' translation for revision ' . $entity->ftvid . ' was correctly stored');
+ $this->assertTrue($passed, t('The @language translation for revision @revision was correctly stored', array('@language' => $langcode, '@revision' => $entity->ftvid)));
}
}
}
@@ -2744,7 +2745,7 @@ class FieldBulkDeleteTestCase extends FieldTestCase {
public static function getInfo() {
return array(
'name' => 'Field bulk delete tests',
- 'description' => 'Bulk delete fields and instances, and clean up afterwards.',
+ 'description'=> 'Bulk delete fields and instances, and clean up afterwards.',
'group' => 'Field API',
);
}
@@ -2925,7 +2926,7 @@ class FieldBulkDeleteTestCase extends FieldTestCase {
$this->assertEqual($stubs[$entity->ftid], $entity, 'hook_field_delete() called with the correct stub');
unset($stubs[$entity->ftid]);
}
- $this->assertEqual(count($stubs), $count -10, 'hook_field_delete was called with each entity once');
+ $this->assertEqual(count($stubs), $count-10, 'hook_field_delete was called with each entity once');
// The instance still exists, deleted.
$instances = field_read_instances(array('field_id' => $field['id'], 'deleted' => 1), array('include_deleted' => 1, 'include_inactive' => 1));
diff --git a/modules/field_ui/field_ui.test b/modules/field_ui/field_ui.test
index 2274b75de..5baaa341a 100644
--- a/modules/field_ui/field_ui.test
+++ b/modules/field_ui/field_ui.test
@@ -10,7 +10,7 @@
* Field UI tests.
*/
class FieldUITestCase extends DrupalWebTestCase {
- public static function getInfo() {
+ public static function getInfo() {
return array(
'name' => 'Field UI tests',
'description' => 'Test the field UI functionality.',
@@ -26,7 +26,7 @@ class FieldUITestCase extends DrupalWebTestCase {
$this->drupalLogin($admin_user);
// Create content type, with underscores.
- $type_name = strtolower($this->randomName(8)) . '_' . 'test';
+ $type_name = strtolower($this->randomName(8)) . '_' .'test';
$type = $this->drupalCreateContentType(array('name' => $type_name, 'type' => $type_name));
$this->type = $type->type;
// Store a valid URL name, with hyphens instead of underscores.
@@ -35,7 +35,7 @@ class FieldUITestCase extends DrupalWebTestCase {
// Create random field name.
$this->field_label = $this->randomName(8);
$this->field_name_input = strtolower($this->randomName(8));
- $this->field_name = 'field_' . $this->field_name_input;
+ $this->field_name = 'field_'. $this->field_name_input;
}
/**
@@ -66,13 +66,13 @@ class FieldUITestCase extends DrupalWebTestCase {
);
foreach ($table_headers as $table_header) {
// We check that the label appear in the table headings.
- $this->assertRaw($table_header . '</th>', $table_header . ' table header was found.');
+ $this->assertRaw($table_header . '</th>', t('%table_header table header was found.', array('%table_header' => $table_header)));
}
// "Add new field" and "Add existing field" aren't a table heading so just
// test the text.
foreach (array('Add new field', 'Add existing field') as $element) {
- $this->assertText($element, '"' . $element . '" was found.');
+ $this->assertText($element, t('"@element" was found.', array('@element' => $element)));
}
}
@@ -95,7 +95,7 @@ class FieldUITestCase extends DrupalWebTestCase {
// should also appear in the 'taxonomy term' entity.
$vocabulary = taxonomy_vocabulary_load(1);
$this->drupalGet('admin/structure/taxonomy/' . $vocabulary->machine_name . '/fields');
- $this->assertTrue($this->xpath('//select[@name="_add_existing_field[field_name]"]//option[@value="' . $this->field_name . '"]'), 'Existing field was found in account settings.');
+ $this->assertTrue($this->xpath('//select[@name="_add_existing_field[field_name]"]//option[@value="' . $this->field_name . '"]'), t('Existing field was found in account settings.'));
}
/**
@@ -118,7 +118,7 @@ class FieldUITestCase extends DrupalWebTestCase {
$this->assertFieldSettings($this->type, $this->field_name, $string);
// Assert redirection back to the "manage fields" page.
- $this->assertText(t('Saved @label configuration.', array('@label' => $this->field_label)), 'Redirected to "Manage fields" page.');
+ $this->assertText(t('Saved @label configuration.', array('@label' => $this->field_label)), t('Redirected to "Manage fields" page.'));
}
/**
@@ -127,12 +127,12 @@ class FieldUITestCase extends DrupalWebTestCase {
function addExistingField() {
// Check "Add existing field" appears.
$this->drupalGet('admin/structure/types/manage/page/fields');
- $this->assertRaw(t('Add existing field'), '"Add existing field" was found.');
+ $this->assertRaw(t('Add existing field'), t('"Add existing field" was found.'));
// Check that the list of options respects entity type restrictions on
// fields. The 'comment' field is restricted to the 'comment' entity type
// and should not appear in the list.
- $this->assertFalse($this->xpath('//select[@id="edit--add-existing-field-field-name"]//option[@value="comment"]'), 'The list of options respects entity type restrictions.');
+ $this->assertFalse($this->xpath('//select[@id="edit--add-existing-field-field-name"]//option[@value="comment"]'), t('The list of options respects entity type restrictions.'));
// Add a new field based on an existing field.
$edit = array(
@@ -159,12 +159,12 @@ class FieldUITestCase extends DrupalWebTestCase {
_field_info_collate_fields(TRUE);
// Assert field settings.
$field = field_info_field($field_name);
- $this->assertTrue($field['settings']['test_field_setting'] == $string, 'Field settings were found.');
+ $this->assertTrue($field['settings']['test_field_setting'] == $string, t('Field settings were found.'));
// Assert instance and widget settings.
$instance = field_info_instance($entity_type, $field_name, $bundle);
- $this->assertTrue($instance['settings']['test_instance_setting'] == $string, 'Field instance settings were found.');
- $this->assertTrue($instance['widget']['settings']['test_widget_setting'] == $string, 'Field widget settings were found.');
+ $this->assertTrue($instance['settings']['test_instance_setting'] == $string, t('Field instance settings were found.'));
+ $this->assertTrue($instance['widget']['settings']['test_widget_setting'] == $string, t('Field widget settings were found.'));
}
/**
@@ -190,31 +190,31 @@ class FieldUITestCase extends DrupalWebTestCase {
$element_id = "edit-$field_name-$langcode-0-value";
$element_name = "{$field_name}[$langcode][0][value]";
$this->drupalGet($admin_path);
- $this->assertFieldById($element_id, '', 'The default value widget was empty.');
+ $this->assertFieldById($element_id, '', t('The default value widget was empty.'));
// Check that invalid default values are rejected.
$edit = array($element_name => '-1');
$this->drupalPost($admin_path, $edit, t('Save settings'));
- $this->assertText("$field_name does not accept the value -1", 'Form vaildation failed.');
+ $this->assertText("$field_name does not accept the value -1", t('Form vaildation failed.'));
// Check that the default value is saved.
$edit = array($element_name => '1');
$this->drupalPost($admin_path, $edit, t('Save settings'));
- $this->assertText("Saved $field_name configuration", 'The form was successfully submitted.');
+ $this->assertText("Saved $field_name configuration", t('The form was successfully submitted.'));
$instance = field_info_instance('node', $field_name, $this->type);
- $this->assertEqual($instance['default_value'], array(array('value' => 1)), 'The default value was correctly saved.');
+ $this->assertEqual($instance['default_value'], array(array('value' => 1)), t('The default value was correctly saved.'));
// Check that the default value shows up in the form
$this->drupalGet($admin_path);
- $this->assertFieldById($element_id, '1', 'The default value widget was displayed with the correct value.');
+ $this->assertFieldById($element_id, '1', t('The default value widget was displayed with the correct value.'));
// Check that the default value can be emptied.
$edit = array($element_name => '');
$this->drupalPost(NULL, $edit, t('Save settings'));
- $this->assertText("Saved $field_name configuration", 'The form was successfully submitted.');
+ $this->assertText("Saved $field_name configuration", t('The form was successfully submitted.'));
field_info_cache_clear();
$instance = field_info_instance('node', $field_name, $this->type);
- $this->assertEqual($instance['default_value'], NULL, 'The default value was correctly saved.');
+ $this->assertEqual($instance['default_value'], NULL, t('The default value was correctly saved.'));
}
/**
@@ -230,7 +230,7 @@ class FieldUITestCase extends DrupalWebTestCase {
$this->fieldUIAddNewField($bundle_path1, $edit1);
// Create an additional node type.
- $type_name2 = strtolower($this->randomName(8)) . '_' . 'test';
+ $type_name2 = strtolower($this->randomName(8)) . '_' .'test';
$type2 = $this->drupalCreateContentType(array('name' => $type_name2, 'type' => $type_name2));
$type_name2 = $type2->type;
$hyphen_type2 = str_replace('_', '-', $type_name2);
@@ -249,9 +249,9 @@ class FieldUITestCase extends DrupalWebTestCase {
// Reset the fields info.
_field_info_collate_fields(TRUE);
// Check that the field instance was deleted.
- $this->assertNull(field_info_instance('node', $this->field_name, $this->type), 'Field instance was deleted.');
+ $this->assertNull(field_info_instance('node', $this->field_name, $this->type), t('Field instance was deleted.'));
// Check that the field was not deleted
- $this->assertNotNull(field_info_field($this->field_name), 'Field was not deleted.');
+ $this->assertNotNull(field_info_field($this->field_name), t('Field was not deleted.'));
// Delete the second instance.
$this->fieldUIDeleteField($bundle_path2, $this->field_name, $this->field_label, $type_name2);
@@ -259,9 +259,9 @@ class FieldUITestCase extends DrupalWebTestCase {
// Reset the fields info.
_field_info_collate_fields(TRUE);
// Check that the field instance was deleted.
- $this->assertNull(field_info_instance('node', $this->field_name, $type_name2), 'Field instance was deleted.');
+ $this->assertNull(field_info_instance('node', $this->field_name, $type_name2), t('Field instance was deleted.'));
// Check that the field was deleted too.
- $this->assertNull(field_info_field($this->field_name), 'Field was deleted.');
+ $this->assertNull(field_info_field($this->field_name), t('Field was deleted.'));
}
/**
@@ -272,7 +272,7 @@ class FieldUITestCase extends DrupalWebTestCase {
// Check that the field type is not available in the 'add new field' row.
$this->drupalGet($bundle_path);
- $this->assertFalse($this->xpath('//select[@id="edit--add-new-field-type"]//option[@value="hidden_test_field"]'), "The 'add new field' select respects field types 'no_ui' property.");
+ $this->assertFalse($this->xpath('//select[@id="edit--add-new-field-type"]//option[@value="hidden_test_field"]'), t("The 'add new field' select respects field types 'no_ui' property."));
// Create a field and an instance programmatically.
$field_name = 'hidden_test_field';
@@ -285,18 +285,18 @@ class FieldUITestCase extends DrupalWebTestCase {
'widget_type' => 'test_field_widget',
);
field_create_instance($instance);
- $this->assertTrue(field_read_instance('node', $field_name, $this->type), 'An instance of the field ' . $field_name . ' was created programmatically.');
+ $this->assertTrue(field_read_instance('node', $field_name, $this->type), t('An instance of the field %field was created programmatically.', array('%field' => $field_name)));
// Check that the newly added instance appears on the 'Manage Fields'
// screen.
$this->drupalGet($bundle_path);
- $this->assertFieldByXPath('//table[@id="field-overview"]//td[1]', $instance['label'], 'Field was created and appears in the overview page.');
+ $this->assertFieldByXPath('//table[@id="field-overview"]//td[1]', $instance['label'], t('Field was created and appears in the overview page.'));
// Check that the instance does not appear in the 'add existing field' row
// on other bundles.
$bundle_path = 'admin/structure/types/manage/article/fields/';
$this->drupalGet($bundle_path);
- $this->assertFalse($this->xpath('//select[@id="edit--add-existing-field-field-name"]//option[@value=:field_name]', array(':field_name' => $field_name)), "The 'add existing field' select respects field types 'no_ui' property.");
+ $this->assertFalse($this->xpath('//select[@id="edit--add-existing-field-field-name"]//option[@value=:field_name]', array(':field_name' => $field_name)), t("The 'add existing field' select respects field types 'no_ui' property."));
}
/**
@@ -324,22 +324,22 @@ class FieldUITestCase extends DrupalWebTestCase {
$field_name = $initial_edit['_add_new_field[field_name]'];
// First step : 'Add new field' on the 'Manage fields' page.
- $this->drupalPost("$bundle_path/fields", $initial_edit, t('Save'));
- $this->assertRaw(t('These settings apply to the %label field everywhere it is used.', array('%label' => $label)), 'Field settings page was displayed.');
+ $this->drupalPost("$bundle_path/fields", $initial_edit, t('Save'));
+ $this->assertRaw(t('These settings apply to the %label field everywhere it is used.', array('%label' => $label)), t('Field settings page was displayed.'));
// Second step : 'Field settings' form.
$this->drupalPost(NULL, $field_edit, t('Save field settings'));
- $this->assertRaw(t('Updated field %label field settings.', array('%label' => $label)), 'Redirected to instance and widget settings page.');
+ $this->assertRaw(t('Updated field %label field settings.', array('%label' => $label)), t('Redirected to instance and widget settings page.'));
// Assert the field settings are correct.
$this->assertFieldSettings($this->type, $this->field_name);
// Third step : 'Instance settings' form.
$this->drupalPost(NULL, $instance_edit, t('Save settings'));
- $this->assertRaw(t('Saved %label configuration.', array('%label' => $label)), 'Redirected to "Manage fields" page.');
+ $this->assertRaw(t('Saved %label configuration.', array('%label' => $label)), t('Redirected to "Manage fields" page.'));
// Check that the field appears in the overview form.
- $this->assertFieldByXPath('//table[@id="field-overview"]//td[1]', $label, 'Field was created and appears in the overview page.');
+ $this->assertFieldByXPath('//table[@id="field-overview"]//td[1]', $label, t('Field was created and appears in the overview page.'));
}
/**
@@ -367,10 +367,10 @@ class FieldUITestCase extends DrupalWebTestCase {
// Second step : 'Instance settings' form.
$this->drupalPost(NULL, $instance_edit, t('Save settings'));
- $this->assertRaw(t('Saved %label configuration.', array('%label' => $label)), 'Redirected to "Manage fields" page.');
+ $this->assertRaw(t('Saved %label configuration.', array('%label' => $label)), t('Redirected to "Manage fields" page.'));
// Check that the field appears in the overview form.
- $this->assertFieldByXPath('//table[@id="field-overview"]//td[1]', $label, 'Field was created and appears in the overview page.');
+ $this->assertFieldByXPath('//table[@id="field-overview"]//td[1]', $label, t('Field was created and appears in the overview page.'));
}
/**
@@ -388,13 +388,13 @@ class FieldUITestCase extends DrupalWebTestCase {
function fieldUIDeleteField($bundle_path, $field_name, $label, $bundle_label) {
// Display confirmation form.
$this->drupalGet("$bundle_path/fields/$field_name/delete");
- $this->assertRaw(t('Are you sure you want to delete the field %label', array('%label' => $label)), 'Delete confirmation was found.');
+ $this->assertRaw(t('Are you sure you want to delete the field %label', array('%label' => $label)), t('Delete confirmation was found.'));
// Submit confirmation form.
$this->drupalPost(NULL, array(), t('Delete'));
- $this->assertRaw(t('The field %label has been deleted from the %type content type.', array('%label' => $label, '%type' => $bundle_label)), 'Delete message was found.');
+ $this->assertRaw(t('The field %label has been deleted from the %type content type.', array('%label' => $label, '%type' => $bundle_label)), t('Delete message was found.'));
// Check that the field doesn not appear in the overview form
- $this->assertNoFieldByXPath('//table[@id="field-overview"]//span[@class="label-field"]', $label, 'Field does not appear in the overview page.');
+ $this->assertNoFieldByXPath('//table[@id="field-overview"]//span[@class="label-field"]', $label, t('Field does not appear in the overview page.'));
}
}
diff --git a/modules/file/tests/file.test b/modules/file/tests/file.test
index f025d0529..2bf5b7f86 100644
--- a/modules/file/tests/file.test
+++ b/modules/file/tests/file.test
@@ -244,15 +244,15 @@ class FileFieldWidgetTestCase extends FileFieldTestCase {
$nid = $this->uploadNodeFile($test_file, $field_name, $type_name);
$node = node_load($nid, NULL, TRUE);
$node_file = (object) $node->{$field_name}[LANGUAGE_NONE][0];
- $this->assertFileExists($node_file, 'New file saved to disk on node creation.');
+ $this->assertFileExists($node_file, t('New file saved to disk on node creation.'));
// Test file download.
$this->drupalGet(file_create_url($node_file->uri));
- $this->assertResponse(200, 'Confirmed that the generated URL is correct by downloading the shipped file.');
+ $this->assertResponse(200, t('Confirmed that the generated URL is correct by downloading the shipped file.'));
// Ensure the edit page has a remove button instead of an upload button.
$this->drupalGet("node/$nid/edit");
- $this->assertNoFieldByXPath('//input[@type="submit"]', t('Upload'), 'Node with file does not display the "Upload" button.');
- $this->assertFieldByXpath('//input[@type="submit"]', 'Remove', 'Node with file displays the "Remove" button.');
+ $this->assertNoFieldByXPath('//input[@type="submit"]', t('Upload'), t('Node with file does not display the "Upload" button.'));
+ $this->assertFieldByXpath('//input[@type="submit"]', t('Remove'), t('Node with file displays the "Remove" button.'));
// "Click" the remove button (emulating either a nojs or js submission).
switch ($type) {
@@ -271,13 +271,13 @@ class FileFieldWidgetTestCase extends FileFieldTestCase {
}
// Ensure the page now has an upload button instead of a remove button.
- $this->assertNoFieldByXPath('//input[@type="submit"]', t('Remove'), 'After clicking the "Remove" button, it is no longer displayed.');
- $this->assertFieldByXpath('//input[@type="submit"]', 'Upload', 'After clicking the "Remove" button, the "Upload" button is displayed.');
+ $this->assertNoFieldByXPath('//input[@type="submit"]', t('Remove'), t('After clicking the "Remove" button, it is no longer displayed.'));
+ $this->assertFieldByXpath('//input[@type="submit"]', t('Upload'), t('After clicking the "Remove" button, the "Upload" button is displayed.'));
// Save the node and ensure it does not have the file.
$this->drupalPost(NULL, array(), t('Save'));
$node = node_load($nid, NULL, TRUE);
- $this->assertTrue(empty($node->{$field_name}[LANGUAGE_NONE][0]['fid']), 'File was successfully removed from the node.');
+ $this->assertTrue(empty($node->{$field_name}[LANGUAGE_NONE][0]['fid']), t('File was successfully removed from the node.'));
}
// Test private download method.
@@ -288,18 +288,18 @@ class FileFieldWidgetTestCase extends FileFieldTestCase {
$nid = $this->uploadNodeFile($test_file, $field_name, $type_name);
$node = node_load($nid, NULL, TRUE);
$node_file = (object) $node->{$field_name}[LANGUAGE_NONE][0];
- $this->assertFileExists($node_file, 'New file saved to disk on node creation.');
+ $this->assertFileExists($node_file, t('New file saved to disk on node creation.'));
// Test file download.
$this->drupalGet(file_create_url($node_file->uri));
- $this->assertResponse(200, 'Confirmed that the generated URL is correct by downloading the shipped file.');
+ $this->assertResponse(200, t('Confirmed that the generated URL is correct by downloading the shipped file.'));
// Ensure we can't change 'uri_scheme' field settings while there are some
// entities with uploaded files.
$this->drupalGet("admin/structure/types/manage/$type_name/fields/$field_name");
- $this->assertFieldByXpath('//input[@id="edit-field-settings-uri-scheme-public" and @disabled="disabled"]', 'public', 'Upload destination setting disabled.');
+ $this->assertFieldByXpath('//input[@id="edit-field-settings-uri-scheme-public" and @disabled="disabled"]', 'public', t('Upload destination setting disabled.'));
// Delete node and confirm that setting could be changed.
node_delete($nid);
$this->drupalGet("admin/structure/types/manage/$type_name/fields/$field_name");
- $this->assertFieldByXpath('//input[@id="edit-field-settings-uri-scheme-public" and not(@disabled)]', 'public', 'Upload destination setting enabled.');
+ $this->assertFieldByXpath('//input[@id="edit-field-settings-uri-scheme-public" and not(@disabled)]', 'public', t('Upload destination setting enabled.'));
}
}
@@ -345,25 +345,25 @@ class FileFieldRevisionTestCase extends FileFieldTestCase {
$node = node_load($nid, NULL, TRUE);
$node_file_r1 = (object) $node->{$field_name}[LANGUAGE_NONE][0];
$node_vid_r1 = $node->vid;
- $this->assertFileExists($node_file_r1, 'New file saved to disk on node creation.');
- $this->assertFileEntryExists($node_file_r1, 'File entry exists in database on node creation.');
- $this->assertFileIsPermanent($node_file_r1, 'File is permanent.');
+ $this->assertFileExists($node_file_r1, t('New file saved to disk on node creation.'));
+ $this->assertFileEntryExists($node_file_r1, t('File entry exists in database on node creation.'));
+ $this->assertFileIsPermanent($node_file_r1, t('File is permanent.'));
// Upload another file to the same node in a new revision.
$this->replaceNodeFile($test_file, $field_name, $nid);
$node = node_load($nid, NULL, TRUE);
$node_file_r2 = (object) $node->{$field_name}[LANGUAGE_NONE][0];
$node_vid_r2 = $node->vid;
- $this->assertFileExists($node_file_r2, 'Replacement file exists on disk after creating new revision.');
- $this->assertFileEntryExists($node_file_r2, 'Replacement file entry exists in database after creating new revision.');
- $this->assertFileIsPermanent($node_file_r2, 'Replacement file is permanent.');
+ $this->assertFileExists($node_file_r2, t('Replacement file exists on disk after creating new revision.'));
+ $this->assertFileEntryExists($node_file_r2, t('Replacement file entry exists in database after creating new revision.'));
+ $this->assertFileIsPermanent($node_file_r2, t('Replacement file is permanent.'));
// Check that the original file is still in place on the first revision.
$node = node_load($nid, $node_vid_r1, TRUE);
- $this->assertEqual($node_file_r1, (object) $node->{$field_name}[LANGUAGE_NONE][0], 'Original file still in place after replacing file in new revision.');
- $this->assertFileExists($node_file_r1, 'Original file still in place after replacing file in new revision.');
- $this->assertFileEntryExists($node_file_r1, 'Original file entry still in place after replacing file in new revision');
- $this->assertFileIsPermanent($node_file_r1, 'Original file is still permanent.');
+ $this->assertEqual($node_file_r1, (object) $node->{$field_name}[LANGUAGE_NONE][0], t('Original file still in place after replacing file in new revision.'));
+ $this->assertFileExists($node_file_r1, t('Original file still in place after replacing file in new revision.'));
+ $this->assertFileEntryExists($node_file_r1, t('Original file entry still in place after replacing file in new revision'));
+ $this->assertFileIsPermanent($node_file_r1, t('Original file is still permanent.'));
// Save a new version of the node without any changes.
// Check that the file is still the same as the previous revision.
@@ -371,23 +371,23 @@ class FileFieldRevisionTestCase extends FileFieldTestCase {
$node = node_load($nid, NULL, TRUE);
$node_file_r3 = (object) $node->{$field_name}[LANGUAGE_NONE][0];
$node_vid_r3 = $node->vid;
- $this->assertEqual($node_file_r2, $node_file_r3, 'Previous revision file still in place after creating a new revision without a new file.');
- $this->assertFileIsPermanent($node_file_r3, 'New revision file is permanent.');
+ $this->assertEqual($node_file_r2, $node_file_r3, t('Previous revision file still in place after creating a new revision without a new file.'));
+ $this->assertFileIsPermanent($node_file_r3, t('New revision file is permanent.'));
// Revert to the first revision and check that the original file is active.
$this->drupalPost('node/' . $nid . '/revisions/' . $node_vid_r1 . '/revert', array(), t('Revert'));
$node = node_load($nid, NULL, TRUE);
$node_file_r4 = (object) $node->{$field_name}[LANGUAGE_NONE][0];
$node_vid_r4 = $node->vid;
- $this->assertEqual($node_file_r1, $node_file_r4, 'Original revision file still in place after reverting to the original revision.');
- $this->assertFileIsPermanent($node_file_r4, 'Original revision file still permanent after reverting to the original revision.');
+ $this->assertEqual($node_file_r1, $node_file_r4, t('Original revision file still in place after reverting to the original revision.'));
+ $this->assertFileIsPermanent($node_file_r4, t('Original revision file still permanent after reverting to the original revision.'));
// Delete the second revision and check that the file is kept (since it is
// still being used by the third revision).
$this->drupalPost('node/' . $nid . '/revisions/' . $node_vid_r2 . '/delete', array(), t('Delete'));
- $this->assertFileExists($node_file_r3, 'Second file is still available after deleting second revision, since it is being used by the third revision.');
- $this->assertFileEntryExists($node_file_r3, 'Second file entry is still available after deleting second revision, since it is being used by the third revision.');
- $this->assertFileIsPermanent($node_file_r3, 'Second file entry is still permanent after deleting second revision, since it is being used by the third revision.');
+ $this->assertFileExists($node_file_r3, t('Second file is still available after deleting second revision, since it is being used by the third revision.'));
+ $this->assertFileEntryExists($node_file_r3, t('Second file entry is still available after deleting second revision, since it is being used by the third revision.'));
+ $this->assertFileIsPermanent($node_file_r3, t('Second file entry is still permanent after deleting second revision, since it is being used by the third revision.'));
// Attach the second file to a user.
$user = $this->drupalCreateUser();
@@ -398,9 +398,9 @@ class FileFieldRevisionTestCase extends FileFieldTestCase {
// Delete the third revision and check that the file is not deleted yet.
$this->drupalPost('node/' . $nid . '/revisions/' . $node_vid_r3 . '/delete', array(), t('Delete'));
- $this->assertFileExists($node_file_r3, 'Second file is still available after deleting third revision, since it is being used by the user.');
- $this->assertFileEntryExists($node_file_r3, 'Second file entry is still available after deleting third revision, since it is being used by the user.');
- $this->assertFileIsPermanent($node_file_r3, 'Second file entry is still permanent after deleting third revision, since it is being used by the user.');
+ $this->assertFileExists($node_file_r3, t('Second file is still available after deleting third revision, since it is being used by the user.'));
+ $this->assertFileEntryExists($node_file_r3, t('Second file entry is still available after deleting third revision, since it is being used by the user.'));
+ $this->assertFileIsPermanent($node_file_r3, t('Second file entry is still permanent after deleting third revision, since it is being used by the user.'));
// Delete the user and check that the file is also deleted.
user_delete($user->uid);
@@ -408,13 +408,13 @@ class FileFieldRevisionTestCase extends FileFieldTestCase {
// not be necessary here. The file really is deleted, but stream wrappers
// doesn't seem to think so unless we clear the PHP file stat() cache.
clearstatcache();
- $this->assertFileNotExists($node_file_r3, 'Second file is now deleted after deleting third revision, since it is no longer being used by any other nodes.');
- $this->assertFileEntryNotExists($node_file_r3, 'Second file entry is now deleted after deleting third revision, since it is no longer being used by any other nodes.');
+ $this->assertFileNotExists($node_file_r3, t('Second file is now deleted after deleting third revision, since it is no longer being used by any other nodes.'));
+ $this->assertFileEntryNotExists($node_file_r3, t('Second file entry is now deleted after deleting third revision, since it is no longer being used by any other nodes.'));
// Delete the entire node and check that the original file is deleted.
$this->drupalPost('node/' . $nid . '/delete', array(), t('Delete'));
- $this->assertFileNotExists($node_file_r1, 'Original file is deleted after deleting the entire node with two revisions remaining.');
- $this->assertFileEntryNotExists($node_file_r1, 'Original file entry is deleted after deleting the entire node with two revisions remaining.');
+ $this->assertFileNotExists($node_file_r1, t('Original file is deleted after deleting the entire node with two revisions remaining.'));
+ $this->assertFileEntryNotExists($node_file_r1, t('Original file entry is deleted after deleting the entire node with two revisions remaining.'));
}
}
@@ -458,13 +458,13 @@ class FileFieldDisplayTestCase extends FileFieldTestCase {
$node = node_load($nid, NULL, TRUE);
$node_file = (object) $node->{$field_name}[LANGUAGE_NONE][0];
$default_output = theme('file_link', array('file' => $node_file));
- $this->assertRaw($default_output, 'Default formatter displaying correctly on full node view.');
+ $this->assertRaw($default_output, t('Default formatter displaying correctly on full node view.'));
// Turn the "display" option off and check that the file is no longer displayed.
$edit = array($field_name . '[' . LANGUAGE_NONE . '][0][display]' => FALSE);
$this->drupalPost('node/' . $nid . '/edit', $edit, t('Save'));
- $this->assertNoRaw($default_output, 'Field is hidden when "display" option is unchecked.');
+ $this->assertNoRaw($default_output, t('Field is hidden when "display" option is unchecked.'));
}
}
@@ -500,15 +500,15 @@ class FileFieldValidateTestCase extends FileFieldTestCase {
$langcode = LANGUAGE_NONE;
$edit = array("title" => $this->randomName());
$this->drupalPost('node/add/' . $type_name, $edit, t('Save'));
- $this->assertRaw(t('!title field is required.', array('!title' => $instance['label'])), 'Node save failed when required file field was empty.');
+ $this->assertRaw(t('!title field is required.', array('!title' => $instance['label'])), t('Node save failed when required file field was empty.'));
// Create a new node with the uploaded file.
$nid = $this->uploadNodeFile($test_file, $field_name, $type_name);
$node = node_load($nid, NULL, TRUE);
$node_file = (object) $node->{$field_name}[LANGUAGE_NONE][0];
- $this->assertFileExists($node_file, 'File exists after uploading to the required field.');
- $this->assertFileEntryExists($node_file, 'File entry exists after uploading to the required field.');
+ $this->assertFileExists($node_file, t('File exists after uploading to the required field.'));
+ $this->assertFileEntryExists($node_file, t('File entry exists after uploading to the required field.'));
// Try again with a multiple value field.
field_delete_field($field_name);
@@ -517,14 +517,14 @@ class FileFieldValidateTestCase extends FileFieldTestCase {
// Try to post a new node without uploading a file in the multivalue field.
$edit = array('title' => $this->randomName());
$this->drupalPost('node/add/' . $type_name, $edit, t('Save'));
- $this->assertRaw(t('!title field is required.', array('!title' => $instance['label'])), 'Node save failed when required multiple value file field was empty.');
+ $this->assertRaw(t('!title field is required.', array('!title' => $instance['label'])), t('Node save failed when required multiple value file field was empty.'));
// Create a new node with the uploaded file into the multivalue field.
$nid = $this->uploadNodeFile($test_file, $field_name, $type_name);
$node = node_load($nid, NULL, TRUE);
$node_file = (object) $node->{$field_name}[LANGUAGE_NONE][0];
- $this->assertFileExists($node_file, 'File exists after uploading to the required multiple value field.');
- $this->assertFileEntryExists($node_file, 'File entry exists after uploading to the required multipel value field.');
+ $this->assertFileExists($node_file, t('File exists after uploading to the required multiple value field.'));
+ $this->assertFileEntryExists($node_file, t('File entry exists after uploading to the required multipel value field.'));
// Remove our file field.
field_delete_field($field_name);
@@ -559,13 +559,13 @@ class FileFieldValidateTestCase extends FileFieldTestCase {
$nid = $this->uploadNodeFile($small_file, $field_name, $type_name);
$node = node_load($nid, NULL, TRUE);
$node_file = (object) $node->{$field_name}[LANGUAGE_NONE][0];
- $this->assertFileExists($node_file, 'File exists after uploading a file (' . format_size($small_file->filesize) . ') under the max limit (' . $max_filesize . ').');
- $this->assertFileEntryExists($node_file, 'File entry exists after uploading a file (' . format_size($small_file->filesize) . ') under the max limit (' . $max_filesize . ').');
+ $this->assertFileExists($node_file, t('File exists after uploading a file (%filesize) under the max limit (%maxsize).', array('%filesize' => format_size($small_file->filesize), '%maxsize' => $max_filesize)));
+ $this->assertFileEntryExists($node_file, t('File entry exists after uploading a file (%filesize) under the max limit (%maxsize).', array('%filesize' => format_size($small_file->filesize), '%maxsize' => $max_filesize)));
// Check that uploading the large file fails (1M limit).
$nid = $this->uploadNodeFile($large_file, $field_name, $type_name);
$error_message = t('The file is %filesize exceeding the maximum file size of %maxsize.', array('%filesize' => format_size($large_file->filesize), '%maxsize' => format_size($file_limit)));
- $this->assertRaw($error_message, 'Node save failed when file (' . format_size($large_file->filesize) . ') exceeded the max upload size (' . $max_filesize . ').');
+ $this->assertRaw($error_message, t('Node save failed when file (%filesize) exceeded the max upload size (%maxsize).', array('%filesize' => format_size($large_file->filesize), '%maxsize' => $max_filesize)));
}
// Turn off the max filesize.
@@ -575,8 +575,8 @@ class FileFieldValidateTestCase extends FileFieldTestCase {
$nid = $this->uploadNodeFile($large_file, $field_name, $type_name);
$node = node_load($nid, NULL, TRUE);
$node_file = (object) $node->{$field_name}[LANGUAGE_NONE][0];
- $this->assertFileExists($node_file, 'File exists after uploading a file (' . format_size($large_file->filesize) . ') with no max limit.');
- $this->assertFileEntryExists($node_file, 'File entry exists after uploading a file (' . format_size($large_file->filesize) . ') with no max limit.');
+ $this->assertFileExists($node_file, t('File exists after uploading a file (%filesize) with no max limit.', array('%filesize' => format_size($large_file->filesize))));
+ $this->assertFileEntryExists($node_file, t('File entry exists after uploading a file (%filesize) with no max limit.', array('%filesize' => format_size($large_file->filesize))));
// Remove our file field.
field_delete_field($field_name);
@@ -602,8 +602,8 @@ class FileFieldValidateTestCase extends FileFieldTestCase {
$nid = $this->uploadNodeFile($test_file, $field_name, $type_name);
$node = node_load($nid, NULL, TRUE);
$node_file = (object) $node->{$field_name}[LANGUAGE_NONE][0];
- $this->assertFileExists($node_file, 'File exists after uploading a file with no extension checking.');
- $this->assertFileEntryExists($node_file, 'File entry exists after uploading a file with no extension checking.');
+ $this->assertFileExists($node_file, t('File exists after uploading a file with no extension checking.'));
+ $this->assertFileEntryExists($node_file, t('File entry exists after uploading a file with no extension checking.'));
// Enable extension checking for text files.
$this->updateFileField($field_name, $type_name, array('file_extensions' => 'txt'));
@@ -611,7 +611,7 @@ class FileFieldValidateTestCase extends FileFieldTestCase {
// Check that the file with the wrong extension cannot be uploaded.
$nid = $this->uploadNodeFile($test_file, $field_name, $type_name);
$error_message = t('Only files with the following extensions are allowed: %files-allowed.', array('%files-allowed' => 'txt'));
- $this->assertRaw($error_message, 'Node save failed when file uploaded with the wrong extension.');
+ $this->assertRaw($error_message, t('Node save failed when file uploaded with the wrong extension.'));
// Enable extension checking for text and image files.
$this->updateFileField($field_name, $type_name, array('file_extensions' => "txt $test_file_extension"));
@@ -620,8 +620,8 @@ class FileFieldValidateTestCase extends FileFieldTestCase {
$nid = $this->uploadNodeFile($test_file, $field_name, $type_name);
$node = node_load($nid, NULL, TRUE);
$node_file = (object) $node->{$field_name}[LANGUAGE_NONE][0];
- $this->assertFileExists($node_file, 'File exists after uploading a file with extension checking.');
- $this->assertFileEntryExists($node_file, 'File entry exists after uploading a file with extension checking.');
+ $this->assertFileExists($node_file, t('File exists after uploading a file with extension checking.'));
+ $this->assertFileEntryExists($node_file, t('File entry exists after uploading a file with extension checking.'));
// Remove our file field.
field_delete_field($field_name);
@@ -655,7 +655,7 @@ class FileFieldPathTestCase extends FileFieldTestCase {
// Check that the file was uploaded to the file root.
$node = node_load($nid, NULL, TRUE);
$node_file = (object) $node->{$field_name}[LANGUAGE_NONE][0];
- $this->assertPathMatch('public://' . $test_file->filename, $node_file->uri, 'The file ' . $node_file->uri . ' was uploaded to the correct path.');
+ $this->assertPathMatch('public://' . $test_file->filename, $node_file->uri, t('The file %file was uploaded to the correct path.', array('%file' => $node_file->uri)));
// Change the path to contain multiple subdirectories.
$field = $this->updateFileField($field_name, $type_name, array('file_directory' => 'foo/bar/baz'));
@@ -666,7 +666,7 @@ class FileFieldPathTestCase extends FileFieldTestCase {
// Check that the file was uploaded into the subdirectory.
$node = node_load($nid, NULL, TRUE);
$node_file = (object) $node->{$field_name}[LANGUAGE_NONE][0];
- $this->assertPathMatch('public://foo/bar/baz/' . $test_file->filename, $node_file->uri, 'The file ' . $node_file->uri . ' was uploaded to the correct path.');
+ $this->assertPathMatch('public://foo/bar/baz/' . $test_file->filename, $node_file->uri, t('The file %file was uploaded to the correct path.', array('%file' => $node_file->uri)));
// Check the path when used with tokens.
// Change the path to contain multiple token directories.
@@ -680,7 +680,7 @@ class FileFieldPathTestCase extends FileFieldTestCase {
$node_file = (object) $node->{$field_name}[LANGUAGE_NONE][0];
$data = array('user' => $this->admin_user);
$subdirectory = token_replace('[user:uid]/[user:name]', $data);
- $this->assertPathMatch('public://' . $subdirectory . '/' . $test_file->filename, $node_file->uri, 'The file ' . $node_file->uri . ' was uploaded to the correct path with token replacements.');
+ $this->assertPathMatch('public://' . $subdirectory . '/' . $test_file->filename, $node_file->uri, t('The file %file was uploaded to the correct path with token replacements.', array('%file' => $node_file->uri)));
}
/**
@@ -760,11 +760,11 @@ class FileTokenReplaceTestCase extends FileFieldTestCase {
$tests['[file:owner:uid]'] = $file->uid;
// Test to make sure that we generated something for each token.
- $this->assertFalse(in_array(0, array_map('strlen', $tests)), 'No empty tokens generated.');
+ $this->assertFalse(in_array(0, array_map('strlen', $tests)), t('No empty tokens generated.'));
foreach ($tests as $input => $expected) {
$output = token_replace($input, array('file' => $file), array('language' => $language));
- $this->assertFalse(strcmp($output, $expected), 'Sanitized file token ' . $input . ' replaced.');
+ $this->assertFalse(strcmp($output, $expected), t('Sanitized file token %token replaced.', array('%token' => $input)));
}
// Generate and test unsanitized tokens.
@@ -776,7 +776,7 @@ class FileTokenReplaceTestCase extends FileFieldTestCase {
foreach ($tests as $input => $expected) {
$output = token_replace($input, array('file' => $file), array('language' => $language, 'sanitize' => FALSE));
- $this->assertFalse(strcmp($output, $expected), 'Unsanitized file token ' . $input . ' replaced.');
+ $this->assertFalse(strcmp($output, $expected), t('Unsanitized file token %token replaced.', array('%token' => $input)));
}
}
}
diff --git a/modules/filter/filter.test b/modules/filter/filter.test
index fdee75de6..973a0b779 100644
--- a/modules/filter/filter.test
+++ b/modules/filter/filter.test
@@ -60,11 +60,11 @@ class FilterCRUDTestCase extends DrupalWebTestCase {
// Delete the text format.
filter_format_delete($format);
$db_format = db_query("SELECT * FROM {filter_format} WHERE format = :format", array(':format' => $format->format))->fetchObject();
- $this->assertFalse($db_format, 'Database: Deleted text format no longer exists.');
+ $this->assertFalse($db_format, t('Database: Deleted text format no longer exists.'));
$db_filters = db_query("SELECT * FROM {filter} WHERE format = :format", array(':format' => $format->format))->fetchObject();
- $this->assertFalse($db_filters, 'Database: Filters for deleted text format no longer exist.');
+ $this->assertFalse($db_filters, t('Database: Filters for deleted text format no longer exist.'));
$formats = filter_formats();
- $this->assertTrue(!isset($formats[$format->format]), 'filter_formats: Deleted text format no longer exists.');
+ $this->assertTrue(!isset($formats[$format->format]), t('filter_formats: Deleted text format no longer exists.'));
}
/**
@@ -78,17 +78,17 @@ class FilterCRUDTestCase extends DrupalWebTestCase {
->condition('format', $format->format)
->execute()
->fetchObject();
- $this->assertEqual($db_format->format, $format->format, 'Database: Proper format id for text format ' . $t_args['%format'] . '.');
- $this->assertEqual($db_format->name, $format->name, 'Database: Proper title for text format ' . $t_args['%format'] . '.');
- $this->assertEqual($db_format->cache, $format->cache, 'Database: Proper cache indicator for text format ' . $t_args['%format'] . '.');
- $this->assertEqual($db_format->weight, $format->weight, 'Database: Proper weight for text format ' . $t_args['%format'] . '.');
+ $this->assertEqual($db_format->format, $format->format, t('Database: Proper format id for text format %format.', $t_args));
+ $this->assertEqual($db_format->name, $format->name, t('Database: Proper title for text format %format.', $t_args));
+ $this->assertEqual($db_format->cache, $format->cache, t('Database: Proper cache indicator for text format %format.', $t_args));
+ $this->assertEqual($db_format->weight, $format->weight, t('Database: Proper weight for text format %format.', $t_args));
// Verify filter_format_load().
$filter_format = filter_format_load($format->format);
- $this->assertEqual($filter_format->format, $format->format, 'filter_format_load: Proper format id for text format ' . $t_args['%format'] . '.');
- $this->assertEqual($filter_format->name, $format->name, 'filter_format_load: Proper title for text format ' . $t_args['%format'] . '.');
- $this->assertEqual($filter_format->cache, $format->cache, 'filter_format_load: Proper cache indicator for text format ' . $t_args['%format'] . '.');
- $this->assertEqual($filter_format->weight, $format->weight, 'filter_format_load: Proper weight for text format ' . $t_args['%format'] . '.');
+ $this->assertEqual($filter_format->format, $format->format, t('filter_format_load: Proper format id for text format %format.', $t_args));
+ $this->assertEqual($filter_format->name, $format->name, t('filter_format_load: Proper title for text format %format.', $t_args));
+ $this->assertEqual($filter_format->cache, $format->cache, t('filter_format_load: Proper cache indicator for text format %format.', $t_args));
+ $this->assertEqual($filter_format->weight, $format->weight, t('filter_format_load: Proper weight for text format %format.', $t_args));
// Verify the 'cache' text format property according to enabled filters.
$filter_info = filter_get_filters();
@@ -102,7 +102,7 @@ class FilterCRUDTestCase extends DrupalWebTestCase {
break;
}
}
- $this->assertEqual($filter_format->cache, $cacheable, 'Text format contains proper cache property.');
+ $this->assertEqual($filter_format->cache, $cacheable, t('Text format contains proper cache property.'));
}
/**
@@ -116,20 +116,20 @@ class FilterCRUDTestCase extends DrupalWebTestCase {
$t_args = array('%format' => $format->name, '%filter' => $name);
// Verify that filter status is properly stored.
- $this->assertEqual($filter->status, $format_filters[$name]['status'], 'Database: Proper status for ' . $t_args['%filter'] . ' in text format ' . $t_args['%format'] . '.');
+ $this->assertEqual($filter->status, $format_filters[$name]['status'], t('Database: Proper status for %filter in text format %format.', $t_args));
// Verify that filter settings were properly stored.
- $this->assertEqual(unserialize($filter->settings), isset($format_filters[$name]['settings']) ? $format_filters[$name]['settings'] : array(), 'Database: Proper filter settings for ' . $t_args['%filter'] . ' in text format ' . $t_args['%format'] . '.');
+ $this->assertEqual(unserialize($filter->settings), isset($format_filters[$name]['settings']) ? $format_filters[$name]['settings'] : array(), t('Database: Proper filter settings for %filter in text format %format.', $t_args));
// Verify that each filter has a module name assigned.
- $this->assertTrue(!empty($filter->module), 'Database: Proper module name for ' . $t_args['%filter'] . ' in text format ' . $t_args['%format'] . '.');
+ $this->assertTrue(!empty($filter->module), t('Database: Proper module name for %filter in text format %format.', $t_args));
// Remove the filter from the copy of saved $format to check whether all
// filters have been processed later.
unset($format_filters[$name]);
}
// Verify that all filters have been processed.
- $this->assertTrue(empty($format_filters), 'Database contains values for all filters in the saved format.');
+ $this->assertTrue(empty($format_filters), t('Database contains values for all filters in the saved format.'));
// Verify filter_list_format().
$filters = filter_list_format($format->format);
@@ -138,20 +138,20 @@ class FilterCRUDTestCase extends DrupalWebTestCase {
$t_args = array('%format' => $format->name, '%filter' => $name);
// Verify that filter status is properly stored.
- $this->assertEqual($filter->status, $format_filters[$name]['status'], 'filter_list_format: Proper status for ' . $t_args['%filter'] . ' in text format ' . $t_args['%format'] . '.');
+ $this->assertEqual($filter->status, $format_filters[$name]['status'], t('filter_list_format: Proper status for %filter in text format %format.', $t_args));
// Verify that filter settings were properly stored.
- $this->assertEqual($filter->settings, isset($format_filters[$name]['settings']) ? $format_filters[$name]['settings'] : array(), 'filter_list_format: Proper filter settings for ' . $t_args['%filter'] . ' in text format ' . $t_args['%format'] . '.');
+ $this->assertEqual($filter->settings, isset($format_filters[$name]['settings']) ? $format_filters[$name]['settings'] : array(), t('filter_list_format: Proper filter settings for %filter in text format %format.', $t_args));
// Verify that each filter has a module name assigned.
- $this->assertTrue(!empty($filter->module), 'filter_list_format: Proper module name for ' . $t_args['%filter'] . ' in text format ' . $t_args['%format'] . '.');
+ $this->assertTrue(!empty($filter->module), t('filter_list_format: Proper module name for %filter in text format %format.', $t_args));
// Remove the filter from the copy of saved $format to check whether all
// filters have been processed later.
unset($format_filters[$name]);
}
// Verify that all filters have been processed.
- $this->assertTrue(empty($format_filters), 'filter_list_format: Loaded filters contain values for all filters in the saved format.');
+ $this->assertTrue(empty($format_filters), t('filter_list_format: Loaded filters contain values for all filters in the saved format.'));
}
}
@@ -204,7 +204,7 @@ class FilterAdminTestCase extends DrupalWebTestCase {
// Verify that deleted text format no longer exists.
$this->drupalGet('admin/config/content/formats/' . $format->format);
- $this->assertResponse(404, 'Deleted text format no longer exists.');
+ $this->assertResponse(404, t('Deleted text format no longer exists.'));
}
/**
@@ -219,44 +219,44 @@ class FilterAdminTestCase extends DrupalWebTestCase {
list($filtered, $full, $plain) = $this->checkFilterFormats();
// Check that the fallback format exists and cannot be deleted.
- $this->assertTrue(!empty($plain) && $plain == filter_fallback_format(), 'The fallback format is set to plain text.');
+ $this->assertTrue(!empty($plain) && $plain == filter_fallback_format(), t('The fallback format is set to plain text.'));
$this->drupalGet('admin/config/content/formats');
- $this->assertNoRaw('admin/config/content/formats/' . $plain . '/delete', 'Delete link for the fallback format not found.');
+ $this->assertNoRaw('admin/config/content/formats/' . $plain . '/delete', t('Delete link for the fallback format not found.'));
$this->drupalGet('admin/config/content/formats/' . $plain . '/delete');
- $this->assertResponse(403, 'The fallback format cannot be deleted.');
+ $this->assertResponse(403, t('The fallback format cannot be deleted.'));
// Verify access permissions to Full HTML format.
- $this->assertTrue(filter_access(filter_format_load($full), $this->admin_user), 'Admin user may use Full HTML.');
- $this->assertFalse(filter_access(filter_format_load($full), $this->web_user), 'Web user may not use Full HTML.');
+ $this->assertTrue(filter_access(filter_format_load($full), $this->admin_user), t('Admin user may use Full HTML.'));
+ $this->assertFalse(filter_access(filter_format_load($full), $this->web_user), t('Web user may not use Full HTML.'));
// Add an additional tag.
$edit = array();
$edit['filters[filter_html][settings][allowed_html]'] = '<a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <quote>';
$this->drupalPost('admin/config/content/formats/' . $filtered, $edit, t('Save configuration'));
- $this->assertFieldByName('filters[filter_html][settings][allowed_html]', $edit['filters[filter_html][settings][allowed_html]'], 'Allowed HTML tag added.');
+ $this->assertFieldByName('filters[filter_html][settings][allowed_html]', $edit['filters[filter_html][settings][allowed_html]'], t('Allowed HTML tag added.'));
$result = db_query('SELECT * FROM {cache_filter}')->fetchObject();
- $this->assertFalse($result, 'Cache cleared.');
+ $this->assertFalse($result, t('Cache cleared.'));
$elements = $this->xpath('//select[@name=:first]/following::select[@name=:second]', array(
':first' => 'filters[' . $first_filter . '][weight]',
':second' => 'filters[' . $second_filter . '][weight]',
));
- $this->assertTrue(!empty($elements), 'Order confirmed in admin interface.');
+ $this->assertTrue(!empty($elements), t('Order confirmed in admin interface.'));
// Reorder filters.
$edit = array();
$edit['filters[' . $second_filter . '][weight]'] = 1;
$edit['filters[' . $first_filter . '][weight]'] = 2;
$this->drupalPost(NULL, $edit, t('Save configuration'));
- $this->assertFieldByName('filters[' . $second_filter . '][weight]', 1, 'Order saved successfully.');
- $this->assertFieldByName('filters[' . $first_filter . '][weight]', 2, 'Order saved successfully.');
+ $this->assertFieldByName('filters[' . $second_filter . '][weight]', 1, t('Order saved successfully.'));
+ $this->assertFieldByName('filters[' . $first_filter . '][weight]', 2, t('Order saved successfully.'));
$elements = $this->xpath('//select[@name=:first]/following::select[@name=:second]', array(
':first' => 'filters[' . $second_filter . '][weight]',
':second' => 'filters[' . $first_filter . '][weight]',
));
- $this->assertTrue(!empty($elements), 'Reorder confirmed in admin interface.');
+ $this->assertTrue(!empty($elements), t('Reorder confirmed in admin interface.'));
$result = db_query('SELECT * FROM {filter} WHERE format = :format ORDER BY weight ASC', array(':format' => $filtered));
$filters = array();
@@ -265,7 +265,7 @@ class FilterAdminTestCase extends DrupalWebTestCase {
$filters[] = $filter;
}
}
- $this->assertTrue(($filters[0]->name == $second_filter && $filters[1]->name == $first_filter), 'Order confirmed in database.');
+ $this->assertTrue(($filters[0]->name == $second_filter && $filters[1]->name == $first_filter), t('Order confirmed in database.'));
// Add format.
$edit = array();
@@ -274,18 +274,18 @@ class FilterAdminTestCase extends DrupalWebTestCase {
$edit['filters[' . $second_filter . '][status]'] = TRUE;
$edit['filters[' . $first_filter . '][status]'] = TRUE;
$this->drupalPost('admin/config/content/formats/add', $edit, t('Save configuration'));
- $this->assertRaw(t('Added text format %format.', array('%format' => $edit['name'])), 'New filter created.');
+ $this->assertRaw(t('Added text format %format.', array('%format' => $edit['name'])), t('New filter created.'));
$format = $this->getFormat($edit['name']);
- $this->assertNotNull($format, 'Format found in database.');
+ $this->assertNotNull($format, t('Format found in database.'));
- $this->assertFieldByName('roles[2]', '', 'Role found.');
- $this->assertFieldByName('filters[' . $second_filter . '][status]', '', 'Line break filter found.');
- $this->assertFieldByName('filters[' . $first_filter . '][status]', '', 'Url filter found.');
+ $this->assertFieldByName('roles[2]', '', t('Role found.'));
+ $this->assertFieldByName('filters[' . $second_filter . '][status]', '', t('Line break filter found.'));
+ $this->assertFieldByName('filters[' . $first_filter . '][status]', '', t('Url filter found.'));
// Delete new filter.
$this->drupalPost('admin/config/content/formats/' . $format->format . '/delete', array(), t('Delete'));
- $this->assertRaw(t('Deleted text format %format.', array('%format' => $edit['name'])), 'Format successfully deleted.');
+ $this->assertRaw(t('Deleted text format %format.', array('%format' => $edit['name'])), t('Format successfully deleted.'));
// Allow authenticated users on full HTML.
$format = filter_format_load($full);
@@ -293,14 +293,14 @@ class FilterAdminTestCase extends DrupalWebTestCase {
$edit['roles[1]'] = 0;
$edit['roles[2]'] = 1;
$this->drupalPost('admin/config/content/formats/' . $full, $edit, t('Save configuration'));
- $this->assertRaw(t('The text format %format has been updated.', array('%format' => $format->name)), 'Full HTML format successfully updated.');
+ $this->assertRaw(t('The text format %format has been updated.', array('%format' => $format->name)), t('Full HTML format successfully updated.'));
// Switch user.
$this->drupalLogout();
$this->drupalLogin($this->web_user);
$this->drupalGet('node/add/page');
- $this->assertRaw('<option value="' . $full . '">Full HTML</option>', 'Full HTML filter accessible.');
+ $this->assertRaw('<option value="' . $full . '">Full HTML</option>', t('Full HTML filter accessible.'));
// Use filtered HTML and see if it removes tags that are not allowed.
$body = '<em>' . $this->randomName() . '</em>';
@@ -313,20 +313,20 @@ class FilterAdminTestCase extends DrupalWebTestCase {
$edit["body[$langcode][0][value]"] = $text;
$edit["body[$langcode][0][format]"] = $filtered;
$this->drupalPost('node/add/page', $edit, t('Save'));
- $this->assertRaw(t('Basic page %title has been created.', array('%title' => $edit["title"])), 'Filtered node created.');
+ $this->assertRaw(t('Basic page %title has been created.', array('%title' => $edit["title"])), t('Filtered node created.'));
$node = $this->drupalGetNodeByTitle($edit["title"]);
- $this->assertTrue($node, 'Node found in database.');
+ $this->assertTrue($node, t('Node found in database.'));
$this->drupalGet('node/' . $node->nid);
- $this->assertRaw($body . $extra_text, 'Filter removed invalid tag.');
+ $this->assertRaw($body . $extra_text, t('Filter removed invalid tag.'));
// Use plain text and see if it escapes all tags, whether allowed or not.
$edit = array();
$edit["body[$langcode][0][format]"] = $plain;
$this->drupalPost('node/' . $node->nid . '/edit', $edit, t('Save'));
$this->drupalGet('node/' . $node->nid);
- $this->assertText(check_plain($text), 'The "Plain text" text format escapes all HTML tags.');
+ $this->assertText(check_plain($text), t('The "Plain text" text format escapes all HTML tags.'));
// Switch user.
$this->drupalLogout();
@@ -337,22 +337,22 @@ class FilterAdminTestCase extends DrupalWebTestCase {
$edit = array();
$edit['filters[filter_html][settings][allowed_html]'] = '<a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>';
$this->drupalPost('admin/config/content/formats/' . $filtered, $edit, t('Save configuration'));
- $this->assertFieldByName('filters[filter_html][settings][allowed_html]', $edit['filters[filter_html][settings][allowed_html]'], 'Changes reverted.');
+ $this->assertFieldByName('filters[filter_html][settings][allowed_html]', $edit['filters[filter_html][settings][allowed_html]'], t('Changes reverted.'));
// Full HTML.
$edit = array();
$edit['roles[2]'] = FALSE;
$this->drupalPost('admin/config/content/formats/' . $full, $edit, t('Save configuration'));
- $this->assertRaw(t('The text format %format has been updated.', array('%format' => $format->name)), 'Full HTML format successfully reverted.');
- $this->assertFieldByName('roles[2]', $edit['roles[2]'], 'Changes reverted.');
+ $this->assertRaw(t('The text format %format has been updated.', array('%format' => $format->name)), t('Full HTML format successfully reverted.'));
+ $this->assertFieldByName('roles[2]', $edit['roles[2]'], t('Changes reverted.'));
// Filter order.
$edit = array();
$edit['filters[' . $second_filter . '][weight]'] = 2;
$edit['filters[' . $first_filter . '][weight]'] = 1;
$this->drupalPost('admin/config/content/formats/' . $filtered, $edit, t('Save configuration'));
- $this->assertFieldByName('filters[' . $second_filter . '][weight]', $edit['filters[' . $second_filter . '][weight]'], 'Changes reverted.');
- $this->assertFieldByName('filters[' . $first_filter . '][weight]', $edit['filters[' . $first_filter . '][weight]'], 'Changes reverted.');
+ $this->assertFieldByName('filters[' . $second_filter . '][weight]', $edit['filters[' . $second_filter . '][weight]'], t('Changes reverted.'));
+ $this->assertFieldByName('filters[' . $first_filter . '][weight]', $edit['filters[' . $first_filter . '][weight]'], t('Changes reverted.'));
}
/**
@@ -441,28 +441,28 @@ class FilterFormatAccessTestCase extends DrupalWebTestCase {
function testFormatPermissions() {
// Make sure that a regular user only has access to the text format they
// were granted access to, as well to the fallback format.
- $this->assertTrue(filter_access($this->allowed_format, $this->web_user), 'A regular user has access to a text format they were granted access to.');
- $this->assertFalse(filter_access($this->disallowed_format, $this->web_user), 'A regular user does not have access to a text format they were not granted access to.');
- $this->assertTrue(filter_access(filter_format_load(filter_fallback_format()), $this->web_user), 'A regular user has access to the fallback format.');
+ $this->assertTrue(filter_access($this->allowed_format, $this->web_user), t('A regular user has access to a text format they were granted access to.'));
+ $this->assertFalse(filter_access($this->disallowed_format, $this->web_user), t('A regular user does not have access to a text format they were not granted access to.'));
+ $this->assertTrue(filter_access(filter_format_load(filter_fallback_format()), $this->web_user), t('A regular user has access to the fallback format.'));
// Perform similar checks as above, but now against the entire list of
// available formats for this user.
- $this->assertTrue(in_array($this->allowed_format->format, array_keys(filter_formats($this->web_user))), 'The allowed format appears in the list of available formats for a regular user.');
- $this->assertFalse(in_array($this->disallowed_format->format, array_keys(filter_formats($this->web_user))), 'The disallowed format does not appear in the list of available formats for a regular user.');
- $this->assertTrue(in_array(filter_fallback_format(), array_keys(filter_formats($this->web_user))), 'The fallback format appears in the list of available formats for a regular user.');
+ $this->assertTrue(in_array($this->allowed_format->format, array_keys(filter_formats($this->web_user))), t('The allowed format appears in the list of available formats for a regular user.'));
+ $this->assertFalse(in_array($this->disallowed_format->format, array_keys(filter_formats($this->web_user))), t('The disallowed format does not appear in the list of available formats for a regular user.'));
+ $this->assertTrue(in_array(filter_fallback_format(), array_keys(filter_formats($this->web_user))), t('The fallback format appears in the list of available formats for a regular user.'));
// Make sure that a regular user only has permission to use the format
// they were granted access to.
- $this->assertTrue(user_access(filter_permission_name($this->allowed_format), $this->web_user), 'A regular user has permission to use the allowed text format.');
- $this->assertFalse(user_access(filter_permission_name($this->disallowed_format), $this->web_user), 'A regular user does not have permission to use the disallowed text format.');
+ $this->assertTrue(user_access(filter_permission_name($this->allowed_format), $this->web_user), t('A regular user has permission to use the allowed text format.'));
+ $this->assertFalse(user_access(filter_permission_name($this->disallowed_format), $this->web_user), t('A regular user does not have permission to use the disallowed text format.'));
// Make sure that the allowed format appears on the node form and that
// the disallowed format does not.
$this->drupalLogin($this->web_user);
$this->drupalGet('node/add/page');
- $this->assertRaw($this->formatSelectorHTML($this->allowed_format), 'The allowed text format appears as an option when adding a new node.');
- $this->assertNoRaw($this->formatSelectorHTML($this->disallowed_format), 'The disallowed text format does not appear as an option when adding a new node.');
- $this->assertRaw($this->formatSelectorHTML(filter_format_load(filter_fallback_format())), 'The fallback format appears as an option when adding a new node.');
+ $this->assertRaw($this->formatSelectorHTML($this->allowed_format), t('The allowed text format appears as an option when adding a new node.'));
+ $this->assertNoRaw($this->formatSelectorHTML($this->disallowed_format), t('The disallowed text format does not appear as an option when adding a new node.'));
+ $this->assertRaw($this->formatSelectorHTML(filter_format_load(filter_fallback_format())), t('The fallback format appears as an option when adding a new node.'));
}
function testFormatRoles() {
@@ -472,17 +472,17 @@ class FilterFormatAccessTestCase extends DrupalWebTestCase {
// Check that this role appears in the list of roles that have access to an
// allowed text format, but does not appear in the list of roles that have
// access to a disallowed text format.
- $this->assertTrue(in_array($rid, array_keys(filter_get_roles_by_format($this->allowed_format))), 'A role which has access to a text format appears in the list of roles that have access to that format.');
- $this->assertFalse(in_array($rid, array_keys(filter_get_roles_by_format($this->disallowed_format))), 'A role which does not have access to a text format does not appear in the list of roles that have access to that format.');
+ $this->assertTrue(in_array($rid, array_keys(filter_get_roles_by_format($this->allowed_format))), t('A role which has access to a text format appears in the list of roles that have access to that format.'));
+ $this->assertFalse(in_array($rid, array_keys(filter_get_roles_by_format($this->disallowed_format))), t('A role which does not have access to a text format does not appear in the list of roles that have access to that format.'));
// Check that the correct text format appears in the list of formats
// available to that role.
- $this->assertTrue(in_array($this->allowed_format->format, array_keys(filter_get_formats_by_role($rid))), 'A text format which a role has access to appears in the list of formats available to that role.');
- $this->assertFalse(in_array($this->disallowed_format->format, array_keys(filter_get_formats_by_role($rid))), 'A text format which a role does not have access to does not appear in the list of formats available to that role.');
+ $this->assertTrue(in_array($this->allowed_format->format, array_keys(filter_get_formats_by_role($rid))), t('A text format which a role has access to appears in the list of formats available to that role.'));
+ $this->assertFalse(in_array($this->disallowed_format->format, array_keys(filter_get_formats_by_role($rid))), t('A text format which a role does not have access to does not appear in the list of formats available to that role.'));
// Check that the fallback format is always allowed.
- $this->assertEqual(filter_get_roles_by_format(filter_format_load(filter_fallback_format())), user_roles(), 'All roles have access to the fallback format.');
- $this->assertTrue(in_array(filter_fallback_format(), array_keys(filter_get_formats_by_role($rid))), 'The fallback format appears in the list of allowed formats for any role.');
+ $this->assertEqual(filter_get_roles_by_format(filter_format_load(filter_fallback_format())), user_roles(), t('All roles have access to the fallback format.'));
+ $this->assertTrue(in_array(filter_fallback_format(), array_keys(filter_get_formats_by_role($rid))), t('The fallback format appears in the list of allowed formats for any role.'));
}
/**
@@ -516,19 +516,19 @@ class FilterFormatAccessTestCase extends DrupalWebTestCase {
$this->clickLink(t('Edit'));
// Verify that body field is read-only and contains replacement value.
- $this->assertFieldByXPath("//textarea[@name='$body_value_key' and @disabled='disabled']", t('This field has been disabled because you do not have sufficient permissions to edit it.'), 'Text format access denied message found.');
+ $this->assertFieldByXPath("//textarea[@name='$body_value_key' and @disabled='disabled']", t('This field has been disabled because you do not have sufficient permissions to edit it.'), t('Text format access denied message found.'));
// Verify that title can be changed, but preview displays original body.
$new_edit = array();
$new_edit['title'] = $this->randomName(8);
$this->drupalPost(NULL, $new_edit, t('Preview'));
- $this->assertText($edit[$body_value_key], 'Old body found in preview.');
+ $this->assertText($edit[$body_value_key], t('Old body found in preview.'));
// Save and verify that only the title was changed.
$this->drupalPost(NULL, $new_edit, t('Save'));
- $this->assertNoText($edit['title'], 'Old title not found.');
- $this->assertText($new_edit['title'], 'New title found.');
- $this->assertText($edit[$body_value_key], 'Old body found.');
+ $this->assertNoText($edit['title'], t('Old title not found.'));
+ $this->assertText($new_edit['title'], t('New title found.'));
+ $this->assertText($edit[$body_value_key], t('Old body found.'));
// Delete the Full HTML text format.
filter_format_delete($this->full_html_format);
@@ -536,8 +536,8 @@ class FilterFormatAccessTestCase extends DrupalWebTestCase {
// Verify that body field can be edited and a new format can be selected.
$this->drupalGet('node/' . $node->nid . '/edit');
- $this->assertNoFieldByXPath("//textarea[@name='$body_value_key' and @disabled='disabled']", NULL, 'Text format access denied message not found.');
- $this->assertFieldByXPath("//select[@name='$body_format_key']", NULL, 'Text format selector found.');
+ $this->assertNoFieldByXPath("//textarea[@name='$body_value_key' and @disabled='disabled']", NULL, t('Text format access denied message not found.'));
+ $this->assertFieldByXPath("//select[@name='$body_format_key']", NULL, t('Text format selector found.'));
}
/**
@@ -598,8 +598,8 @@ class FilterDefaultFormatTestCase extends DrupalWebTestCase {
// Check that each user's default format is the lowest weighted format that
// the user has access to.
- $this->assertEqual(filter_default_format($first_user), $first_format->format, "The first user's default format is the lowest weighted format that the user has access to.");
- $this->assertEqual(filter_default_format($second_user), $second_format->format, "The second user's default format is the lowest weighted format that the user has access to, and is different than the first user's.");
+ $this->assertEqual(filter_default_format($first_user), $first_format->format, t("The first user's default format is the lowest weighted format that the user has access to."));
+ $this->assertEqual(filter_default_format($second_user), $second_format->format, t("The second user's default format is the lowest weighted format that the user has access to, and is different than the first user's."));
// Reorder the two formats, and check that both users now have the same
// default.
@@ -607,7 +607,7 @@ class FilterDefaultFormatTestCase extends DrupalWebTestCase {
$edit['formats[' . $second_format->format . '][weight]'] = $minimum_weight - 3;
$this->drupalPost('admin/config/content/formats', $edit, t('Save changes'));
$this->resetFilterCaches();
- $this->assertEqual(filter_default_format($first_user), filter_default_format($second_user), 'After the formats are reordered, both users have the same default format.');
+ $this->assertEqual(filter_default_format($first_user), filter_default_format($second_user), t('After the formats are reordered, both users have the same default format.'));
}
/**
@@ -635,7 +635,7 @@ class FilterNoFormatTestCase extends DrupalWebTestCase {
// Make sure that when this text is run through check_markup() with no text
// format, it is filtered as though it is in the fallback format.
- $this->assertEqual(check_markup($text), check_markup($text, filter_fallback_format()), 'Text with no format is filtered the same as text in the fallback format.');
+ $this->assertEqual(check_markup($text), check_markup($text, filter_fallback_format()), t('Text with no format is filtered the same as text in the fallback format.'));
}
}
@@ -658,24 +658,24 @@ class FilterUnitTestCase extends DrupalUnitTestCase {
// Single line breaks should be changed to <br /> tags, while paragraphs
// separated with double line breaks should be enclosed with <p></p> tags.
$f = _filter_autop("aaa\nbbb\n\nccc");
- $this->assertEqual(str_replace("\n", '', $f), "<p>aaa<br />bbb</p><p>ccc</p>", 'Line breaking basic case.');
+ $this->assertEqual(str_replace("\n", '', $f), "<p>aaa<br />bbb</p><p>ccc</p>", t('Line breaking basic case.'));
// Text within some contexts should not be processed.
$f = _filter_autop("<script>aaa\nbbb\n\nccc</script>");
- $this->assertEqual($f, "<script>aaa\nbbb\n\nccc</script>", 'Line breaking -- do not break scripts.');
+ $this->assertEqual($f, "<script>aaa\nbbb\n\nccc</script>", t('Line breaking -- do not break scripts.'));
$f = _filter_autop('<p><div> </div></p>');
- $this->assertEqual(substr_count($f, '<p>'), substr_count($f, '</p>'), 'Make sure line breaking produces matching paragraph tags.');
+ $this->assertEqual(substr_count($f, '<p>'), substr_count($f, '</p>'), t('Make sure line breaking produces matching paragraph tags.'));
$f = _filter_autop('<div><p> </p></div>');
- $this->assertEqual(substr_count($f, '<p>'), substr_count($f, '</p>'), 'Make sure line breaking produces matching paragraph tags.');
+ $this->assertEqual(substr_count($f, '<p>'), substr_count($f, '</p>'), t('Make sure line breaking produces matching paragraph tags.'));
$f = _filter_autop('<blockquote><pre>aaa</pre></blockquote>');
- $this->assertEqual(substr_count($f, '<p>'), substr_count($f, '</p>'), 'Make sure line breaking produces matching paragraph tags.');
+ $this->assertEqual(substr_count($f, '<p>'), substr_count($f, '</p>'), t('Make sure line breaking produces matching paragraph tags.'));
$limit = max(ini_get('pcre.backtrack_limit'), ini_get('pcre.recursion_limit'));
$f = _filter_autop($this->randomName($limit));
- $this->assertNotEqual($f, '', 'Make sure line breaking can process long strings.');
+ $this->assertNotEqual($f, '', t('Make sure line breaking can process long strings.'));
}
/**
@@ -693,172 +693,172 @@ class FilterUnitTestCase extends DrupalUnitTestCase {
function testHtmlFilter() {
// Tag stripping, different ways to work around removal of HTML tags.
$f = filter_xss('<script>alert(0)</script>');
- $this->assertNoNormalized($f, 'script', 'HTML tag stripping -- simple script without special characters.');
+ $this->assertNoNormalized($f, 'script', t('HTML tag stripping -- simple script without special characters.'));
$f = filter_xss('<script src="http://www.example.com" />');
- $this->assertNoNormalized($f, 'script', 'HTML tag stripping -- empty script with source.');
+ $this->assertNoNormalized($f, 'script', t('HTML tag stripping -- empty script with source.'));
$f = filter_xss('<ScRipt sRc=http://www.example.com/>');
- $this->assertNoNormalized($f, 'script', 'HTML tag stripping evasion -- varying case.');
+ $this->assertNoNormalized($f, 'script', t('HTML tag stripping evasion -- varying case.'));
$f = filter_xss("<script\nsrc\n=\nhttp://www.example.com/\n>");
- $this->assertNoNormalized($f, 'script', 'HTML tag stripping evasion -- multiline tag.');
+ $this->assertNoNormalized($f, 'script', t('HTML tag stripping evasion -- multiline tag.'));
$f = filter_xss('<script/a src=http://www.example.com/a.js></script>');
- $this->assertNoNormalized($f, 'script', 'HTML tag stripping evasion -- non whitespace character after tag name.');
+ $this->assertNoNormalized($f, 'script', t('HTML tag stripping evasion -- non whitespace character after tag name.'));
$f = filter_xss('<script/src=http://www.example.com/a.js></script>');
- $this->assertNoNormalized($f, 'script', 'HTML tag stripping evasion -- no space between tag and attribute.');
+ $this->assertNoNormalized($f, 'script', t('HTML tag stripping evasion -- no space between tag and attribute.'));
// Null between < and tag name works at least with IE6.
$f = filter_xss("<\0scr\0ipt>alert(0)</script>");
- $this->assertNoNormalized($f, 'ipt', 'HTML tag stripping evasion -- breaking HTML with nulls.');
+ $this->assertNoNormalized($f, 'ipt', t('HTML tag stripping evasion -- breaking HTML with nulls.'));
$f = filter_xss("<scrscriptipt src=http://www.example.com/a.js>");
- $this->assertNoNormalized($f, 'script', 'HTML tag stripping evasion -- filter just removing "script".');
+ $this->assertNoNormalized($f, 'script', t('HTML tag stripping evasion -- filter just removing "script".'));
$f = filter_xss('<<script>alert(0);//<</script>');
- $this->assertNoNormalized($f, 'script', 'HTML tag stripping evasion -- double opening brackets.');
+ $this->assertNoNormalized($f, 'script', t('HTML tag stripping evasion -- double opening brackets.'));
$f = filter_xss('<script src=http://www.example.com/a.js?<b>');
- $this->assertNoNormalized($f, 'script', 'HTML tag stripping evasion -- no closing tag.');
+ $this->assertNoNormalized($f, 'script', t('HTML tag stripping evasion -- no closing tag.'));
// DRUPAL-SA-2008-047: This doesn't seem exploitable, but the filter should
// work consistently.
$f = filter_xss('<script>>');
- $this->assertNoNormalized($f, 'script', 'HTML tag stripping evasion -- double closing tag.');
+ $this->assertNoNormalized($f, 'script', t('HTML tag stripping evasion -- double closing tag.'));
$f = filter_xss('<script src=//www.example.com/.a>');
- $this->assertNoNormalized($f, 'script', 'HTML tag stripping evasion -- no scheme or ending slash.');
+ $this->assertNoNormalized($f, 'script', t('HTML tag stripping evasion -- no scheme or ending slash.'));
$f = filter_xss('<script src=http://www.example.com/.a');
- $this->assertNoNormalized($f, 'script', 'HTML tag stripping evasion -- no closing bracket.');
+ $this->assertNoNormalized($f, 'script', t('HTML tag stripping evasion -- no closing bracket.'));
$f = filter_xss('<script src=http://www.example.com/ <');
- $this->assertNoNormalized($f, 'script', 'HTML tag stripping evasion -- opening instead of closing bracket.');
+ $this->assertNoNormalized($f, 'script', t('HTML tag stripping evasion -- opening instead of closing bracket.'));
$f = filter_xss('<nosuchtag attribute="newScriptInjectionVector">');
- $this->assertNoNormalized($f, 'nosuchtag', 'HTML tag stripping evasion -- unknown tag.');
+ $this->assertNoNormalized($f, 'nosuchtag', t('HTML tag stripping evasion -- unknown tag.'));
$f = filter_xss('<?xml:namespace ns="urn:schemas-microsoft-com:time">');
- $this->assertTrue(stripos($f, '<?xml') === FALSE, 'HTML tag stripping evasion -- starting with a question sign (processing instructions).');
+ $this->assertTrue(stripos($f, '<?xml') === FALSE, t('HTML tag stripping evasion -- starting with a question sign (processing instructions).'));
$f = filter_xss('<t:set attributeName="innerHTML" to="&lt;script defer&gt;alert(0)&lt;/script&gt;">');
- $this->assertNoNormalized($f, 't:set', 'HTML tag stripping evasion -- colon in the tag name (namespaces\' tricks).');
+ $this->assertNoNormalized($f, 't:set', t('HTML tag stripping evasion -- colon in the tag name (namespaces\' tricks).'));
$f = filter_xss('<img """><script>alert(0)</script>', array('img'));
- $this->assertNoNormalized($f, 'script', 'HTML tag stripping evasion -- a malformed image tag.');
+ $this->assertNoNormalized($f, 'script', t('HTML tag stripping evasion -- a malformed image tag.'));
$f = filter_xss('<blockquote><script>alert(0)</script></blockquote>', array('blockquote'));
- $this->assertNoNormalized($f, 'script', 'HTML tag stripping evasion -- script in a blockqoute.');
+ $this->assertNoNormalized($f, 'script', t('HTML tag stripping evasion -- script in a blockqoute.'));
$f = filter_xss("<!--[if true]><script>alert(0)</script><![endif]-->");
- $this->assertNoNormalized($f, 'script', 'HTML tag stripping evasion -- script within a comment.');
+ $this->assertNoNormalized($f, 'script', t('HTML tag stripping evasion -- script within a comment.'));
// Dangerous attributes removal.
$f = filter_xss('<p onmouseover="http://www.example.com/">', array('p'));
- $this->assertNoNormalized($f, 'onmouseover', 'HTML filter attributes removal -- events, no evasion.');
+ $this->assertNoNormalized($f, 'onmouseover', t('HTML filter attributes removal -- events, no evasion.'));
$f = filter_xss('<li style="list-style-image: url(javascript:alert(0))">', array('li'));
- $this->assertNoNormalized($f, 'style', 'HTML filter attributes removal -- style, no evasion.');
+ $this->assertNoNormalized($f, 'style', t('HTML filter attributes removal -- style, no evasion.'));
$f = filter_xss('<img onerror =alert(0)>', array('img'));
- $this->assertNoNormalized($f, 'onerror', 'HTML filter attributes removal evasion -- spaces before equals sign.');
+ $this->assertNoNormalized($f, 'onerror', t('HTML filter attributes removal evasion -- spaces before equals sign.'));
$f = filter_xss('<img onabort!#$%&()*~+-_.,:;?@[/|\]^`=alert(0)>', array('img'));
- $this->assertNoNormalized($f, 'onabort', 'HTML filter attributes removal evasion -- non alphanumeric characters before equals sign.');
+ $this->assertNoNormalized($f, 'onabort', t('HTML filter attributes removal evasion -- non alphanumeric characters before equals sign.'));
$f = filter_xss('<img oNmediAError=alert(0)>', array('img'));
- $this->assertNoNormalized($f, 'onmediaerror', 'HTML filter attributes removal evasion -- varying case.');
+ $this->assertNoNormalized($f, 'onmediaerror', t('HTML filter attributes removal evasion -- varying case.'));
// Works at least with IE6.
$f = filter_xss("<img o\0nfocus\0=alert(0)>", array('img'));
- $this->assertNoNormalized($f, 'focus', 'HTML filter attributes removal evasion -- breaking with nulls.');
+ $this->assertNoNormalized($f, 'focus', t('HTML filter attributes removal evasion -- breaking with nulls.'));
// Only whitelisted scheme names allowed in attributes.
$f = filter_xss('<img src="javascript:alert(0)">', array('img'));
- $this->assertNoNormalized($f, 'javascript', 'HTML scheme clearing -- no evasion.');
+ $this->assertNoNormalized($f, 'javascript', t('HTML scheme clearing -- no evasion.'));
$f = filter_xss('<img src=javascript:alert(0)>', array('img'));
- $this->assertNoNormalized($f, 'javascript', 'HTML scheme clearing evasion -- no quotes.');
+ $this->assertNoNormalized($f, 'javascript', t('HTML scheme clearing evasion -- no quotes.'));
// A bit like CVE-2006-0070.
$f = filter_xss('<img src="javascript:confirm(0)">', array('img'));
- $this->assertNoNormalized($f, 'javascript', 'HTML scheme clearing evasion -- no alert ;)');
+ $this->assertNoNormalized($f, 'javascript', t('HTML scheme clearing evasion -- no alert ;)'));
$f = filter_xss('<img src=`javascript:alert(0)`>', array('img'));
- $this->assertNoNormalized($f, 'javascript', 'HTML scheme clearing evasion -- grave accents.');
+ $this->assertNoNormalized($f, 'javascript', t('HTML scheme clearing evasion -- grave accents.'));
$f = filter_xss('<img dynsrc="javascript:alert(0)">', array('img'));
- $this->assertNoNormalized($f, 'javascript', 'HTML scheme clearing -- rare attribute.');
+ $this->assertNoNormalized($f, 'javascript', t('HTML scheme clearing -- rare attribute.'));
$f = filter_xss('<table background="javascript:alert(0)">', array('table'));
- $this->assertNoNormalized($f, 'javascript', 'HTML scheme clearing -- another tag.');
+ $this->assertNoNormalized($f, 'javascript', t('HTML scheme clearing -- another tag.'));
$f = filter_xss('<base href="javascript:alert(0);//">', array('base'));
- $this->assertNoNormalized($f, 'javascript', 'HTML scheme clearing -- one more attribute and tag.');
+ $this->assertNoNormalized($f, 'javascript', t('HTML scheme clearing -- one more attribute and tag.'));
$f = filter_xss('<img src="jaVaSCriPt:alert(0)">', array('img'));
- $this->assertNoNormalized($f, 'javascript', 'HTML scheme clearing evasion -- varying case.');
+ $this->assertNoNormalized($f, 'javascript', t('HTML scheme clearing evasion -- varying case.'));
$f = filter_xss('<img src=&#106;&#97;&#118;&#97;&#115;&#99;&#114;&#105;&#112;&#116;&#58;&#97;&#108;&#101;&#114;&#116;&#40;&#48;&#41;>', array('img'));
- $this->assertNoNormalized($f, 'javascript', 'HTML scheme clearing evasion -- UTF-8 decimal encoding.');
+ $this->assertNoNormalized($f, 'javascript', t('HTML scheme clearing evasion -- UTF-8 decimal encoding.'));
$f = filter_xss('<img src=&#00000106&#0000097&#00000118&#0000097&#00000115&#0000099&#00000114&#00000105&#00000112&#00000116&#0000058&#0000097&#00000108&#00000101&#00000114&#00000116&#0000040&#0000048&#0000041>', array('img'));
- $this->assertNoNormalized($f, 'javascript', 'HTML scheme clearing evasion -- long UTF-8 encoding.');
+ $this->assertNoNormalized($f, 'javascript', t('HTML scheme clearing evasion -- long UTF-8 encoding.'));
$f = filter_xss('<img src=&#x6A&#x61&#x76&#x61&#x73&#x63&#x72&#x69&#x70&#x74&#x3A&#x61&#x6C&#x65&#x72&#x74&#x28&#x30&#x29>', array('img'));
- $this->assertNoNormalized($f, 'javascript', 'HTML scheme clearing evasion -- UTF-8 hex encoding.');
+ $this->assertNoNormalized($f, 'javascript', t('HTML scheme clearing evasion -- UTF-8 hex encoding.'));
$f = filter_xss("<img src=\"jav\tascript:alert(0)\">", array('img'));
- $this->assertNoNormalized($f, 'script', 'HTML scheme clearing evasion -- an embedded tab.');
+ $this->assertNoNormalized($f, 'script', t('HTML scheme clearing evasion -- an embedded tab.'));
$f = filter_xss('<img src="jav&#x09;ascript:alert(0)">', array('img'));
- $this->assertNoNormalized($f, 'script', 'HTML scheme clearing evasion -- an encoded, embedded tab.');
+ $this->assertNoNormalized($f, 'script', t('HTML scheme clearing evasion -- an encoded, embedded tab.'));
$f = filter_xss('<img src="jav&#x000000A;ascript:alert(0)">', array('img'));
- $this->assertNoNormalized($f, 'script', 'HTML scheme clearing evasion -- an encoded, embedded newline.');
+ $this->assertNoNormalized($f, 'script', t('HTML scheme clearing evasion -- an encoded, embedded newline.'));
// With &#xD; this test would fail, but the entity gets turned into
// &amp;#xD;, so it's OK.
$f = filter_xss('<img src="jav&#x0D;ascript:alert(0)">', array('img'));
- $this->assertNoNormalized($f, 'script', 'HTML scheme clearing evasion -- an encoded, embedded carriage return.');
+ $this->assertNoNormalized($f, 'script', t('HTML scheme clearing evasion -- an encoded, embedded carriage return.'));
$f = filter_xss("<img src=\"\n\n\nj\na\nva\ns\ncript:alert(0)\">", array('img'));
- $this->assertNoNormalized($f, 'cript', 'HTML scheme clearing evasion -- broken into many lines.');
+ $this->assertNoNormalized($f, 'cript', t('HTML scheme clearing evasion -- broken into many lines.'));
$f = filter_xss("<img src=\"jav\0a\0\0cript:alert(0)\">", array('img'));
- $this->assertNoNormalized($f, 'cript', 'HTML scheme clearing evasion -- embedded nulls.');
+ $this->assertNoNormalized($f, 'cript', t('HTML scheme clearing evasion -- embedded nulls.'));
$f = filter_xss('<img src=" &#14; javascript:alert(0)">', array('img'));
- $this->assertNoNormalized($f, 'javascript', 'HTML scheme clearing evasion -- spaces and metacharacters before scheme.');
+ $this->assertNoNormalized($f, 'javascript', t('HTML scheme clearing evasion -- spaces and metacharacters before scheme.'));
$f = filter_xss('<img src="vbscript:msgbox(0)">', array('img'));
- $this->assertNoNormalized($f, 'vbscript', 'HTML scheme clearing evasion -- another scheme.');
+ $this->assertNoNormalized($f, 'vbscript', t('HTML scheme clearing evasion -- another scheme.'));
$f = filter_xss('<img src="nosuchscheme:notice(0)">', array('img'));
- $this->assertNoNormalized($f, 'nosuchscheme', 'HTML scheme clearing evasion -- unknown scheme.');
+ $this->assertNoNormalized($f, 'nosuchscheme', t('HTML scheme clearing evasion -- unknown scheme.'));
// Netscape 4.x javascript entities.
$f = filter_xss('<br size="&{alert(0)}">', array('br'));
- $this->assertNoNormalized($f, 'alert', 'Netscape 4.x javascript entities.');
+ $this->assertNoNormalized($f, 'alert', t('Netscape 4.x javascript entities.'));
// DRUPAL-SA-2008-006: Invalid UTF-8, these only work as reflected XSS with
// Internet Explorer 6.
$f = filter_xss("<p arg=\"\xe0\">\" style=\"background-image: url(javascript:alert(0));\"\xe0<p>", array('p'));
- $this->assertNoNormalized($f, 'style', 'HTML filter -- invalid UTF-8.');
+ $this->assertNoNormalized($f, 'style', t('HTML filter -- invalid UTF-8.'));
$f = filter_xss("\xc0aaa");
- $this->assertEqual($f, '', 'HTML filter -- overlong UTF-8 sequences.');
+ $this->assertEqual($f, '', t('HTML filter -- overlong UTF-8 sequences.'));
$f = filter_xss("Who&#039;s Online");
- $this->assertNormalized($f, "who's online", 'HTML filter -- html entity number');
+ $this->assertNormalized($f, "who's online", t('HTML filter -- html entity number'));
$f = filter_xss("Who&amp;#039;s Online");
- $this->assertNormalized($f, "who&#039;s online", 'HTML filter -- encoded html entity number');
+ $this->assertNormalized($f, "who&#039;s online", t('HTML filter -- encoded html entity number'));
$f = filter_xss("Who&amp;amp;#039; Online");
- $this->assertNormalized($f, "who&amp;#039; online", 'HTML filter -- double encoded html entity number');
+ $this->assertNormalized($f, "who&amp;#039; online", t('HTML filter -- double encoded html entity number'));
}
/**
@@ -887,34 +887,34 @@ class FilterUnitTestCase extends DrupalUnitTestCase {
// HTML filter is not able to secure some tags, these should never be
// allowed.
$f = _filter_html('<script />', $filter);
- $this->assertNoNormalized($f, 'script', 'HTML filter should always remove script tags.');
+ $this->assertNoNormalized($f, 'script', t('HTML filter should always remove script tags.'));
$f = _filter_html('<iframe />', $filter);
- $this->assertNoNormalized($f, 'iframe', 'HTML filter should always remove iframe tags.');
+ $this->assertNoNormalized($f, 'iframe', t('HTML filter should always remove iframe tags.'));
$f = _filter_html('<object />', $filter);
- $this->assertNoNormalized($f, 'object', 'HTML filter should always remove object tags.');
+ $this->assertNoNormalized($f, 'object', t('HTML filter should always remove object tags.'));
$f = _filter_html('<style />', $filter);
- $this->assertNoNormalized($f, 'style', 'HTML filter should always remove style tags.');
+ $this->assertNoNormalized($f, 'style', t('HTML filter should always remove style tags.'));
// Some tags make CSRF attacks easier, let the user take the risk herself.
$f = _filter_html('<img />', $filter);
- $this->assertNoNormalized($f, 'img', 'HTML filter should remove img tags on default.');
+ $this->assertNoNormalized($f, 'img', t('HTML filter should remove img tags on default.'));
$f = _filter_html('<input />', $filter);
- $this->assertNoNormalized($f, 'img', 'HTML filter should remove input tags on default.');
+ $this->assertNoNormalized($f, 'img', t('HTML filter should remove input tags on default.'));
// Filtering content of some attributes is infeasible, these shouldn't be
// allowed too.
$f = _filter_html('<p style="display: none;" />', $filter);
- $this->assertNoNormalized($f, 'style', 'HTML filter should remove style attribute on default.');
+ $this->assertNoNormalized($f, 'style', t('HTML filter should remove style attribute on default.'));
$f = _filter_html('<p onerror="alert(0);" />', $filter);
- $this->assertNoNormalized($f, 'onerror', 'HTML filter should remove on* attributes on default.');
+ $this->assertNoNormalized($f, 'onerror', t('HTML filter should remove on* attributes on default.'));
- $f = _filter_html('<code onerror>&nbsp;</code>', $filter);
- $this->assertNoNormalized($f, 'onerror', 'HTML filter should remove empty on* attributes on default.');
+ $f = _filter_html('<code onerror>&nbsp;</code>', $filter);
+ $this->assertNoNormalized($f, 'onerror', t('HTML filter should remove empty on* attributes on default.'));
}
/**
@@ -932,23 +932,23 @@ class FilterUnitTestCase extends DrupalUnitTestCase {
// Test if the rel="nofollow" attribute is added, even if we try to prevent
// it.
$f = _filter_html('<a href="http://www.example.com/">text</a>', $filter);
- $this->assertNormalized($f, 'rel="nofollow"', 'Spam deterrent -- no evasion.');
+ $this->assertNormalized($f, 'rel="nofollow"', t('Spam deterrent -- no evasion.'));
$f = _filter_html('<A href="http://www.example.com/">text</a>', $filter);
- $this->assertNormalized($f, 'rel="nofollow"', 'Spam deterrent evasion -- capital A.');
+ $this->assertNormalized($f, 'rel="nofollow"', t('Spam deterrent evasion -- capital A.'));
$f = _filter_html("<a/href=\"http://www.example.com/\">text</a>", $filter);
- $this->assertNormalized($f, 'rel="nofollow"', 'Spam deterrent evasion -- non whitespace character after tag name.');
+ $this->assertNormalized($f, 'rel="nofollow"', t('Spam deterrent evasion -- non whitespace character after tag name.'));
$f = _filter_html("<\0a\0 href=\"http://www.example.com/\">text</a>", $filter);
- $this->assertNormalized($f, 'rel="nofollow"', 'Spam deterrent evasion -- some nulls.');
+ $this->assertNormalized($f, 'rel="nofollow"', t('Spam deterrent evasion -- some nulls.'));
$f = _filter_html('<!--[if true]><a href="http://www.example.com/">text</a><![endif]-->', $filter);
- $this->assertNormalized($f, 'rel="nofollow"', 'Spam deterrent evasion -- link within a comment.');
+ $this->assertNormalized($f, 'rel="nofollow"', t('Spam deterrent evasion -- link within a comment.'));
$f = _filter_html('<a href="http://www.example.com/" rel="follow">text</a>', $filter);
- $this->assertNoNormalized($f, 'rel="follow"', 'Spam deterrent evasion -- with rel set - rel="follow" removed.');
- $this->assertNormalized($f, 'rel="nofollow"', 'Spam deterrent evasion -- with rel set - rel="nofollow" added.');
+ $this->assertNoNormalized($f, 'rel="follow"', t('Spam deterrent evasion -- with rel set - rel="follow" removed.'));
+ $this->assertNormalized($f, 'rel="nofollow"', t('Spam deterrent evasion -- with rel set - rel="nofollow" added.'));
}
/**
@@ -957,13 +957,13 @@ class FilterUnitTestCase extends DrupalUnitTestCase {
function testAdminHtmlFilter() {
// DRUPAL-SA-2008-044
$f = filter_xss_admin('<object />');
- $this->assertNoNormalized($f, 'object', 'Admin HTML filter -- should not allow object tag.');
+ $this->assertNoNormalized($f, 'object', t('Admin HTML filter -- should not allow object tag.'));
$f = filter_xss_admin('<script />');
- $this->assertNoNormalized($f, 'script', 'Admin HTML filter -- should not allow script tag.');
+ $this->assertNoNormalized($f, 'script', t('Admin HTML filter -- should not allow script tag.'));
$f = filter_xss_admin('<style /><iframe /><frame /><frameset /><meta /><link /><embed /><applet /><param /><layer />');
- $this->assertEqual($f, '', 'Admin HTML filter -- should never allow some tags.');
+ $this->assertEqual($f, '', t('Admin HTML filter -- should never allow some tags.'));
}
/**
@@ -992,73 +992,73 @@ class FilterUnitTestCase extends DrupalUnitTestCase {
// Converting URLs.
$f = _filter_url('http://www.example.com/', $filter);
- $this->assertEqual($f, '<a href="http://www.example.com/">http://www.example.com/</a>', 'Converting URLs.');
+ $this->assertEqual($f, '<a href="http://www.example.com/">http://www.example.com/</a>', t('Converting URLs.'));
$f = _filter_url('http://www.example.com/?a=1&b=2', $filter);
- $this->assertEqual($f, '<a href="http://www.example.com/?a=1&amp;b=2">http://www.example.com/?a=1&amp;b=2</a>', 'Converting URLs -- ampersands.');
+ $this->assertEqual($f, '<a href="http://www.example.com/?a=1&amp;b=2">http://www.example.com/?a=1&amp;b=2</a>', t('Converting URLs -- ampersands.'));
$f = _filter_url('ftp://user:pass@ftp.example.com/dir1/dir2', $filter);
- $this->assertEqual($f, '<a href="ftp://user:pass@ftp.example.com/dir1/dir2">ftp://user:pass@ftp.example.com/dir1/dir2</a>', 'Converting URLs -- FTP scheme.');
+ $this->assertEqual($f, '<a href="ftp://user:pass@ftp.example.com/dir1/dir2">ftp://user:pass@ftp.example.com/dir1/dir2</a>', t('Converting URLs -- FTP scheme.'));
// Converting domain names.
$f = _filter_url('www.example.com', $filter);
- $this->assertEqual($f, '<a href="http://www.example.com">www.example.com</a>', 'Converting domain names.');
+ $this->assertEqual($f, '<a href="http://www.example.com">www.example.com</a>', t('Converting domain names.'));
$f = _filter_url('<li>www.example.com</li>', $filter);
- $this->assertEqual($f, '<li><a href="http://www.example.com">www.example.com</a></li>', 'Converting domain names -- domain in a list.');
+ $this->assertEqual($f, '<li><a href="http://www.example.com">www.example.com</a></li>', t('Converting domain names -- domain in a list.'));
$f = _filter_url('(www.example.com/dir?a=1&b=2#a)', $filter);
- $this->assertEqual($f, '(<a href="http://www.example.com/dir?a=1&amp;b=2#a">www.example.com/dir?a=1&amp;b=2#a</a>)', 'Converting domain names -- domain in parentheses.');
+ $this->assertEqual($f, '(<a href="http://www.example.com/dir?a=1&amp;b=2#a">www.example.com/dir?a=1&amp;b=2#a</a>)', t('Converting domain names -- domain in parentheses.'));
// Converting e-mail addresses.
$f = _filter_url('johndoe@example.com', $filter);
- $this->assertEqual($f, '<a href="mailto:johndoe@example.com">johndoe@example.com</a>', 'Converting e-mail addresses.');
+ $this->assertEqual($f, '<a href="mailto:johndoe@example.com">johndoe@example.com</a>', t('Converting e-mail addresses.'));
$f = _filter_url('aaa@sub.tv', $filter);
- $this->assertEqual($f, '<a href="mailto:aaa@sub.tv">aaa@sub.tv</a>', 'Converting e-mail addresses -- a short e-mail from Tuvalu.');
+ $this->assertEqual($f, '<a href="mailto:aaa@sub.tv">aaa@sub.tv</a>', t('Converting e-mail addresses -- a short e-mail from Tuvalu.'));
// URL trimming.
$filter->settings['filter_url_length'] = 28;
$f = _filter_url('http://www.example.com/d/ff.ext?a=1&b=2#a1', $filter);
- $this->assertNormalized($f, 'http://www.example.com/d/ff....', 'URL trimming.');
+ $this->assertNormalized($f, 'http://www.example.com/d/ff....', t('URL trimming.'));
// Not breaking existing links.
$f = _filter_url('<a href="http://www.example.com">www.example.com</a>', $filter);
- $this->assertEqual($f, '<a href="http://www.example.com">www.example.com</a>', 'Converting URLs -- do not break existing links.');
+ $this->assertEqual($f, '<a href="http://www.example.com">www.example.com</a>', t('Converting URLs -- do not break existing links.'));
$f = _filter_url('<a href="foo">http://www.example.com</a>', $filter);
- $this->assertEqual($f, '<a href="foo">http://www.example.com</a>', 'Converting URLs -- do not break existing, relative links.');
+ $this->assertEqual($f, '<a href="foo">http://www.example.com</a>', t('Converting URLs -- do not break existing, relative links.'));
// Addresses within some tags such as code or script should not be converted.
$f = _filter_url('<code>http://www.example.com</code>', $filter);
- $this->assertEqual($f, '<code>http://www.example.com</code>', 'Converting URLs -- skip code contents.');
+ $this->assertEqual($f, '<code>http://www.example.com</code>', t('Converting URLs -- skip code contents.'));
$f = _filter_url('<code><em>http://www.example.com</em></code>', $filter);
- $this->assertEqual($f, '<code><em>http://www.example.com</em></code>', 'Converting URLs -- really skip code contents.');
+ $this->assertEqual($f, '<code><em>http://www.example.com</em></code>', t('Converting URLs -- really skip code contents.'));
$f = _filter_url('<script>http://www.example.com</script>', $filter);
- $this->assertEqual($f, '<script>http://www.example.com</script>', 'Converting URLs -- do not process scripts.');
+ $this->assertEqual($f, '<script>http://www.example.com</script>', t('Converting URLs -- do not process scripts.'));
// Addresses in attributes should not be converted.
$f = _filter_url('<p xmlns="http://www.example.com" />', $filter);
- $this->assertEqual($f, '<p xmlns="http://www.example.com" />', 'Converting URLs -- do not convert addresses in attributes.');
+ $this->assertEqual($f, '<p xmlns="http://www.example.com" />', t('Converting URLs -- do not convert addresses in attributes.'));
$f = _filter_url('<a title="Go to www.example.com" href="http://www.example.com">text</a>', $filter);
- $this->assertEqual($f, '<a title="Go to www.example.com" href="http://www.example.com">text</a>', 'Converting URLs -- do not break existing links with custom title attribute.');
+ $this->assertEqual($f, '<a title="Go to www.example.com" href="http://www.example.com">text</a>', t('Converting URLs -- do not break existing links with custom title attribute.'));
// Even though a dot at the end of a URL can indicate a fully qualified
// domain name, such usage is rare compared to using a link at the end
// of a sentence, so remove the dot from the link.
// @todo It can also be used at the end of a filename or a query string.
$f = _filter_url('www.example.com.', $filter);
- $this->assertEqual($f, '<a href="http://www.example.com">www.example.com</a>.', 'Converting URLs -- do not recognize a dot at the end of a domain name (FQDNs).');
+ $this->assertEqual($f, '<a href="http://www.example.com">www.example.com</a>.', t('Converting URLs -- do not recognize a dot at the end of a domain name (FQDNs).'));
$f = _filter_url('http://www.example.com.', $filter);
- $this->assertEqual($f, '<a href="http://www.example.com">http://www.example.com</a>.', 'Converting URLs -- do not recognize a dot at the end of an URL (FQDNs).');
+ $this->assertEqual($f, '<a href="http://www.example.com">http://www.example.com</a>.', t('Converting URLs -- do not recognize a dot at the end of an URL (FQDNs).'));
$f = _filter_url('www.example.com/index.php?a=.', $filter);
- $this->assertEqual($f, '<a href="http://www.example.com/index.php?a=">www.example.com/index.php?a=</a>.', 'Converting URLs -- do forget about a dot at the end of a query string.');
+ $this->assertEqual($f, '<a href="http://www.example.com/index.php?a=">www.example.com/index.php?a=</a>.', t('Converting URLs -- do forget about a dot at the end of a query string.'));
}
/**
@@ -1069,114 +1069,114 @@ class FilterUnitTestCase extends DrupalUnitTestCase {
function testHtmlCorrectorFilter() {
// Tag closing.
$f = _filter_htmlcorrector('<p>text');
- $this->assertEqual($f, '<p>text</p>', 'HTML corrector -- tag closing at the end of input.');
+ $this->assertEqual($f, '<p>text</p>', t('HTML corrector -- tag closing at the end of input.'));
$f = _filter_htmlcorrector('<p>text<p><p>text');
- $this->assertEqual($f, '<p>text</p><p></p><p>text</p>', 'HTML corrector -- tag closing.');
+ $this->assertEqual($f, '<p>text</p><p></p><p>text</p>', t('HTML corrector -- tag closing.'));
$f = _filter_htmlcorrector("<ul><li>e1<li>e2");
- $this->assertEqual($f, "<ul><li>e1</li><li>e2</li></ul>", 'HTML corrector -- unclosed list tags.');
+ $this->assertEqual($f, "<ul><li>e1</li><li>e2</li></ul>", t('HTML corrector -- unclosed list tags.'));
$f = _filter_htmlcorrector('<div id="d">content');
- $this->assertEqual($f, '<div id="d">content</div>', 'HTML corrector -- unclosed tag with attribute.');
+ $this->assertEqual($f, '<div id="d">content</div>', t('HTML corrector -- unclosed tag with attribute.'));
// XHTML slash for empty elements.
$f = _filter_htmlcorrector('<hr><br>');
- $this->assertEqual($f, '<hr /><br />', 'HTML corrector -- XHTML closing slash.');
+ $this->assertEqual($f, '<hr /><br />', t('HTML corrector -- XHTML closing slash.'));
$f = _filter_htmlcorrector('<P>test</P>');
- $this->assertEqual($f, '<p>test</p>', 'HTML corrector -- Convert uppercased tags to proper lowercased ones.');
+ $this->assertEqual($f, '<p>test</p>', t('HTML corrector -- Convert uppercased tags to proper lowercased ones.'));
$f = _filter_htmlcorrector('<P>test</p>');
- $this->assertEqual($f, '<p>test</p>', 'HTML corrector -- Convert uppercased tags to proper lowercased ones.');
+ $this->assertEqual($f, '<p>test</p>', t('HTML corrector -- Convert uppercased tags to proper lowercased ones.'));
$f = _filter_htmlcorrector('test<hr />');
- $this->assertEqual($f, 'test<hr />', 'HTML corrector -- Let proper XHTML pass through.');
+ $this->assertEqual($f, 'test<hr />', t('HTML corrector -- Let proper XHTML pass through.'));
$f = _filter_htmlcorrector('test<hr/>');
- $this->assertEqual($f, 'test<hr />', 'HTML corrector -- Let proper XHTML pass through, but ensure there is a single space before the closing slash.');
+ $this->assertEqual($f, 'test<hr />', t('HTML corrector -- Let proper XHTML pass through, but ensure there is a single space before the closing slash.'));
$f = _filter_htmlcorrector('test<hr />');
- $this->assertEqual($f, 'test<hr />', 'HTML corrector -- Let proper XHTML pass through, but ensure there are not too many spaces before the closing slash.');
+ $this->assertEqual($f, 'test<hr />', t('HTML corrector -- Let proper XHTML pass through, but ensure there are not too many spaces before the closing slash.'));
$f = _filter_htmlcorrector('<span class="test" />');
- $this->assertEqual($f, '<span class="test"></span>', 'HTML corrector -- Convert XHTML that is properly formed but that would not be compatible with typical HTML user agents.');
+ $this->assertEqual($f, '<span class="test"></span>', t('HTML corrector -- Convert XHTML that is properly formed but that would not be compatible with typical HTML user agents.'));
$f = _filter_htmlcorrector('test1<br class="test">test2');
- $this->assertEqual($f, 'test1<br class="test" />test2', 'HTML corrector -- Automatically close single tags.');
+ $this->assertEqual($f, 'test1<br class="test" />test2', t('HTML corrector -- Automatically close single tags.'));
$f = _filter_htmlcorrector('line1<hr>line2');
- $this->assertEqual($f, 'line1<hr />line2', 'HTML corrector -- Automatically close single tags.');
+ $this->assertEqual($f, 'line1<hr />line2', t('HTML corrector -- Automatically close single tags.'));
$f = _filter_htmlcorrector('line1<HR>line2');
- $this->assertEqual($f, 'line1<hr />line2', 'HTML corrector -- Automatically close single tags.');
+ $this->assertEqual($f, 'line1<hr />line2', t('HTML corrector -- Automatically close single tags.'));
$f = _filter_htmlcorrector('<img src="http://example.com/test.jpg">test</img>');
- $this->assertEqual($f, '<img src="http://example.com/test.jpg" />test', 'HTML corrector -- Automatically close single tags.');
+ $this->assertEqual($f, '<img src="http://example.com/test.jpg" />test', t('HTML corrector -- Automatically close single tags.'));
$f = _filter_htmlcorrector('<br></br>');
- $this->assertEqual($f, '<br />', "HTML corrector -- Transform empty tags to a single closed tag if the tag's content model is EMPTY.");
+ $this->assertEqual($f, '<br />', t("HTML corrector -- Transform empty tags to a single closed tag if the tag's content model is EMPTY."));
$f = _filter_htmlcorrector('<div></div>');
- $this->assertEqual($f, '<div></div>', "HTML corrector -- Do not transform empty tags to a single closed tag if the tag's content model is not EMPTY.");
+ $this->assertEqual($f, '<div></div>', t("HTML corrector -- Do not transform empty tags to a single closed tag if the tag's content model is not EMPTY."));
$f = _filter_htmlcorrector('<p>line1<br/><hr/>line2</p>');
- $this->assertEqual($f, '<p>line1<br /></p><hr />line2', 'HTML corrector -- Move non-inline elements outside of inline containers.');
+ $this->assertEqual($f, '<p>line1<br /></p><hr />line2', t('HTML corrector -- Move non-inline elements outside of inline containers.'));
$f = _filter_htmlcorrector('<p>line1<div>line2</div></p>');
- $this->assertEqual($f, '<p>line1</p><div>line2</div>', 'HTML corrector -- Move non-inline elements outside of inline containers.');
+ $this->assertEqual($f, '<p>line1</p><div>line2</div>', t('HTML corrector -- Move non-inline elements outside of inline containers.'));
$f = _filter_htmlcorrector('<p>test<p>test</p>\n');
- $this->assertEqual($f, '<p>test</p><p>test</p>\n', 'HTML corrector -- Auto-close improperly nested tags.');
+ $this->assertEqual($f, '<p>test</p><p>test</p>\n', t('HTML corrector -- Auto-close improperly nested tags.'));
$f = _filter_htmlcorrector('<p>Line1<br><STRONG>bold stuff</b>');
- $this->assertEqual($f, '<p>Line1<br /><strong>bold stuff</strong></p>', 'HTML corrector -- Properly close unclosed tags, and remove useless closing tags.');
+ $this->assertEqual($f, '<p>Line1<br /><strong>bold stuff</strong></p>', t('HTML corrector -- Properly close unclosed tags, and remove useless closing tags.'));
$f = _filter_htmlcorrector('test <!-- this is a comment -->');
- $this->assertEqual($f, 'test <!-- this is a comment -->', 'HTML corrector -- Do not touch HTML comments.');
+ $this->assertEqual($f, 'test <!-- this is a comment -->', t('HTML corrector -- Do not touch HTML comments.'));
$f = _filter_htmlcorrector('test <!--this is a comment-->');
- $this->assertEqual($f, 'test <!--this is a comment-->', 'HTML corrector -- Do not touch HTML comments.');
+ $this->assertEqual($f, 'test <!--this is a comment-->', t('HTML corrector -- Do not touch HTML comments.'));
$f = _filter_htmlcorrector('test <!-- comment <p>another
<strong>multiple</strong> line
comment</p> -->');
$this->assertEqual($f, 'test <!-- comment <p>another
<strong>multiple</strong> line
- comment</p> -->', 'HTML corrector -- Do not touch HTML comments.');
+ comment</p> -->', t('HTML corrector -- Do not touch HTML comments.'));
$f = _filter_htmlcorrector('test <!-- comment <p>another comment</p> -->');
- $this->assertEqual($f, 'test <!-- comment <p>another comment</p> -->', 'HTML corrector -- Do not touch HTML comments.');
+ $this->assertEqual($f, 'test <!-- comment <p>another comment</p> -->', t('HTML corrector -- Do not touch HTML comments.'));
$f = _filter_htmlcorrector('test <!--break-->');
- $this->assertEqual($f, 'test <!--break-->', 'HTML corrector -- Do not touch HTML comments.');
+ $this->assertEqual($f, 'test <!--break-->', t('HTML corrector -- Do not touch HTML comments.'));
$f = _filter_htmlcorrector('<p>test\n</p>\n');
- $this->assertEqual($f, '<p>test\n</p>\n', 'HTML corrector -- New-lines are accepted and kept as-is.');
+ $this->assertEqual($f, '<p>test\n</p>\n', t('HTML corrector -- New-lines are accepted and kept as-is.'));
$f = _filter_htmlcorrector('<p>دروبال');
- $this->assertEqual($f, '<p>دروبال</p>', 'HTML corrector -- Encoding is correctly kept.');
+ $this->assertEqual($f, '<p>دروبال</p>', t('HTML corrector -- Encoding is correctly kept.'));
$f = _filter_htmlcorrector('<script type="text/javascript">alert("test")</script>');
$this->assertEqual($f, '<script type="text/javascript">
<!--//--><![CDATA[// ><!--
alert("test")
//--><!]]>
-</script>', 'HTML corrector -- CDATA added to script element');
+</script>', t('HTML corrector -- CDATA added to script element'));
$f = _filter_htmlcorrector('<p><script type="text/javascript">alert("test")</script></p>');
$this->assertEqual($f, '<p><script type="text/javascript">
<!--//--><![CDATA[// ><!--
alert("test")
//--><!]]>
-</script></p>', 'HTML corrector -- CDATA added to a nested script element');
+</script></p>', t('HTML corrector -- CDATA added to a nested script element'));
$f = _filter_htmlcorrector('<p><style> /* Styling */ body {color:red}</style></p>');
$this->assertEqual($f, '<p><style>
<!--/*--><![CDATA[/* ><!--*/
/* Styling */ body {color:red}
/*--><!]]>*/
-</style></p>', 'HTML corrector -- CDATA added to a style element.');
+</style></p>', t('HTML corrector -- CDATA added to a style element.'));
}
/**
@@ -1240,16 +1240,16 @@ alert("test")
// Test that characters that have special meaning in XML are changed into
// entities.
$f = $function('<>&"');
- $this->assertEqual($f, '&lt;&gt;&amp;&quot;', 'The ' . $replacements['@function'] . '() function correctly filters basic HTML entities.');
+ $this->assertEqual($f, '&lt;&gt;&amp;&quot;', t('The @function() function correctly filters basic HTML entities.', $replacements));
// A single quote can also be used for evil things in some contexts.
$f = $function('\'');
- $this->assertEqual($f, '&#039;', 'The ' . $replacements['@function'] . '() function correctly filters single quotes.');
+ $this->assertEqual($f, '&#039;', t('The @function() function correctly filters single quotes.', $replacements));
// Test that the filter is not fooled by different evasion techniques.
// Ignore PHP 5.3+ invalid multibyte sequence warning.
$f = @$function("\xc2\"");
- $this->assertEqual($f, '', 'The ' . $replacements['@function'] . '() function correctly filters invalid UTF-8.');
+ $this->assertEqual($f, '', t('The @function() function correctly filters invalid UTF-8.', $replacements));
}
}
@@ -1281,8 +1281,8 @@ class FilterHooksTestCase extends DrupalWebTestCase {
$edit['name'] = $name;
$edit['roles[1]'] = 1;
$this->drupalPost('admin/config/content/formats/add', $edit, t('Save configuration'));
- $this->assertRaw(t('Added text format %format.', array('%format' => $name)), 'New format created.');
- $this->assertText('hook_filter_format_insert invoked.', 'hook_filter_format_insert was invoked.');
+ $this->assertRaw(t('Added text format %format.', array('%format' => $name)), t('New format created.'));
+ $this->assertText('hook_filter_format_insert invoked.', t('hook_filter_format_insert was invoked.'));
$format_id = db_query("SELECT format FROM {filter_format} WHERE name = :name", array(':name' => $name))->fetchField();
@@ -1290,8 +1290,8 @@ class FilterHooksTestCase extends DrupalWebTestCase {
$edit = array();
$edit['roles[2]'] = 1;
$this->drupalPost('admin/config/content/formats/' . $format_id, $edit, t('Save configuration'));
- $this->assertRaw(t('The text format %format has been updated.', array('%format' => $name)), 'Format successfully updated.');
- $this->assertText('hook_filter_format_update invoked.', 'hook_filter_format_update() was invoked.');
+ $this->assertRaw(t('The text format %format has been updated.', array('%format' => $name)), t('Format successfully updated.'));
+ $this->assertText('hook_filter_format_update invoked.', t('hook_filter_format_update() was invoked.'));
// Add a new custom block.
$custom_block = array();
@@ -1301,16 +1301,16 @@ class FilterHooksTestCase extends DrupalWebTestCase {
// Use the format created.
$custom_block['body[format]'] = $format_id;
$this->drupalPost('admin/structure/block/add', $custom_block, t('Save block'));
- $this->assertText(t('The block has been created.'), 'New block successfully created.');
+ $this->assertText(t('The block has been created.'), t('New block successfully created.'));
// Verify the new block is in the database.
$bid = db_query("SELECT bid FROM {block_custom} WHERE info = :info", array(':info' => $custom_block['info']))->fetchField();
- $this->assertNotNull($bid, 'New block found in database');
+ $this->assertNotNull($bid, t('New block found in database'));
// Delete the text format.
$this->drupalPost('admin/config/content/formats/' . $format_id . '/delete', array(), t('Delete'));
- $this->assertRaw(t('Deleted text format %format.', array('%format' => $name)), 'Format successfully deleted.');
- $this->assertText('hook_filter_format_delete invoked.', 'hook_filter_format_delete() was invoked.');
+ $this->assertRaw(t('Deleted text format %format.', array('%format' => $name)), t('Format successfully deleted.'));
+ $this->assertText('hook_filter_format_delete invoked.', t('hook_filter_format_delete() was invoked.'));
// Verify that the deleted format was replaced with the fallback format.
$current_format = db_select('block_custom', 'b')
@@ -1318,7 +1318,7 @@ class FilterHooksTestCase extends DrupalWebTestCase {
->condition('bid', $bid)
->execute()
->fetchField();
- $this->assertEqual($current_format, filter_fallback_format(), 'Deleted text format replaced with the fallback format.');
+ $this->assertEqual($current_format, filter_fallback_format(), t('Deleted text format replaced with the fallback format.'));
}
}
diff --git a/modules/forum/forum.test b/modules/forum/forum.test
index f114c4373..a7b9a0810 100644
--- a/modules/forum/forum.test
+++ b/modules/forum/forum.test
@@ -102,16 +102,16 @@ class ForumTestCase extends DrupalWebTestCase {
// Must remove forum topics to test creating orphan topics.
$vid = variable_get('forum_nav_vocabulary');
$tree = taxonomy_get_tree($vid);
- foreach ($tree as $term) {
+ foreach($tree as $term) {
taxonomy_term_delete($term->tid);
}
// Create an orphan forum item.
$this->drupalLogin($this->admin_user);
- $this->drupalPost('node/add/forum', array('title' => $this->randomName(10), 'body[' . LANGUAGE_NONE . '][0][value]' => $this->randomName(120)), t('Save'));
+ $this->drupalPost('node/add/forum', array('title' => $this->randomName(10), 'body[' . LANGUAGE_NONE .'][0][value]' => $this->randomName(120)), t('Save'));
$nid_count = db_query('SELECT COUNT(nid) FROM {node}')->fetchField();
- $this->assertEqual(0, $nid_count, 'A forum node was not created when missing a forum vocabulary.');
+ $this->assertEqual(0, $nid_count, t('A forum node was not created when missing a forum vocabulary.'));
// Reset the defaults for future tests.
module_enable(array('forum'));
@@ -131,14 +131,14 @@ class ForumTestCase extends DrupalWebTestCase {
$edit['forum_active[region]'] = 'sidebar_second';
$this->drupalPost('admin/structure/block', $edit, t('Save blocks'));
$this->assertResponse(200);
- $this->assertText(t('The block settings have been updated.'), 'Active forum topics forum block was enabled');
+ $this->assertText(t('The block settings have been updated.'), t('Active forum topics forum block was enabled'));
// Enable the new forum block.
$edit = array();
$edit['forum_new[region]'] = 'sidebar_second';
$this->drupalPost('admin/structure/block', $edit, t('Save blocks'));
$this->assertResponse(200);
- $this->assertText(t('The block settings have been updated.'), '[New forum topics] Forum block was enabled');
+ $this->assertText(t('The block settings have been updated.'), t('[New forum topics] Forum block was enabled'));
// Retrieve forum menu id.
$mlid = db_query_range("SELECT mlid FROM {menu_links} WHERE link_path = 'forum' AND menu_name = 'navigation' AND module = 'system' ORDER BY mlid ASC", 0, 1)->fetchField();
@@ -156,13 +156,13 @@ class ForumTestCase extends DrupalWebTestCase {
// Verify "edit container" link exists and functions correctly.
$this->drupalGet('admin/structure/forum');
$this->clickLink('edit container');
- $this->assertRaw('Edit container', 'Followed the link to edit the container');
+ $this->assertRaw('Edit container', t('Followed the link to edit the container'));
// Create forum inside the forum container.
$this->forum = $this->createForum('forum', $this->container['tid']);
// Verify the "edit forum" link exists and functions correctly.
$this->drupalGet('admin/structure/forum');
$this->clickLink('edit forum');
- $this->assertRaw('Edit forum', 'Followed the link to edit the forum');
+ $this->assertRaw('Edit forum', t('Followed the link to edit the forum'));
// Navigate back to forum structure page.
$this->drupalGet('admin/structure/forum');
// Create second forum in container.
@@ -197,15 +197,15 @@ class ForumTestCase extends DrupalWebTestCase {
// Edit the vocabulary.
$this->drupalPost('admin/structure/taxonomy/' . $original_settings->machine_name . '/edit', $edit, t('Save'));
$this->assertResponse(200);
- $this->assertRaw(t('Updated vocabulary %name.', array('%name' => $title)), 'Vocabulary was edited');
+ $this->assertRaw(t('Updated vocabulary %name.', array('%name' => $title)), t('Vocabulary was edited'));
// Grab the newly edited vocabulary.
entity_get_controller('taxonomy_vocabulary')->resetCache();
$current_settings = taxonomy_vocabulary_load($vid);
// Make sure we actually edited the vocabulary properly.
- $this->assertEqual($current_settings->name, $title, 'The name was updated');
- $this->assertEqual($current_settings->description, $description, 'The description was updated');
+ $this->assertEqual($current_settings->name, $title, t('The name was updated'));
+ $this->assertEqual($current_settings->description, $description, t('The description was updated'));
// Restore the original vocabulary.
taxonomy_vocabulary_save($original_settings);
@@ -241,7 +241,7 @@ class ForumTestCase extends DrupalWebTestCase {
$this->drupalPost('admin/structure/forum/add/' . $type, $edit, t('Save'));
$this->assertResponse(200);
$type = ($type == 'container') ? 'forum container' : 'forum';
- $this->assertRaw(t('Created new @type %term.', array('%term' => $name, '@type' => t($type))), ucfirst($type) . ' was created');
+ $this->assertRaw(t('Created new @type %term.', array('%term' => $name, '@type' => t($type))), t(ucfirst($type) . ' was created'));
// Verify forum.
$term = db_query("SELECT * FROM {taxonomy_term_data} t WHERE t.vid = :vid AND t.name = :name AND t.description = :desc", array(':vid' => variable_get('forum_nav_vocabulary', ''), ':name' => $name, ':desc' => $description))->fetchAssoc();
@@ -318,24 +318,24 @@ class ForumTestCase extends DrupalWebTestCase {
$type = t('Forum topic');
if ($container) {
- $this->assertNoRaw(t('@type %title has been created.', array('@type' => $type, '%title' => $title)), 'Forum topic was not created');
- $this->assertRaw(t('The item %title is a forum container, not a forum.', array('%title' => $forum['name'])), 'Error message was shown');
+ $this->assertNoRaw(t('@type %title has been created.', array('@type' => $type, '%title' => $title)), t('Forum topic was not created'));
+ $this->assertRaw(t('The item %title is a forum container, not a forum.', array('%title' => $forum['name'])), t('Error message was shown'));
return;
}
else {
- $this->assertRaw(t('@type %title has been created.', array('@type' => $type, '%title' => $title)), 'Forum topic was created');
- $this->assertNoRaw(t('The item %title is a forum container, not a forum.', array('%title' => $forum['name'])), 'No error message was shown');
+ $this->assertRaw(t('@type %title has been created.', array('@type' => $type, '%title' => $title)), t('Forum topic was created'));
+ $this->assertNoRaw(t('The item %title is a forum container, not a forum.', array('%title' => $forum['name'])), t('No error message was shown'));
}
// Retrieve node object, ensure that the topic was created and in the proper forum.
$node = $this->drupalGetNodeByTitle($title);
- $this->assertTrue($node != NULL, 'Node ' . $title . ' was loaded');
+ $this->assertTrue($node != NULL, t('Node @title was loaded', array('@title' => $title)));
$this->assertEqual($node->taxonomy_forums[LANGUAGE_NONE][0]['tid'], $tid, 'Saved forum topic was in the expected forum');
// View forum topic.
$this->drupalGet('node/' . $node->nid);
- $this->assertRaw($title, 'Subject was found');
- $this->assertRaw($body, 'Body was found');
+ $this->assertRaw($title, t('Subject was found'));
+ $this->assertRaw($body, t('Body was found'));
return $node;
}
@@ -359,14 +359,14 @@ class ForumTestCase extends DrupalWebTestCase {
$this->drupalGet('admin/help/forum');
$this->assertResponse($response2);
if ($response2 == 200) {
- $this->assertTitle(t('Forum | Drupal'), 'Forum help title was displayed');
- $this->assertText(t('Forum'), 'Forum help node was displayed');
+ $this->assertTitle(t('Forum | Drupal'), t('Forum help title was displayed'));
+ $this->assertText(t('Forum'), t('Forum help node was displayed'));
}
// Verify the forum blocks were displayed.
$this->drupalGet('');
$this->assertResponse(200);
- $this->assertText(t('New forum topics'), '[New forum topics] Forum block was displayed');
+ $this->assertText(t('New forum topics'), t('[New forum topics] Forum block was displayed'));
// View forum container page.
$this->verifyForumView($this->container);
@@ -378,20 +378,20 @@ class ForumTestCase extends DrupalWebTestCase {
// View forum node.
$this->drupalGet('node/' . $node->nid);
$this->assertResponse(200);
- $this->assertTitle($node->title . ' | Drupal', 'Forum node was displayed');
+ $this->assertTitle($node->title . ' | Drupal', t('Forum node was displayed'));
$breadcrumb = array(
l(t('Home'), NULL),
l(t('Forums'), 'forum'),
l($this->container['name'], 'forum/' . $this->container['tid']),
l($this->forum['name'], 'forum/' . $this->forum['tid']),
);
- $this->assertRaw(theme('breadcrumb', array('breadcrumb' => $breadcrumb)), 'Breadcrumbs were displayed');
+ $this->assertRaw(theme('breadcrumb', array('breadcrumb' => $breadcrumb)), t('Breadcrumbs were displayed'));
// View forum edit node.
$this->drupalGet('node/' . $node->nid . '/edit');
$this->assertResponse($response);
if ($response == 200) {
- $this->assertTitle('Edit Forum topic ' . $node->title . ' | Drupal', 'Forum edit node was displayed');
+ $this->assertTitle('Edit Forum topic ' . $node->title . ' | Drupal', t('Forum edit node was displayed'));
}
if ($response == 200) {
@@ -404,7 +404,7 @@ class ForumTestCase extends DrupalWebTestCase {
$edit["taxonomy_forums[$langcode]"] = $this->root_forum['tid'];
$edit['shadow'] = TRUE;
$this->drupalPost('node/' . $node->nid . '/edit', $edit, t('Save'));
- $this->assertRaw(t('Forum topic %title has been updated.', array('%title' => $edit["title"])), 'Forum node was edited');
+ $this->assertRaw(t('Forum topic %title has been updated.', array('%title' => $edit["title"])), t('Forum node was edited'));
// Verify topic was moved to a different forum.
$forum_tid = db_query("SELECT tid FROM {forum} WHERE nid = :nid AND vid = :vid", array(
@@ -416,7 +416,7 @@ class ForumTestCase extends DrupalWebTestCase {
// Delete forum node.
$this->drupalPost('node/' . $node->nid . '/delete', array(), t('Delete'));
$this->assertResponse($response);
- $this->assertRaw(t('Forum topic %title has been deleted.', array('%title' => $edit['title'])), 'Forum node was deleted');
+ $this->assertRaw(t('Forum topic %title has been deleted.', array('%title' => $edit['title'])), t('Forum node was deleted'));
}
}
@@ -430,7 +430,7 @@ class ForumTestCase extends DrupalWebTestCase {
// View forum page.
$this->drupalGet('forum/' . $forum['tid']);
$this->assertResponse(200);
- $this->assertTitle($forum['name'] . ' | Drupal', 'Forum name was displayed');
+ $this->assertTitle($forum['name'] . ' | Drupal', t('Forum name was displayed'));
$breadcrumb = array(
l(t('Home'), NULL),
@@ -440,7 +440,7 @@ class ForumTestCase extends DrupalWebTestCase {
$breadcrumb[] = l($parent['name'], 'forum/' . $parent['tid']);
}
- $this->assertRaw(theme('breadcrumb', array('breadcrumb' => $breadcrumb)), 'Breadcrumbs were displayed');
+ $this->assertRaw(theme('breadcrumb', array('breadcrumb' => $breadcrumb)), t('Breadcrumbs were displayed'));
}
/**
diff --git a/modules/help/help.test b/modules/help/help.test
index 070f8159a..db739f345 100644
--- a/modules/help/help.test
+++ b/modules/help/help.test
@@ -41,17 +41,17 @@ class HelpTestCase extends DrupalWebTestCase {
// Check for css on admin/help.
$this->drupalLogin($this->big_user);
$this->drupalGet('admin/help');
- $this->assertRaw(drupal_get_path('module', 'help') . '/help.css', 'The help.css file is present in the HTML.');
+ $this->assertRaw(drupal_get_path('module', 'help') . '/help.css', t('The help.css file is present in the HTML.'));
// Verify that introductory help text exists, goes for 100% module coverage.
$this->assertRaw(t('For more information, refer to the specific topics listed in the next section or to the <a href="@drupal">online Drupal handbooks</a>.', array('@drupal' => 'http://drupal.org/handbooks')), 'Help intro text correctly appears.');
// Verify that help topics text appears.
- $this->assertRaw('<h2>' . t('Help topics') . '</h2><p>' . t('Help is available on the following items:') . '</p>', 'Help topics text correctly appears.');
+ $this->assertRaw('<h2>' . t('Help topics') . '</h2><p>' . t('Help is available on the following items:') . '</p>', t('Help topics text correctly appears.'));
// Make sure links are properly added for modules implementing hook_help().
foreach ($this->modules as $module => $name) {
- $this->assertLink($name, 0, 'Link properly added to ' . $name . ' (admin/help/' . $module . ')');
+ $this->assertLink($name, 0, t('Link properly added to @name (admin/help/@module)', array('@module' => $module, '@name' => $name)));
}
}
@@ -66,9 +66,9 @@ class HelpTestCase extends DrupalWebTestCase {
$this->drupalGet('admin/help/' . $module);
$this->assertResponse($response);
if ($response == 200) {
- $this->assertTitle($name . ' | Drupal', '[' . $module . '] Title was displayed');
- $this->assertRaw('<h1 class="page-title">' . t($name) . '</h1>', '[' . $module . '] Heading was displayed');
- }
+ $this->assertTitle($name . ' | Drupal', t('[' . $module . '] Title was displayed'));
+ $this->assertRaw('<h1 class="page-title">' . t($name) . '</h1>', t('[' . $module . '] Heading was displayed'));
+ }
}
}
@@ -116,6 +116,6 @@ class NoHelpTestCase extends DrupalWebTestCase {
$this->drupalLogin($this->big_user);
$this->drupalGet('admin/help');
- $this->assertNoText('Hook menu tests', 'Making sure the test module menu_test does not display a help link in admin/help');
+ $this->assertNoText('Hook menu tests', t('Making sure the test module menu_test does not display a help link in admin/help'));
}
}
diff --git a/modules/image/image.test b/modules/image/image.test
index a31dfc240..9f0604d1d 100644
--- a/modules/image/image.test
+++ b/modules/image/image.test
@@ -133,11 +133,11 @@ class ImageStylesPathAndUrlUnitTest extends DrupalWebTestCase {
function testImageStylePath() {
$actual = image_style_path($this->style_name, 'public://foo/bar.gif');
$expected = 'public://styles/' . $this->style_name . '/foo/bar.gif';
- $this->assertEqual($actual, $expected, 'Got the path for a file URI.');
+ $this->assertEqual($actual, $expected, t('Got the path for a file URI.'));
$actual = image_style_path($this->style_name, 'foo/bar.gif');
$expected = 'public://styles/' . $this->style_name . '/foo/bar.gif';
- $this->assertEqual($actual, $expected, 'Got the path for a relative file path.');
+ $this->assertEqual($actual, $expected, t('Got the path for a relative file path.'));
}
/**
@@ -167,53 +167,53 @@ class ImageStylesPathAndUrlUnitTest extends DrupalWebTestCase {
// Create the directories for the styles.
$d = $scheme . '://styles/' . $this->style_name;
$status = file_prepare_directory($d, FILE_CREATE_DIRECTORY);
- $this->assertNotIdentical(FALSE, $status, 'Created the directory for the generated images for the test style.');
+ $this->assertNotIdentical(FALSE, $status, t('Created the directory for the generated images for the test style.'));
// Create a working copy of the file.
$files = $this->drupalGetTestFiles('image');
$file = reset($files);
$image_info = image_get_info($file->uri);
$original_uri = file_unmanaged_copy($file->uri, $scheme . '://', FILE_EXISTS_RENAME);
- $this->assertNotIdentical(FALSE, $original_uri, 'Created the generated image file.');
+ $this->assertNotIdentical(FALSE, $original_uri, t('Created the generated image file.'));
// Get the URL of a file that has not been generated yet and try to access
// it before image_style_url has been called.
$generated_uri = $scheme . '://styles/' . $this->style_name . '/' . basename($original_uri);
- $this->assertFalse(file_exists($generated_uri), 'Generated file does not exist.');
+ $this->assertFalse(file_exists($generated_uri), t('Generated file does not exist.'));
$expected_generate_url = url('image/generate/' . $this->style_name . '/' . $scheme . '/' . basename($original_uri), array('absolute' => TRUE));
$this->drupalGet($expected_generate_url);
- $this->assertResponse(403, 'Access to generate URL was denied.');
+ $this->assertResponse(403, t('Access to generate URL was denied.'));
// Check that a generate URL is returned.
$actual_generate_url = image_style_url($this->style_name, $original_uri);
- $this->assertEqual($actual_generate_url, $expected_generate_url, 'Got the generate URL for a non-existent file.');
+ $this->assertEqual($actual_generate_url, $expected_generate_url, t('Got the generate URL for a non-existent file.'));
// Fetch the URL that generates the file while another process appears to
// be generating the same file (this is signaled using a lock).
$lock_name = 'image_style_generate:' . $this->style_name . ':' . drupal_hash_base64($original_uri);
- $this->assertTrue(lock_acquire($lock_name), 'Lock was acquired.');
+ $this->assertTrue(lock_acquire($lock_name), t('Lock was acquired.'));
$this->drupalGet($expected_generate_url);
- $this->assertResponse(503, 'Service Unavailable response received.');
- $this->assertTrue($this->drupalGetHeader('Retry-After'), 'Retry-After header received.');
+ $this->assertResponse(503, t('Service Unavailable response received.'));
+ $this->assertTrue($this->drupalGetHeader('Retry-After'), t('Retry-After header received.'));
lock_release($lock_name);
// Fetch the URL that generates the file.
$this->drupalGet($expected_generate_url);
- $this->assertTrue(file_exists($generated_uri), 'Generated file was created.');
- $this->assertRaw(file_get_contents($generated_uri), 'URL returns expected file.');
+ $this->assertTrue(file_exists($generated_uri), t('Generated file was created.'));
+ $this->assertRaw(file_get_contents($generated_uri), t('URL returns expected file.'));
$generated_image_info = image_get_info($generated_uri);
- $this->assertEqual($this->drupalGetHeader('Content-Type'), $generated_image_info['mime_type'], 'Expected Content-Type was reported.');
- $this->assertEqual($this->drupalGetHeader('Content-Length'), $generated_image_info['file_size'], 'Expected Content-Length was reported.');
- $this->assertTrue(lock_may_be_available($lock_name), 'Lock was released.');
+ $this->assertEqual($this->drupalGetHeader('Content-Type'), $generated_image_info['mime_type'], t('Expected Content-Type was reported.'));
+ $this->assertEqual($this->drupalGetHeader('Content-Length'), $generated_image_info['file_size'], t('Expected Content-Length was reported.'));
+ $this->assertTrue(lock_may_be_available($lock_name), t('Lock was released.'));
// Check that the URL points directly to the generated file.
$expected_generated_url = file_create_url($generated_uri);
$actual_generated_url = image_style_url($this->style_name, $original_uri);
$this->drupalGet($expected_generated_url);
- $this->assertEqual($actual_generated_url, $expected_generated_url, 'Got the download URL for an existing file.');
- $this->assertRaw(file_get_contents($generated_uri), 'URL returns expected file.');
- $this->assertEqual($this->drupalGetHeader('Content-Type'), $generated_image_info['mime_type'], 'Expected Content-Type was reported.');
- $this->assertEqual($this->drupalGetHeader('Content-Length'), $generated_image_info['file_size'], 'Expected Content-Length was reported.');
+ $this->assertEqual($actual_generated_url, $expected_generated_url, t('Got the download URL for an existing file.'));
+ $this->assertRaw(file_get_contents($generated_uri), t('URL returns expected file.'));
+ $this->assertEqual($this->drupalGetHeader('Content-Type'), $generated_image_info['mime_type'], t('Expected Content-Type was reported.'));
+ $this->assertEqual($this->drupalGetHeader('Content-Length'), $generated_image_info['file_size'], t('Expected Content-Length was reported.'));
}
}
@@ -239,13 +239,13 @@ class ImageEffectsUnitTest extends ImageToolkitTestCase {
* Test the image_resize_effect() function.
*/
function testResizeEffect() {
- $this->assertTrue(image_resize_effect($this->image, array('width' => 1, 'height' => 2)), 'Function returned the expected value.');
+ $this->assertTrue(image_resize_effect($this->image, array('width' => 1, 'height' => 2)), t('Function returned the expected value.'));
$this->assertToolkitOperationsCalled(array('resize'));
// Check the parameters.
$calls = image_test_get_all_calls();
- $this->assertEqual($calls['resize'][0][1], 1, 'Width was passed correctly');
- $this->assertEqual($calls['resize'][0][2], 2, 'Height was passed correctly');
+ $this->assertEqual($calls['resize'][0][1], 1, t('Width was passed correctly'));
+ $this->assertEqual($calls['resize'][0][2], 2, t('Height was passed correctly'));
}
/**
@@ -253,13 +253,13 @@ class ImageEffectsUnitTest extends ImageToolkitTestCase {
*/
function testScaleEffect() {
// @todo: need to test upscaling.
- $this->assertTrue(image_scale_effect($this->image, array('width' => 10, 'height' => 10)), 'Function returned the expected value.');
+ $this->assertTrue(image_scale_effect($this->image, array('width' => 10, 'height' => 10)), t('Function returned the expected value.'));
$this->assertToolkitOperationsCalled(array('resize'));
// Check the parameters.
$calls = image_test_get_all_calls();
- $this->assertEqual($calls['resize'][0][1], 10, 'Width was passed correctly');
- $this->assertEqual($calls['resize'][0][2], 5, 'Height was based off aspect ratio and passed correctly');
+ $this->assertEqual($calls['resize'][0][1], 10, t('Width was passed correctly'));
+ $this->assertEqual($calls['resize'][0][2], 5, t('Height was based off aspect ratio and passed correctly'));
}
/**
@@ -267,42 +267,42 @@ class ImageEffectsUnitTest extends ImageToolkitTestCase {
*/
function testCropEffect() {
// @todo should test the keyword offsets.
- $this->assertTrue(image_crop_effect($this->image, array('anchor' => 'top-1', 'width' => 3, 'height' => 4)), 'Function returned the expected value.');
+ $this->assertTrue(image_crop_effect($this->image, array('anchor' => 'top-1', 'width' => 3, 'height' => 4)), t('Function returned the expected value.'));
$this->assertToolkitOperationsCalled(array('crop'));
// Check the parameters.
$calls = image_test_get_all_calls();
- $this->assertEqual($calls['crop'][0][1], 0, 'X was passed correctly');
- $this->assertEqual($calls['crop'][0][2], 1, 'Y was passed correctly');
- $this->assertEqual($calls['crop'][0][3], 3, 'Width was passed correctly');
- $this->assertEqual($calls['crop'][0][4], 4, 'Height was passed correctly');
+ $this->assertEqual($calls['crop'][0][1], 0, t('X was passed correctly'));
+ $this->assertEqual($calls['crop'][0][2], 1, t('Y was passed correctly'));
+ $this->assertEqual($calls['crop'][0][3], 3, t('Width was passed correctly'));
+ $this->assertEqual($calls['crop'][0][4], 4, t('Height was passed correctly'));
}
/**
* Test the image_scale_and_crop_effect() function.
*/
function testScaleAndCropEffect() {
- $this->assertTrue(image_scale_and_crop_effect($this->image, array('width' => 5, 'height' => 10)), 'Function returned the expected value.');
+ $this->assertTrue(image_scale_and_crop_effect($this->image, array('width' => 5, 'height' => 10)), t('Function returned the expected value.'));
$this->assertToolkitOperationsCalled(array('resize', 'crop'));
// Check the parameters.
$calls = image_test_get_all_calls();
- $this->assertEqual($calls['crop'][0][1], 7.5, 'X was computed and passed correctly');
- $this->assertEqual($calls['crop'][0][2], 0, 'Y was computed and passed correctly');
- $this->assertEqual($calls['crop'][0][3], 5, 'Width was computed and passed correctly');
- $this->assertEqual($calls['crop'][0][4], 10, 'Height was computed and passed correctly');
+ $this->assertEqual($calls['crop'][0][1], 7.5, t('X was computed and passed correctly'));
+ $this->assertEqual($calls['crop'][0][2], 0, t('Y was computed and passed correctly'));
+ $this->assertEqual($calls['crop'][0][3], 5, t('Width was computed and passed correctly'));
+ $this->assertEqual($calls['crop'][0][4], 10, t('Height was computed and passed correctly'));
}
/**
* Test the image_desaturate_effect() function.
*/
function testDesaturateEffect() {
- $this->assertTrue(image_desaturate_effect($this->image, array()), 'Function returned the expected value.');
+ $this->assertTrue(image_desaturate_effect($this->image, array()), t('Function returned the expected value.'));
$this->assertToolkitOperationsCalled(array('desaturate'));
// Check the parameters.
$calls = image_test_get_all_calls();
- $this->assertEqual(count($calls['desaturate'][0]), 1, 'Only the image was passed.');
+ $this->assertEqual(count($calls['desaturate'][0]), 1, t('Only the image was passed.'));
}
/**
@@ -310,13 +310,13 @@ class ImageEffectsUnitTest extends ImageToolkitTestCase {
*/
function testRotateEffect() {
// @todo: need to test with 'random' => TRUE
- $this->assertTrue(image_rotate_effect($this->image, array('degrees' => 90, 'bgcolor' => '#fff')), 'Function returned the expected value.');
+ $this->assertTrue(image_rotate_effect($this->image, array('degrees' => 90, 'bgcolor' => '#fff')), t('Function returned the expected value.'));
$this->assertToolkitOperationsCalled(array('rotate'));
// Check the parameters.
$calls = image_test_get_all_calls();
- $this->assertEqual($calls['rotate'][0][1], 90, 'Degrees were passed correctly');
- $this->assertEqual($calls['rotate'][0][2], 0xffffff, 'Background color was passed correctly');
+ $this->assertEqual($calls['rotate'][0][1], 90, t('Degrees were passed correctly'));
+ $this->assertEqual($calls['rotate'][0][2], 0xffffff, t('Background color was passed correctly'));
}
}
@@ -400,7 +400,7 @@ class ImageAdminStylesUnitTest extends ImageFieldTestCase {
'name' => $style_name,
);
$this->drupalPost('admin/config/media/image-styles/add', $edit, t('Create new style'));
- $this->assertRaw(t('Style %name was created.', array('%name' => $style_name)), 'Image style successfully created.');
+ $this->assertRaw(t('Style %name was created.', array('%name' => $style_name)), t('Image style successfully created.'));
// Add effect form.
@@ -422,7 +422,7 @@ class ImageAdminStylesUnitTest extends ImageFieldTestCase {
foreach ($style['effects'] as $ieid => $effect) {
$this->drupalGet($style_path . '/effects/' . $ieid);
foreach ($effect_edits[$effect['name']] as $field => $value) {
- $this->assertFieldByName($field, $value, 'The ' . $field . ' field in the ' . $effect['name'] . ' effect has the correct value of ' . $value . '.');
+ $this->assertFieldByName($field, $value, t('The %field field in the %effect effect has the correct value of %value.', array('%field' => $field, '%effect' => $effect['name'], '%value' => $value)));
}
}
@@ -438,7 +438,7 @@ class ImageAdminStylesUnitTest extends ImageFieldTestCase {
$order_correct = FALSE;
}
}
- $this->assertTrue($order_correct, 'The order of the effects is correctly set by default.');
+ $this->assertTrue($order_correct, t('The order of the effects is correctly set by default.'));
// Test the style overview form.
// Change the name of the style and adjust the weights of effects.
@@ -454,7 +454,7 @@ class ImageAdminStylesUnitTest extends ImageFieldTestCase {
// Create an image to make sure it gets flushed after saving.
$image_path = $this->createSampleImage($style);
- $this->assertEqual($this->getImageCount($style), 1, 'Image style ' . $style['name'] . ' image ' . $image_path . ' successfully generated.');
+ $this->assertEqual($this->getImageCount($style), 1, t('Image style %style image %file successfully generated.', array('%style' => $style['name'], '%file' => $image_path)));
$this->drupalPost($style_path, $edit, t('Update style'));
@@ -463,12 +463,12 @@ class ImageAdminStylesUnitTest extends ImageFieldTestCase {
// Check that the URL was updated.
$this->drupalGet($style_path);
- $this->assertResponse(200, 'Image style ' . $style['name'] . ' renamed to ' . $style_name);
+ $this->assertResponse(200, t('Image style %original renamed to %new', array('%original' => $style['name'], '%new' => $style_name)));
// Check that the image was flushed after updating the style.
// This is especially important when renaming the style. Make sure that
// the old image directory has been deleted.
- $this->assertEqual($this->getImageCount($style), 0, 'Image style ' . $style['name'] . ' was flushed after renaming the style and updating the order of effects.');
+ $this->assertEqual($this->getImageCount($style), 0, t('Image style %style was flushed after renaming the style and updating the order of effects.', array('%style' => $style['name'])));
// Load the style by the new name with the new weights.
drupal_static_reset('image_styles');
@@ -483,18 +483,18 @@ class ImageAdminStylesUnitTest extends ImageFieldTestCase {
$order_correct = FALSE;
}
}
- $this->assertTrue($order_correct, 'The order of the effects is correctly set by default.');
+ $this->assertTrue($order_correct, t('The order of the effects is correctly set by default.'));
// Image effect deletion form.
// Create an image to make sure it gets flushed after deleting an effect.
$image_path = $this->createSampleImage($style);
- $this->assertEqual($this->getImageCount($style), 1, 'Image style ' . $style['name'] . ' image ' . $image_path . ' successfully generated.');
+ $this->assertEqual($this->getImageCount($style), 1, t('Image style %style image %file successfully generated.', array('%style' => $style['name'], '%file' => $image_path)));
// Test effect deletion form.
$effect = array_pop($style['effects']);
$this->drupalPost($style_path . '/effects/' . $effect['ieid'] . '/delete', array(), t('Delete'));
- $this->assertRaw(t('The image effect %name has been deleted.', array('%name' => $effect['label'])), 'Image effect deleted.');
+ $this->assertRaw(t('The image effect %name has been deleted.', array('%name' => $effect['label'])), t('Image effect deleted.'));
// Style deletion form.
@@ -503,10 +503,10 @@ class ImageAdminStylesUnitTest extends ImageFieldTestCase {
// Confirm the style directory has been removed.
$directory = file_directory_path() . '/styles/' . $style_name;
- $this->assertFalse(is_dir($directory), 'Image style ' . $style['name'] . ' directory removed on style deletion.');
+ $this->assertFalse(is_dir($directory), t('Image style %style directory removed on style deletion.', array('%style' => $style['name'])));
drupal_static_reset('image_styles');
- $this->assertFalse(image_style_load($style_name), 'Image style ' . $style['name'] . ' successfully deleted.');
+ $this->assertFalse(image_style_load($style_name), t('Image style %style successfully deleted.', array('%style' => $style['name'])));
}
@@ -522,28 +522,28 @@ class ImageAdminStylesUnitTest extends ImageFieldTestCase {
// Ensure deleting a default is not possible.
$this->drupalGet($delete_path);
- $this->assertText(t('Page not found'), 'Default styles may not be deleted.');
+ $this->assertText(t('Page not found'), t('Default styles may not be deleted.'));
// Ensure that editing a default is not possible (without overriding).
$this->drupalGet($edit_path);
- $this->assertNoField('edit-name', 'Default styles may not be renamed.');
- $this->assertNoField('edit-submit', 'Default styles may not be edited.');
- $this->assertNoField('edit-add', 'Default styles may not have new effects added.');
+ $this->assertNoField('edit-name', t('Default styles may not be renamed.'));
+ $this->assertNoField('edit-submit', t('Default styles may not be edited.'));
+ $this->assertNoField('edit-add', t('Default styles may not have new effects added.'));
// Create an image to make sure the default works before overriding.
drupal_static_reset('image_styles');
$style = image_style_load($style_name);
$image_path = $this->createSampleImage($style);
- $this->assertEqual($this->getImageCount($style), 1, 'Image style ' . $style['name'] . ' image ' . $image_path . ' successfully generated.');
+ $this->assertEqual($this->getImageCount($style), 1, t('Image style %style image %file successfully generated.', array('%style' => $style['name'], '%file' => $image_path)));
// Verify that effects attached to a default style do not have an ieid key.
foreach ($style['effects'] as $effect) {
- $this->assertFalse(isset($effect['ieid']), 'The ' . $effect['name'] . ' effect does not have an ieid.');
+ $this->assertFalse(isset($effect['ieid']), t('The %effect effect does not have an ieid.', array('%effect' => $effect['name'])));
}
// Override the default.
$this->drupalPost($edit_path, array(), t('Override defaults'));
- $this->assertRaw(t('The %style style has been overridden, allowing you to change its settings.', array('%style' => $style_name)), 'Default image style may be overridden.');
+ $this->assertRaw(t('The %style style has been overridden, allowing you to change its settings.', array('%style' => $style_name)), t('Default image style may be overridden.'));
// Add sample effect to the overridden style.
$this->drupalPost($edit_path, array('new' => 'image_desaturate'), t('Add'));
@@ -552,22 +552,22 @@ class ImageAdminStylesUnitTest extends ImageFieldTestCase {
// Verify that effects attached to the style have an ieid now.
foreach ($style['effects'] as $effect) {
- $this->assertTrue(isset($effect['ieid']), 'The ' . $effect['name'] . ' effect has an ieid.');
+ $this->assertTrue(isset($effect['ieid']), t('The %effect effect has an ieid.', array('%effect' => $effect['name'])));
}
// The style should now have 2 effect, the original scale provided by core
// and the desaturate effect we added in the override.
$effects = array_values($style['effects']);
- $this->assertEqual($effects[0]['name'], 'image_scale', 'The default effect still exists in the overridden style.');
- $this->assertEqual($effects[1]['name'], 'image_desaturate', 'The added effect exists in the overridden style.');
+ $this->assertEqual($effects[0]['name'], 'image_scale', t('The default effect still exists in the overridden style.'));
+ $this->assertEqual($effects[1]['name'], 'image_desaturate', t('The added effect exists in the overridden style.'));
// Check that we are unable to rename an overridden style.
$this->drupalGet($edit_path);
- $this->assertNoField('edit-name', 'Overridden styles may not be renamed.');
+ $this->assertNoField('edit-name', t('Overridden styles may not be renamed.'));
// Create an image to ensure the override works properly.
$image_path = $this->createSampleImage($style);
- $this->assertEqual($this->getImageCount($style), 1, 'Image style ' . $style['name'] . ' image ' . $image_path . ' successfully generated.');
+ $this->assertEqual($this->getImageCount($style), 1, t('Image style %style image %file successfully generated.', array('%style' => $style['name'], '%file' => $image_path)));
// Revert the image style.
$this->drupalPost($revert_path, array(), t('Revert'));
@@ -576,8 +576,8 @@ class ImageAdminStylesUnitTest extends ImageFieldTestCase {
// The style should now have the single effect for scale.
$effects = array_values($style['effects']);
- $this->assertEqual($effects[0]['name'], 'image_scale', 'The default effect still exists in the reverted style.');
- $this->assertFalse(array_key_exists(1, $effects), 'The added effect has been removed in the reverted style.');
+ $this->assertEqual($effects[0]['name'], 'image_scale', t('The default effect still exists in the reverted style.'));
+ $this->assertFalse(array_key_exists(1, $effects), t('The added effect has been removed in the reverted style.'));
}
/**
@@ -602,7 +602,7 @@ class ImageAdminStylesUnitTest extends ImageFieldTestCase {
// Test that image is displayed using newly created style.
$this->drupalGet('node/' . $nid);
- $this->assertRaw(image_style_url($style_name, $node->{$field_name}[LANGUAGE_NONE][0]['uri']), 'Image displayed using style ' . $style_name . '.');
+ $this->assertRaw(image_style_url($style_name, $node->{$field_name}[LANGUAGE_NONE][0]['uri']), t('Image displayed using style @style.', array('@style' => $style_name)));
// Rename the style and make sure the image field is updated.
$new_style_name = strtolower($this->randomName(10));
@@ -610,9 +610,9 @@ class ImageAdminStylesUnitTest extends ImageFieldTestCase {
'name' => $new_style_name,
);
$this->drupalPost('admin/config/media/image-styles/edit/' . $style_name, $edit, t('Update style'));
- $this->assertText(t('Changes to the style have been saved.'), 'Style ' . $style_name . ' was renamed to ' . $new_style_name . '.');
+ $this->assertText(t('Changes to the style have been saved.'), t('Style %name was renamed to %new_name.', array('%name' => $style_name, '%new_name' => $new_style_name)));
$this->drupalGet('node/' . $nid);
- $this->assertRaw(image_style_url($new_style_name, $node->{$field_name}[LANGUAGE_NONE][0]['uri']), 'Image displayed using style replacement style.');
+ $this->assertRaw(image_style_url($new_style_name, $node->{$field_name}[LANGUAGE_NONE][0]['uri']), t('Image displayed using style replacement style.'));
// Delete the style and choose a replacement style.
$edit = array(
@@ -623,7 +623,7 @@ class ImageAdminStylesUnitTest extends ImageFieldTestCase {
$this->assertRaw($message, $message);
$this->drupalGet('node/' . $nid);
- $this->assertRaw(image_style_url('thumbnail', $node->{$field_name}[LANGUAGE_NONE][0]['uri']), 'Image displayed using style replacement style.');
+ $this->assertRaw(image_style_url('thumbnail', $node->{$field_name}[LANGUAGE_NONE][0]['uri']), t('Image displayed using style replacement style.'));
}
}
@@ -658,7 +658,7 @@ class ImageFieldDisplayTestCase extends ImageFieldTestCase {
'getsize' => TRUE,
);
$default_output = theme('image', $image_info);
- $this->assertRaw($default_output, 'Default formatter displaying correctly on full node view.');
+ $this->assertRaw($default_output, t('Default formatter displaying correctly on full node view.'));
// Test the image linked to file formatter.
$instance = field_info_instance('node', $field_name, 'article');
@@ -666,14 +666,14 @@ class ImageFieldDisplayTestCase extends ImageFieldTestCase {
field_update_instance($instance);
$default_output = l(theme('image', $image_info), file_create_url($image_uri), array('html' => TRUE));
$this->drupalGet('node/' . $nid);
- $this->assertRaw($default_output, 'Image linked to file formatter displaying correctly on full node view.');
+ $this->assertRaw($default_output, t('Image linked to file formatter displaying correctly on full node view.'));
// Test the image linked to content formatter.
$instance['display']['default']['type'] = 'image_link_content';
field_update_instance($instance);
$default_output = l(theme('image', $image_info), 'node/' . $nid, array('html' => TRUE, 'attributes' => array('class' => 'active')));
$this->drupalGet('node/' . $nid);
- $this->assertRaw($default_output, 'Image linked to content formatter displaying correctly on full node view.');
+ $this->assertRaw($default_output, t('Image linked to content formatter displaying correctly on full node view.'));
// Test the image style 'thumbnail' formatter.
$instance['display']['default']['type'] = 'image__thumbnail';
@@ -685,7 +685,7 @@ class ImageFieldDisplayTestCase extends ImageFieldTestCase {
$image_info['getsize'] = FALSE;
$default_output = theme('image', $image_info);
$this->drupalGet('node/' . $nid);
- $this->assertRaw($default_output, 'Image style thumbnail formatter displaying correctly on full node view.');
+ $this->assertRaw($default_output, t('Image style thumbnail formatter displaying correctly on full node view.'));
}
/**
@@ -710,16 +710,16 @@ class ImageFieldDisplayTestCase extends ImageFieldTestCase {
$instance = field_info_instance('node', $field_name, 'article');
$this->drupalGet('node/add/article');
- $this->assertText(t('Files must be less than 50 KB.'), 'Image widget max file size is displayed on article form.');
- $this->assertText(t('Allowed file types: ' . $test_image_extension . '.'), 'Image widget allowed file types displayed on article form.');
- $this->assertText(t('Images must be between 10x10 and 100x100 pixels.'), 'Image widget allowed resolution displayed on article form.');
+ $this->assertText(t('Files must be less than 50 KB.'), t('Image widget max file size is displayed on article form.'));
+ $this->assertText(t('Allowed file types: ' . $test_image_extension . '.'), t('Image widget allowed file types displayed on article form.'));
+ $this->assertText(t('Images must be between 10x10 and 100x100 pixels.'), t('Image widget allowed resolution displayed on article form.'));
// We have to create the article first and then edit it because the alt
// and title fields do not display until the image has been attached.
$nid = $this->uploadNodeImage($test_image, $field_name, 'article');
$this->drupalGet('node/' . $nid . '/edit');
- $this->assertFieldByName($field_name . '[' . LANGUAGE_NONE . '][0][alt]', '', 'Alt field displayed on article form.');
- $this->assertFieldByName($field_name . '[' . LANGUAGE_NONE . '][0][title]', '', 'Title field displayed on article form.');
+ $this->assertFieldByName($field_name . '[' . LANGUAGE_NONE . '][0][alt]', '', t('Alt field displayed on article form.'));
+ $this->assertFieldByName($field_name . '[' . LANGUAGE_NONE . '][0][title]', '', t('Title field displayed on article form.'));
// Verify that the attached image is being previewed using the 'medium'
// style.
$node = node_load($nid, NULL, TRUE);
@@ -728,7 +728,7 @@ class ImageFieldDisplayTestCase extends ImageFieldTestCase {
'getsize' => FALSE,
);
$default_output = theme('image', $image_info);
- $this->assertRaw($default_output, "Preview image is displayed using 'medium' style.");
+ $this->assertRaw($default_output, t("Preview image is displayed using 'medium' style."));
// Add alt/title fields to the image and verify that they are displayed.
$image_info = array(
@@ -743,7 +743,7 @@ class ImageFieldDisplayTestCase extends ImageFieldTestCase {
);
$this->drupalPost('node/' . $nid . '/edit', $edit, t('Save'));
$default_output = theme('image', $image_info);
- $this->assertRaw($default_output, 'Image displayed using user supplied alt and title attributes.');
+ $this->assertRaw($default_output, t('Image displayed using user supplied alt and title attributes.'));
}
/**
@@ -760,7 +760,7 @@ class ImageFieldDisplayTestCase extends ImageFieldTestCase {
$this->drupalGet('node/' . $node->nid);
// Verify that no image is displayed on the page by checking for the class
// that would be used on the image field.
- $this->assertNoPattern('<div class="(.*?)field-name-' . strtr($field_name, '_', '-') . '(.*?)">', 'No image displayed when no image is attached and no default image specified.');
+ $this->assertNoPattern('<div class="(.*?)field-name-' . strtr($field_name, '_', '-') . '(.*?)">', t('No image displayed when no image is attached and no default image specified.'));
// Add a default image to the imagefield instance.
$images = $this->drupalGetTestFiles('image');
@@ -774,7 +774,7 @@ class ImageFieldDisplayTestCase extends ImageFieldTestCase {
$image = file_load($field['settings']['default_image']);
$default_output = theme('image', array('path' => $image->uri, 'getsize' => TRUE));
$this->drupalGet('node/' . $node->nid);
- $this->assertRaw($default_output, 'Default image displayed when no user supplied image is present.');
+ $this->assertRaw($default_output, t('Default image displayed when no user supplied image is present.'));
// Create a node with an image attached and ensure that the default image
// is not displayed.
@@ -786,8 +786,8 @@ class ImageFieldDisplayTestCase extends ImageFieldTestCase {
);
$image_output = theme('image', $image_info);
$this->drupalGet('node/' . $nid);
- $this->assertNoRaw($default_output, 'Default image is not displayed when user supplied image is present.');
- $this->assertRaw($image_output, 'User supplied image is displayed.');
+ $this->assertNoRaw($default_output, t('Default image is not displayed when user supplied image is present.'));
+ $this->assertRaw($image_output, t('User supplied image is displayed.'));
// Remove default image from the field and make sure it is no longer used.
$edit = array(
@@ -797,7 +797,7 @@ class ImageFieldDisplayTestCase extends ImageFieldTestCase {
// Clear field info cache so the new default image is detected.
field_info_cache_clear();
$field = field_info_field($field_name);
- $this->assertFalse($field['settings']['default_image'], 'Default image removed from field.');
+ $this->assertFalse($field['settings']['default_image'], t('Default image removed from field.'));
}
}
@@ -843,8 +843,8 @@ class ImageFieldValidateTestCase extends ImageFieldTestCase {
}
}
$nid = $this->uploadNodeImage($image_that_is_too_small, $field_name, 'article');
- $this->assertText(t('The specified file ' . $image_that_is_too_small->filename . ' could not be uploaded. The image is too small; the minimum dimensions are 50x50 pixels.'), 'Node save failed when minimum image resolution was not met.');
+ $this->assertText(t('The specified file ' . $image_that_is_too_small->filename . ' could not be uploaded. The image is too small; the minimum dimensions are 50x50 pixels.'), t('Node save failed when minimum image resolution was not met.'));
$nid = $this->uploadNodeImage($image_that_is_too_big, $field_name, 'article');
- $this->assertText(t('The image was resized to fit within the maximum allowed dimensions of 100x100 pixels.'), 'Image exceeding max resolution was properly resized.');
+ $this->assertText(t('The image was resized to fit within the maximum allowed dimensions of 100x100 pixels.'), t('Image exceeding max resolution was properly resized.'));
}
}
diff --git a/modules/locale/locale.test b/modules/locale/locale.test
index 03dce7ec7..e6c7cac81 100644
--- a/modules/locale/locale.test
+++ b/modules/locale/locale.test
@@ -51,8 +51,8 @@ class LocaleConfigurationTest extends DrupalWebTestCase {
'langcode' => 'fr',
);
$this->drupalPost('admin/config/regional/language/add', $edit, t('Add language'));
- $this->assertText('fr', 'Language added successfully.');
- $this->assertEqual($this->getUrl(), url('admin/config/regional/language', array('absolute' => TRUE)), 'Correct page redirection.');
+ $this->assertText('fr', t('Language added successfully.'));
+ $this->assertEqual($this->getUrl(), url('admin/config/regional/language', array('absolute' => TRUE)), t('Correct page redirection.'));
// Add custom language.
// Code for the language.
@@ -71,79 +71,79 @@ class LocaleConfigurationTest extends DrupalWebTestCase {
'direction' => '0',
);
$this->drupalPost('admin/config/regional/language/add', $edit, t('Add custom language'));
- $this->assertEqual($this->getUrl(), url('admin/config/regional/language', array('absolute' => TRUE)), 'Correct page redirection.');
- $this->assertText($langcode, 'Language code found.');
- $this->assertText($name, 'Name found.');
- $this->assertText($native, 'Native found.');
- $this->assertText($native, 'Test language added.');
+ $this->assertEqual($this->getUrl(), url('admin/config/regional/language', array('absolute' => TRUE)), t('Correct page redirection.'));
+ $this->assertText($langcode, t('Language code found.'));
+ $this->assertText($name, t('Name found.'));
+ $this->assertText($native, t('Native found.'));
+ $this->assertText($native, t('Test language added.'));
// Check if we can change the default language.
$path = 'admin/config/regional/language';
$this->drupalGet($path);
- $this->assertFieldChecked('edit-site-default-en', 'English is the default language.');
+ $this->assertFieldChecked('edit-site-default-en', t('English is the default language.'));
// Change the default language.
$edit = array(
'site_default' => $langcode,
);
$this->drupalPost(NULL, $edit, t('Save configuration'));
- $this->assertNoFieldChecked('edit-site-default-en', 'Default language updated.');
- $this->assertEqual($this->getUrl(), url('admin/config/regional/language', array('absolute' => TRUE)), 'Correct page redirection.');
+ $this->assertNoFieldChecked('edit-site-default-en', t('Default language updated.'));
+ $this->assertEqual($this->getUrl(), url('admin/config/regional/language', array('absolute' => TRUE)), t('Correct page redirection.'));
// Ensure we can't delete the default language.
$this->drupalGet('admin/config/regional/language/delete/' . $langcode);
- $this->assertEqual($this->getUrl(), url('admin/config/regional/language', array('absolute' => TRUE)), 'Correct page redirection.');
- $this->assertText(t('The default language cannot be deleted.'), 'Failed to delete the default language.');
+ $this->assertEqual($this->getUrl(), url('admin/config/regional/language', array('absolute' => TRUE)), t('Correct page redirection.'));
+ $this->assertText(t('The default language cannot be deleted.'), t('Failed to delete the default language.'));
// Check if we can disable a language.
$edit = array(
'enabled[en]' => FALSE,
);
$this->drupalPost($path, $edit, t('Save configuration'));
- $this->assertNoFieldChecked('edit-enabled-en', 'Language disabled.');
+ $this->assertNoFieldChecked('edit-enabled-en', t('Language disabled.'));
// Set disabled language to be the default and ensure it is re-enabled.
$edit = array(
'site_default' => 'en',
);
$this->drupalPost(NULL, $edit, t('Save configuration'));
- $this->assertFieldChecked('edit-enabled-en', 'Default language re-enabled.');
+ $this->assertFieldChecked('edit-enabled-en', t('Default language re-enabled.'));
// Ensure 'edit' link works.
$this->clickLink(t('edit'));
- $this->assertTitle(t('Edit language | Drupal'), 'Page title is "Edit language".');
+ $this->assertTitle(t('Edit language | Drupal'), t('Page title is "Edit language".'));
// Edit a language.
$name = $this->randomName(16);
$edit = array(
'name' => $name,
);
$this->drupalPost('admin/config/regional/language/edit/' . $langcode, $edit, t('Save language'));
- $this->assertRaw($name, 'The language has been updated.');
- $this->assertEqual($this->getUrl(), url('admin/config/regional/language', array('absolute' => TRUE)), 'Correct page redirection.');
+ $this->assertRaw($name, t('The language has been updated.'));
+ $this->assertEqual($this->getUrl(), url('admin/config/regional/language', array('absolute' => TRUE)), t('Correct page redirection.'));
// Ensure 'delete' link works.
$this->drupalGet('admin/config/regional/language');
$this->clickLink(t('delete'));
- $this->assertText(t('Are you sure you want to delete the language'), '"delete" link is correct.');
+ $this->assertText(t('Are you sure you want to delete the language'), t('"delete" link is correct.'));
// Delete the language.
$this->drupalGet('admin/config/regional/language/delete/' . $langcode);
// First test the 'cancel' link.
$this->clickLink(t('Cancel'));
- $this->assertEqual($this->getUrl(), url('admin/config/regional/language', array('absolute' => TRUE)), 'Correct page redirection.');
- $this->assertRaw($name, 'The language was not deleted.');
+ $this->assertEqual($this->getUrl(), url('admin/config/regional/language', array('absolute' => TRUE)), t('Correct page redirection.'));
+ $this->assertRaw($name, t('The language was not deleted.'));
// Delete the language for real. This a confirm form, we do not need any
// fields changed.
$this->drupalPost('admin/config/regional/language/delete/' . $langcode, array(), t('Delete'));
// We need raw here because %locale will add HTML.
- $this->assertRaw(t('The language %locale has been removed.', array('%locale' => $name)), 'The test language has been removed.');
- $this->assertEqual($this->getUrl(), url('admin/config/regional/language', array('absolute' => TRUE)), 'Correct page redirection.');
+ $this->assertRaw(t('The language %locale has been removed.', array('%locale' => $name)), t('The test language has been removed.'));
+ $this->assertEqual($this->getUrl(), url('admin/config/regional/language', array('absolute' => TRUE)), t('Correct page redirection.'));
// Verify that language is no longer found.
$this->drupalGet('admin/config/regional/language/delete/' . $langcode);
- $this->assertResponse(404, 'Language no longer found.');
+ $this->assertResponse(404, t('Language no longer found.'));
// Ensure we can't delete the English language.
$this->drupalGet('admin/config/regional/language/delete/en');
- $this->assertEqual($this->getUrl(), url('admin/config/regional/language', array('absolute' => TRUE)), 'Correct page redirection.');
- $this->assertText(t('The English language cannot be deleted.'), 'Failed to delete English language.');
+ $this->assertEqual($this->getUrl(), url('admin/config/regional/language', array('absolute' => TRUE)), t('Correct page redirection.'));
+ $this->assertText(t('The English language cannot be deleted.'), t('Failed to delete English language.'));
}
}
@@ -202,12 +202,12 @@ class LocaleTranslationFunctionalTest extends DrupalWebTestCase {
t($name, array(), array('langcode' => $langcode));
// Reset locale cache.
locale_reset();
- $this->assertText($langcode, 'Language code found.');
- $this->assertText($name, 'Name found.');
- $this->assertText($native, 'Native found.');
+ $this->assertText($langcode, t('Language code found.'));
+ $this->assertText($name, t('Name found.'));
+ $this->assertText($native, t('Native found.'));
// No t() here, we do not want to add this string to the database and it's
// surely not translated yet.
- $this->assertText($native, 'Test language added.');
+ $this->assertText($native, t('Test language added.'));
$this->drupalLogout();
// Search for the name and translate it.
@@ -222,8 +222,8 @@ class LocaleTranslationFunctionalTest extends DrupalWebTestCase {
// assertText() seems to remove the input field where $name always could be
// found, so this is not a false assert. See how assertNoText succeeds
// later.
- $this->assertText($name, 'Search found the name.');
- $this->assertRaw($language_indicator, 'Name is untranslated.');
+ $this->assertText($name, t('Search found the name.'));
+ $this->assertRaw($language_indicator, t('Name is untranslated.'));
// Assume this is the only result, given the random name.
$this->clickLink(t('edit'));
// We save the lid from the path.
@@ -231,24 +231,24 @@ class LocaleTranslationFunctionalTest extends DrupalWebTestCase {
preg_match('!admin/config/regional/translate/edit/(\d+)!', $this->getUrl(), $matches);
$lid = $matches[1];
// No t() here, it's surely not translated yet.
- $this->assertText($name, 'name found on edit screen.');
+ $this->assertText($name, t('name found on edit screen.'));
$edit = array(
"translations[$langcode]" => $translation,
);
$this->drupalPost(NULL, $edit, t('Save translations'));
- $this->assertText(t('The string has been saved.'), 'The string has been saved.');
- $this->assertEqual($this->getUrl(), url('admin/config/regional/translate/translate', array('absolute' => TRUE)), 'Correct page redirection.');
- $this->assertTrue($name != $translation && t($name, array(), array('langcode' => $langcode)) == $translation, 't() works.');
+ $this->assertText(t('The string has been saved.'), t('The string has been saved.'));
+ $this->assertEqual($this->getUrl(), url('admin/config/regional/translate/translate', array('absolute' => TRUE)), t('Correct page redirection.'));
+ $this->assertTrue($name != $translation && t($name, array(), array('langcode' => $langcode)) == $translation, t('t() works.'));
$this->drupalPost('admin/config/regional/translate/translate', $search, t('Filter'));
// The indicator should not be here.
- $this->assertNoRaw($language_indicator, 'String is translated.');
+ $this->assertNoRaw($language_indicator, t('String is translated.'));
// Try to edit a non-existent string and ensure we're redirected correctly.
// Assuming we don't have 999,999 strings already.
$random_lid = 999999;
$this->drupalGet('admin/config/regional/translate/edit/' . $random_lid);
- $this->assertText(t('String not found'), 'String not found.');
- $this->assertEqual($this->getUrl(), url('admin/config/regional/translate/translate', array('absolute' => TRUE)), 'Correct page redirection.');
+ $this->assertText(t('String not found'), t('String not found.'));
+ $this->assertEqual($this->getUrl(), url('admin/config/regional/translate/translate', array('absolute' => TRUE)), t('Correct page redirection.'));
$this->drupalLogout();
// Delete the language.
@@ -257,12 +257,12 @@ class LocaleTranslationFunctionalTest extends DrupalWebTestCase {
// This a confirm form, we do not need any fields changed.
$this->drupalPost($path, array(), t('Delete'));
// We need raw here because %locale will add HTML.
- $this->assertRaw(t('The language %locale has been removed.', array('%locale' => $name)), 'The test language has been removed.');
+ $this->assertRaw(t('The language %locale has been removed.', array('%locale' => $name)), t('The test language has been removed.'));
// Reload to remove $name.
$this->drupalGet($path);
- $this->assertNoText($langcode, 'Language code not found.');
- $this->assertNoText($name, 'Name not found.');
- $this->assertNoText($native, 'Native not found.');
+ $this->assertNoText($langcode, t('Language code not found.'));
+ $this->assertNoText($name, t('Name not found.'));
+ $this->assertNoText($native, t('Native not found.'));
$this->drupalLogout();
// Delete the string.
@@ -276,20 +276,20 @@ class LocaleTranslationFunctionalTest extends DrupalWebTestCase {
$this->drupalPost('admin/config/regional/translate/translate', $search, t('Filter'));
// Assume this is the only result, given the random name.
$this->clickLink(t('delete'));
- $this->assertText(t('Are you sure you want to delete the string'), '"delete" link is correct.');
+ $this->assertText(t('Are you sure you want to delete the string'), t('"delete" link is correct.'));
// Delete the string.
$path = 'admin/config/regional/translate/delete/' . $lid;
$this->drupalGet($path);
// First test the 'cancel' link.
$this->clickLink(t('Cancel'));
- $this->assertEqual($this->getUrl(), url('admin/config/regional/translate/translate', array('absolute' => TRUE)), 'Correct page redirection.');
- $this->assertRaw($name, 'The string was not deleted.');
+ $this->assertEqual($this->getUrl(), url('admin/config/regional/translate/translate', array('absolute' => TRUE)), t('Correct page redirection.'));
+ $this->assertRaw($name, t('The string was not deleted.'));
// Delete the name string.
$this->drupalPost('admin/config/regional/translate/delete/' . $lid, array(), t('Delete'));
- $this->assertText(t('The string has been removed.'), 'The string has been removed message.');
- $this->assertEqual($this->getUrl(), url('admin/config/regional/translate/translate', array('absolute' => TRUE)), 'Correct page redirection.');
+ $this->assertText(t('The string has been removed.'), t('The string has been removed message.'));
+ $this->assertEqual($this->getUrl(), url('admin/config/regional/translate/translate', array('absolute' => TRUE)), t('Correct page redirection.'));
$this->drupalPost('admin/config/regional/translate/translate', $search, t('Filter'));
- $this->assertNoText($name, 'Search now can not find the name.');
+ $this->assertNoText($name, t('Search now can not find the name.'));
}
/*
@@ -330,7 +330,7 @@ class LocaleTranslationFunctionalTest extends DrupalWebTestCase {
->condition('l.textgroup', 'default')
->execute();
$url = 'admin/config/regional/translate/edit/' . $result->fetchObject()->lid;
- $edit = array('translations[' . $langcode . ']' => $this->randomName());
+ $edit = array('translations['. $langcode .']' => $this->randomName());
$this->drupalPost($url, $edit, t('Save translations'));
// Trigger JavaScript translation parsing and building.
@@ -345,14 +345,14 @@ class LocaleTranslationFunctionalTest extends DrupalWebTestCase {
->execute()
->fetchObject();
$js_file = 'public://' . variable_get('locale_js_directory', 'languages') . '/' . $langcode . '_' . $file->javascript . '.js';
- $this->assertTrue($result = file_exists($js_file), 'JavaScript file created: ' . $result ? $js_file : t('not found'));
+ $this->assertTrue($result = file_exists($js_file), t('JavaScript file created: %file', array('%file' => $result ? $js_file : t('not found'))));
// Test JavaScript translation rebuilding.
file_unmanaged_delete($js_file);
- $this->assertTrue($result = !file_exists($js_file), 'JavaScript file deleted: ' . $result ? $js_file : t('found'));
+ $this->assertTrue($result = !file_exists($js_file), t('JavaScript file deleted: %file', array('%file' => $result ? $js_file : t('found'))));
cache_clear_all();
_locale_rebuild_js($langcode);
- $this->assertTrue($result = file_exists($js_file), 'JavaScript file rebuilt: ' . $result ? $js_file : t('not found'));
+ $this->assertTrue($result = file_exists($js_file), t('JavaScript file rebuilt: %file', array('%file' => $result ? $js_file : t('not found'))));
}
/**
@@ -382,7 +382,7 @@ class LocaleTranslationFunctionalTest extends DrupalWebTestCase {
$key = $this->randomName(16);
$bad_translations[$key] = '<<SCRIPT>alert("xss");//<</SCRIPT>' . $key;
$key = $this->randomName(16);
- $bad_translations[$key] = "<BODY ONLOAD=alert('xss')>" . $key;
+ $bad_translations[$key] ="<BODY ONLOAD=alert('xss')>" . $key;
// Add custom language.
$edit = array(
@@ -405,7 +405,7 @@ class LocaleTranslationFunctionalTest extends DrupalWebTestCase {
$this->drupalPost('admin/config/regional/translate/translate', $search, t('Filter'));
// Find the edit path.
$content = $this->drupalGetContent();
- $this->assertTrue(preg_match('@(admin/config/regional/translate/edit/[0-9]+)@', $content, $matches), 'Found the edit path.');
+ $this->assertTrue(preg_match('@(admin/config/regional/translate/edit/[0-9]+)@', $content, $matches), t('Found the edit path.'));
$path = $matches[0];
foreach ($bad_translations as $key => $translation) {
$edit = array(
@@ -414,8 +414,8 @@ class LocaleTranslationFunctionalTest extends DrupalWebTestCase {
$this->drupalPost($path, $edit, t('Save translations'));
// Check for a form error on the textarea.
$form_class = $this->xpath('//form[@id="locale-translate-edit-form"]//textarea/@class');
- $this->assertNotIdentical(FALSE, strpos($form_class[0], 'error'), 'The string was rejected as unsafe.');
- $this->assertNoText(t('The string has been saved.'), 'The string was not saved.');
+ $this->assertNotIdentical(FALSE, strpos($form_class[0], 'error'), t('The string was rejected as unsafe.'));
+ $this->assertNoText(t('The string has been saved.'), t('The string was not saved.'));
}
}
@@ -472,7 +472,7 @@ class LocaleTranslationFunctionalTest extends DrupalWebTestCase {
// assertText() seems to remove the input field where $name always could be
// found, so this is not a false assert. See how assertNoText succeeds
// later.
- $this->assertText($name, 'Search found the string.');
+ $this->assertText($name, t('Search found the string.'));
// Ensure untranslated string doesn't appear if searching on 'only
// translated strings'.
@@ -483,7 +483,7 @@ class LocaleTranslationFunctionalTest extends DrupalWebTestCase {
'group' => 'all',
);
$this->drupalPost('admin/config/regional/translate/translate', $search, t('Filter'));
- $this->assertText(t('No strings available.'), "Search didn't find the string.");
+ $this->assertText(t('No strings available.'), t("Search didn't find the string."));
// Ensure untranslated string appears if searching on 'only untranslated
// strings'.
@@ -494,7 +494,7 @@ class LocaleTranslationFunctionalTest extends DrupalWebTestCase {
'group' => 'all',
);
$this->drupalPost('admin/config/regional/translate/translate', $search, t('Filter'));
- $this->assertNoText(t('No strings available.'), 'Search found the string.');
+ $this->assertNoText(t('No strings available.'), t('Search found the string.'));
// Add translation.
// Assume this is the only result, given the random name.
@@ -517,7 +517,7 @@ class LocaleTranslationFunctionalTest extends DrupalWebTestCase {
'group' => 'all',
);
$this->drupalPost('admin/config/regional/translate/translate', $search, t('Filter'));
- $this->assertNoText(t('No strings available.'), 'Search found the translation.');
+ $this->assertNoText(t('No strings available.'), t('Search found the translation.'));
// Ensure translated source string doesn't appear if searching on 'only
// untranslated strings'.
@@ -528,7 +528,7 @@ class LocaleTranslationFunctionalTest extends DrupalWebTestCase {
'group' => 'all',
);
$this->drupalPost('admin/config/regional/translate/translate', $search, t('Filter'));
- $this->assertText(t('No strings available.'), "Search didn't find the source string.");
+ $this->assertText(t('No strings available.'), t("Search didn't find the source string."));
// Ensure translated string doesn't appear if searching on 'only
// untranslated strings'.
@@ -539,7 +539,7 @@ class LocaleTranslationFunctionalTest extends DrupalWebTestCase {
'group' => 'all',
);
$this->drupalPost('admin/config/regional/translate/translate', $search, t('Filter'));
- $this->assertText(t('No strings available.'), "Search didn't find the translation.");
+ $this->assertText(t('No strings available.'), t("Search didn't find the translation."));
// Ensure translated string does appear if searching on the custom language.
$search = array(
@@ -549,7 +549,7 @@ class LocaleTranslationFunctionalTest extends DrupalWebTestCase {
'group' => 'all',
);
$this->drupalPost('admin/config/regional/translate/translate', $search, t('Filter'));
- $this->assertNoText(t('No strings available.'), 'Search found the translation.');
+ $this->assertNoText(t('No strings available.'), t('Search found the translation.'));
// Ensure translated string doesn't appear if searching on English.
$search = array(
@@ -559,7 +559,7 @@ class LocaleTranslationFunctionalTest extends DrupalWebTestCase {
'group' => 'all',
);
$this->drupalPost('admin/config/regional/translate/translate', $search, t('Filter'));
- $this->assertText(t('No strings available.'), "Search didn't find the translation.");
+ $this->assertText(t('No strings available.'), t("Search didn't find the translation."));
// Search for a string that isn't in the system.
$unavailable_string = $this->randomName(16);
@@ -570,7 +570,7 @@ class LocaleTranslationFunctionalTest extends DrupalWebTestCase {
'group' => 'all',
);
$this->drupalPost('admin/config/regional/translate/translate', $search, t('Filter'));
- $this->assertText(t('No strings available.'), "Search didn't find the invalid string.");
+ $this->assertText(t('No strings available.'), t("Search didn't find the invalid string."));
}
}
@@ -608,16 +608,16 @@ class LocaleImportFunctionalTest extends DrupalWebTestCase {
));
// The import should automatically create the corresponding language.
- $this->assertRaw(t('The language %language has been created.', array('%language' => 'French')), 'The language has been automatically created.');
+ $this->assertRaw(t('The language %language has been created.', array('%language' => 'French')), t('The language has been automatically created.'));
// The import should have created 7 strings.
- $this->assertRaw(t('The translation was successfully imported. There are %number newly created translated strings, %update strings were updated and %delete strings were removed.', array('%number' => 7, '%update' => 0, '%delete' => 0)), 'The translation file was successfully imported.');
+ $this->assertRaw(t('The translation was successfully imported. There are %number newly created translated strings, %update strings were updated and %delete strings were removed.', array('%number' => 7, '%update' => 0, '%delete' => 0)), t('The translation file was successfully imported.'));
// This import should have saved plural forms to have 2 variants.
- $this->assert(db_query("SELECT plurals FROM {languages} WHERE language = 'fr'")->fetchField() == 2, 'Plural number initialized.');
+ $this->assert(db_query("SELECT plurals FROM {languages} WHERE language = 'fr'")->fetchField() == 2, t('Plural number initialized.'));
// Ensure we were redirected correctly.
- $this->assertEqual($this->getUrl(), url('admin/config/regional/translate', array('absolute' => TRUE)), 'Correct page redirection.');
+ $this->assertEqual($this->getUrl(), url('admin/config/regional/translate', array('absolute' => TRUE)), t('Correct page redirection.'));
// Try importing a .po file with invalid tags in the default text group.
@@ -626,9 +626,9 @@ class LocaleImportFunctionalTest extends DrupalWebTestCase {
));
// The import should have created 1 string and rejected 2.
- $this->assertRaw(t('The translation was successfully imported. There are %number newly created translated strings, %update strings were updated and %delete strings were removed.', array('%number' => 1, '%update' => 0, '%delete' => 0)), 'The translation file was successfully imported.');
+ $this->assertRaw(t('The translation was successfully imported. There are %number newly created translated strings, %update strings were updated and %delete strings were removed.', array('%number' => 1, '%update' => 0, '%delete' => 0)), t('The translation file was successfully imported.'));
$skip_message = format_plural(2, 'One translation string was skipped because it contains disallowed HTML.', '@count translation strings were skipped because they contain disallowed HTML.');
- $this->assertRaw($skip_message, 'Unsafe strings were skipped.');
+ $this->assertRaw($skip_message, t('Unsafe strings were skipped.'));
// Try importing a .po file with invalid tags in a non default text group.
@@ -638,7 +638,7 @@ class LocaleImportFunctionalTest extends DrupalWebTestCase {
));
// The import should have created 3 strings.
- $this->assertRaw(t('The translation was successfully imported. There are %number newly created translated strings, %update strings were updated and %delete strings were removed.', array('%number' => 3, '%update' => 0, '%delete' => 0)), 'The translation file was successfully imported.');
+ $this->assertRaw(t('The translation was successfully imported. There are %number newly created translated strings, %update strings were updated and %delete strings were removed.', array('%number' => 3, '%update' => 0, '%delete' => 0)), t('The translation file was successfully imported.'));
// Try importing a .po file which doesn't exist.
@@ -648,8 +648,8 @@ class LocaleImportFunctionalTest extends DrupalWebTestCase {
'files[file]' => $name,
'group' => 'custom',
), t('Import'));
- $this->assertEqual($this->getUrl(), url('admin/config/regional/translate/import', array('absolute' => TRUE)), 'Correct page redirection.');
- $this->assertText(t('File to import not found.'), 'File to import not found message.');
+ $this->assertEqual($this->getUrl(), url('admin/config/regional/translate/import', array('absolute' => TRUE)), t('Correct page redirection.'));
+ $this->assertText(t('File to import not found.'), t('File to import not found message.'));
// Try importing a .po file with overriding strings, and ensure existing
@@ -660,7 +660,7 @@ class LocaleImportFunctionalTest extends DrupalWebTestCase {
));
// The import should have created 1 string.
- $this->assertRaw(t('The translation was successfully imported. There are %number newly created translated strings, %update strings were updated and %delete strings were removed.', array('%number' => 1, '%update' => 0, '%delete' => 0)), 'The translation file was successfully imported.');
+ $this->assertRaw(t('The translation was successfully imported. There are %number newly created translated strings, %update strings were updated and %delete strings were removed.', array('%number' => 1, '%update' => 0, '%delete' => 0)), t('The translation file was successfully imported.'));
// Ensure string wasn't overwritten.
$search = array(
'string' => 'Montag',
@@ -669,10 +669,10 @@ class LocaleImportFunctionalTest extends DrupalWebTestCase {
'group' => 'all',
);
$this->drupalPost('admin/config/regional/translate/translate', $search, t('Filter'));
- $this->assertText(t('No strings available.'), 'String not overwritten by imported string.');
+ $this->assertText(t('No strings available.'), t('String not overwritten by imported string.'));
// This import should not have changed number of plural forms.
- $this->assert(db_query("SELECT plurals FROM {languages} WHERE language = 'fr'")->fetchField() == 2, 'Plural numbers untouched.');
+ $this->assert(db_query("SELECT plurals FROM {languages} WHERE language = 'fr'")->fetchField() == 2, t('Plural numbers untouched.'));
// Try importing a .po file with overriding strings, and ensure existing
// strings are overwritten.
@@ -682,7 +682,7 @@ class LocaleImportFunctionalTest extends DrupalWebTestCase {
));
// The import should have updated 2 strings.
- $this->assertRaw(t('The translation was successfully imported. There are %number newly created translated strings, %update strings were updated and %delete strings were removed.', array('%number' => 0, '%update' => 2, '%delete' => 0)), 'The translation file was successfully imported.');
+ $this->assertRaw(t('The translation was successfully imported. There are %number newly created translated strings, %update strings were updated and %delete strings were removed.', array('%number' => 0, '%update' => 2, '%delete' => 0)), t('The translation file was successfully imported.'));
// Ensure string was overwritten.
$search = array(
'string' => 'Montag',
@@ -691,9 +691,9 @@ class LocaleImportFunctionalTest extends DrupalWebTestCase {
'group' => 'all',
);
$this->drupalPost('admin/config/regional/translate/translate', $search, t('Filter'));
- $this->assertNoText(t('No strings available.'), 'String overwritten by imported string.');
+ $this->assertNoText(t('No strings available.'), t('String overwritten by imported string.'));
// This import should have changed number of plural forms.
- $this->assert(db_query("SELECT plurals FROM {languages} WHERE language = 'fr'")->fetchField() == 3, 'Plural numbers changed.');
+ $this->assert(db_query("SELECT plurals FROM {languages} WHERE language = 'fr'")->fetchField() == 3, t('Plural numbers changed.'));
}
/**
@@ -722,7 +722,7 @@ class LocaleImportFunctionalTest extends DrupalWebTestCase {
// Ensure the translation file was automatically imported when language was
// added.
- $this->assertText(t('One translation file imported for the enabled modules.'), 'Language file automatically imported.');
+ $this->assertText(t('One translation file imported for the enabled modules.'), t('Language file automatically imported.'));
// Ensure strings were successfully imported.
$search = array(
@@ -732,7 +732,7 @@ class LocaleImportFunctionalTest extends DrupalWebTestCase {
'group' => 'all',
);
$this->drupalPost('admin/config/regional/translate/translate', $search, t('Filter'));
- $this->assertNoText(t('No strings available.'), 'String successfully imported.');
+ $this->assertNoText(t('No strings available.'), t('String successfully imported.'));
}
/**
@@ -745,8 +745,8 @@ class LocaleImportFunctionalTest extends DrupalWebTestCase {
'langcode' => 'hr',
));
- $this->assertIdentical(t('May', array(), array('langcode' => 'hr', 'context' => 'Long month name')), 'Svibanj', 'Long month name context is working.');
- $this->assertIdentical(t('May', array(), array('langcode' => 'hr')), 'Svi.', 'Default context is working.');
+ $this->assertIdentical(t('May', array(), array('langcode' => 'hr', 'context' => 'Long month name')), 'Svibanj', t('Long month name context is working.'));
+ $this->assertIdentical(t('May', array(), array('langcode' => 'hr')), 'Svi.', t('Default context is working.'));
}
/**
@@ -919,9 +919,9 @@ class LocaleExportFunctionalTest extends DrupalWebTestCase {
), t('Export'));
// Ensure we have a translation file.
- $this->assertRaw('# French translation of Drupal', 'Exported French translation file.');
+ $this->assertRaw('# French translation of Drupal', t('Exported French translation file.'));
// Ensure our imported translations exist in the file.
- $this->assertRaw('msgstr "lundi"', 'French translations present in exported file.');
+ $this->assertRaw('msgstr "lundi"', t('French translations present in exported file.'));
}
/**
@@ -934,7 +934,7 @@ class LocaleExportFunctionalTest extends DrupalWebTestCase {
// doesn't work.
$this->drupalPost('admin/config/regional/translate/export', array(), t('Export'));
// Ensure we have a translation file.
- $this->assertRaw('# LANGUAGE translation of PROJECT', 'Exported translation template file.');
+ $this->assertRaw('# LANGUAGE translation of PROJECT', t('Exported translation template file.'));
}
/**
@@ -982,7 +982,7 @@ class LocaleInstallTest extends DrupalWebTestCase {
function testFunctionSignatures() {
$reflector_t = new ReflectionFunction('t');
$reflector_st = new ReflectionFunction('st');
- $this->assertEqual($reflector_t->getParameters(), $reflector_st->getParameters(), 'Function signatures of t() and st() are equal.');
+ $this->assertEqual($reflector_t->getParameters(), $reflector_st->getParameters(), t('Function signatures of t() and st() are equal.'));
}
}
@@ -1021,7 +1021,7 @@ class LocaleUninstallFunctionalTest extends DrupalWebTestCase {
// Check the UI language.
drupal_language_initialize();
global $language;
- $this->assertEqual($language->language, $this->language, 'Current language: ' . $language->language);
+ $this->assertEqual($language->language, $this->language, t('Current language: %lang', array('%lang' => $language->language)));
// Enable multilingual workflow option for articles.
variable_set('language_content_type_article', 1);
@@ -1042,7 +1042,7 @@ class LocaleUninstallFunctionalTest extends DrupalWebTestCase {
_locale_rebuild_js('fr');
$file = db_query('SELECT javascript FROM {languages} WHERE language = :language', array(':language' => 'fr'))->fetchObject();
$js_file = 'public://' . variable_get('locale_js_directory', 'languages') . '/fr_' . $file->javascript . '.js';
- $this->assertTrue($result = file_exists($js_file), 'JavaScript file created: ' . $result ? $js_file : t('none'));
+ $this->assertTrue($result = file_exists($js_file), t('JavaScript file created: %file', array('%file' => $result ? $js_file : t('none'))));
// Disable string caching.
variable_set('locale_cache_strings', 0);
@@ -1067,44 +1067,44 @@ class LocaleUninstallFunctionalTest extends DrupalWebTestCase {
// Check the init language logic.
drupal_language_initialize();
- $this->assertEqual($language->language, 'en', 'Language after uninstall: ' . $language->language);
+ $this->assertEqual($language->language, 'en', t('Language after uninstall: %lang', array('%lang' => $language->language)));
// Check JavaScript files deletion.
- $this->assertTrue($result = !file_exists($js_file), 'JavaScript file deleted: ' . $result ? $js_file : t('found'));
+ $this->assertTrue($result = !file_exists($js_file), t('JavaScript file deleted: %file', array('%file' => $result ? $js_file : t('found'))));
// Check language count.
$language_count = variable_get('language_count', 1);
- $this->assertEqual($language_count, 1, 'Language count: ' . $language_count);
+ $this->assertEqual($language_count, 1, t('Language count: %count', array('%count' => $language_count)));
// Check language negotiation.
require_once DRUPAL_ROOT . '/includes/language.inc';
- $this->assertTrue(count(language_types()) == count(drupal_language_types()), 'Language types reset');
+ $this->assertTrue(count(language_types()) == count(drupal_language_types()), t('Language types reset'));
$language_negotiation = language_negotiation_get(LANGUAGE_TYPE_INTERFACE) == LANGUAGE_NEGOTIATION_DEFAULT;
- $this->assertTrue($language_negotiation, 'Interface language negotiation: ' . t($language_negotiation ? 'none' : 'set'));
+ $this->assertTrue($language_negotiation, t('Interface language negotiation: %setting', array('%setting' => t($language_negotiation ? 'none' : 'set'))));
$language_negotiation = language_negotiation_get(LANGUAGE_TYPE_CONTENT) == LANGUAGE_NEGOTIATION_DEFAULT;
- $this->assertTrue($language_negotiation, 'Content language negotiation: ' . t($language_negotiation ? 'none' : 'set'));
+ $this->assertTrue($language_negotiation, t('Content language negotiation: %setting', array('%setting' => t($language_negotiation ? 'none' : 'set'))));
$language_negotiation = language_negotiation_get(LANGUAGE_TYPE_URL) == LANGUAGE_NEGOTIATION_DEFAULT;
- $this->assertTrue($language_negotiation, 'URL language negotiation: ' . t($language_negotiation ? 'none' : 'set'));
+ $this->assertTrue($language_negotiation, t('URL language negotiation: %setting', array('%setting' => t($language_negotiation ? 'none' : 'set'))));
// Check language providers settings.
- $this->assertFalse(variable_get('locale_language_negotiation_url_part', FALSE), 'URL language provider indicator settings cleared.');
- $this->assertFalse(variable_get('locale_language_negotiation_session_param', FALSE), 'Visit language provider settings cleared.');
+ $this->assertFalse(variable_get('locale_language_negotiation_url_part', FALSE), t('URL language provider indicator settings cleared.'));
+ $this->assertFalse(variable_get('locale_language_negotiation_session_param', FALSE), t('Visit language provider settings cleared.'));
// Check JavaScript parsed.
$javascript_parsed_count = count(variable_get('javascript_parsed', array()));
- $this->assertEqual($javascript_parsed_count, 0, 'JavaScript parsed count: ' . $javascript_parsed_count);
+ $this->assertEqual($javascript_parsed_count, 0, t('JavaScript parsed count: %count', array('%count' => $javascript_parsed_count)));
// Check multilingual workflow option for articles.
$multilingual = variable_get('language_content_type_article', 0);
- $this->assertEqual($multilingual, 0, 'Multilingual workflow option: ' . t($multilingual ? 'enabled' : 'disabled'));
+ $this->assertEqual($multilingual, 0, t('Multilingual workflow option: %status', array('%status' => t($multilingual ? 'enabled': 'disabled'))));
// Check JavaScript translations directory.
$locale_js_directory = variable_get('locale_js_directory', 'languages');
- $this->assertEqual($locale_js_directory, 'languages', 'JavaScript translations directory: ' . $locale_js_directory);
+ $this->assertEqual($locale_js_directory, 'languages', t('JavaScript translations directory: %dir', array('%dir' => $locale_js_directory)));
// Check string caching.
$locale_cache_strings = variable_get('locale_cache_strings', 1);
- $this->assertEqual($locale_cache_strings, 1, 'String caching: ' . t($locale_cache_strings ? 'enabled' : 'disabled'));
+ $this->assertEqual($locale_cache_strings, 1, t('String caching: %status', array('%status' => t($locale_cache_strings ? 'enabled': 'disabled'))));
}
}
@@ -1177,7 +1177,7 @@ class LocaleLanguageSwitchingFunctionalTest extends DrupalWebTestCase {
// Assert that the language switching block is displayed on the frontpage.
$this->drupalGet('');
- $this->assertText(t('Languages'), 'Language switcher block found.');
+ $this->assertText(t('Languages'), t('Language switcher block found.'));
// Assert that only the current language is marked as active.
list($language_switcher) = $this->xpath('//div[@id=:id]/div[@class="content"]', array(':id' => 'block-locale-' . $language_type));
@@ -1206,8 +1206,8 @@ class LocaleLanguageSwitchingFunctionalTest extends DrupalWebTestCase {
$anchors['inactive'][] = $language;
}
}
- $this->assertIdentical($links, array('active' => array('en'), 'inactive' => array('fr')), 'Only the current language list item is marked as active on the language switcher block.');
- $this->assertIdentical($anchors, array('active' => array('en'), 'inactive' => array('fr')), 'Only the current language anchor is marked as active on the language switcher block.');
+ $this->assertIdentical($links, array('active' => array('en'), 'inactive' => array('fr')), t('Only the current language list item is marked as active on the language switcher block.'));
+ $this->assertIdentical($anchors, array('active' => array('en'), 'inactive' => array('fr')), t('Only the current language anchor is marked as active on the language switcher block.'));
}
}
@@ -1286,21 +1286,21 @@ class LocaleUserLanguageFunctionalTest extends DrupalWebTestCase {
$path = 'user/' . $web_user->uid . '/edit';
$this->drupalGet($path);
// Ensure language settings fieldset is available.
- $this->assertText(t('Language settings'), 'Language settings available.');
+ $this->assertText(t('Language settings'), t('Language settings available.'));
// Ensure custom language is present.
- $this->assertText($name, 'Language present on form.');
+ $this->assertText($name, t('Language present on form.'));
// Ensure disabled language isn't present.
- $this->assertNoText($name_disabled, 'Disabled language not present on form.');
+ $this->assertNoText($name_disabled, t('Disabled language not present on form.'));
// Switch to our custom language.
$edit = array(
'language' => $langcode,
);
$this->drupalPost($path, $edit, t('Save'));
// Ensure form was submitted successfully.
- $this->assertText(t('The changes have been saved.'), 'Changes were saved.');
+ $this->assertText(t('The changes have been saved.'), t('Changes were saved.'));
// Check if language was changed.
$elements = $this->xpath('//input[@id=:id]', array(':id' => 'edit-language-' . $langcode));
- $this->assertTrue(isset($elements[0]) && !empty($elements[0]['checked']), 'Default language successfully updated.');
+ $this->assertTrue(isset($elements[0]) && !empty($elements[0]['checked']), t('Default language successfully updated.'));
$this->drupalLogout();
}
@@ -1338,20 +1338,20 @@ class LocaleUserCreationTest extends DrupalWebTestCase {
'langcode' => 'fr',
);
$this->drupalPost('admin/config/regional/language/add', $edit, t('Add language'));
- $this->assertText($langcode, 'Language added successfully.');
- $this->assertEqual($this->getUrl(), url('admin/config/regional/language', array('absolute' => TRUE)), 'Correct page redirection.');
+ $this->assertText($langcode, t('Language added successfully.'));
+ $this->assertEqual($this->getUrl(), url('admin/config/regional/language', array('absolute' => TRUE)), t('Correct page redirection.'));
// Set language negotiation.
$edit = array(
'language[enabled][locale-url]' => TRUE,
);
$this->drupalPost('admin/config/regional/language/configure', $edit, t('Save settings'));
- $this->assertText(t('Language negotiation configuration saved.'), 'Set language negotiation.');
+ $this->assertText(t('Language negotiation configuration saved.'), t('Set language negotiation.'));
// Check if the language selector is available on admin/people/create and
// set to the currently active language.
$this->drupalGet($langcode . '/admin/people/create');
- $this->assertFieldChecked("edit-language-$langcode", 'Global language set in the language selector.');
+ $this->assertFieldChecked("edit-language-$langcode", t('Global language set in the language selector.'));
// Create a user with the admin/people/create form and check if the correct
// language is set.
@@ -1366,7 +1366,7 @@ class LocaleUserCreationTest extends DrupalWebTestCase {
$this->drupalPost($langcode . '/admin/people/create', $edit, t('Create new account'));
$user = user_load_by_name($username);
- $this->assertEqual($user->language, $langcode, 'New user has correct language set.');
+ $this->assertEqual($user->language, $langcode, t('New user has correct language set.'));
// Register a new user and check if the language selector is hidden.
$this->drupalLogout();
@@ -1383,7 +1383,7 @@ class LocaleUserCreationTest extends DrupalWebTestCase {
$this->drupalPost($langcode . '/user/register', $edit, t('Create new account'));
$user = user_load_by_name($username);
- $this->assertEqual($user->language, $langcode, 'New user has correct language set.');
+ $this->assertEqual($user->language, $langcode, t('New user has correct language set.'));
// Test if the admin can use the language selector and if the
// correct language is was saved.
@@ -1391,7 +1391,7 @@ class LocaleUserCreationTest extends DrupalWebTestCase {
$this->drupalLogin($admin_user);
$this->drupalGet($user_edit);
- $this->assertFieldChecked("edit-language-$langcode", 'Language selector is accessible and correct language is selected.');
+ $this->assertFieldChecked("edit-language-$langcode", t('Language selector is accessible and correct language is selected.'));
// Set pass_raw so we can login the new user.
$user->pass_raw = $this->randomName(10);
@@ -1404,7 +1404,7 @@ class LocaleUserCreationTest extends DrupalWebTestCase {
$this->drupalLogin($user);
$this->drupalGet($user_edit);
- $this->assertFieldChecked("edit-language-$langcode", 'Language selector is accessible and correct language is selected.');
+ $this->assertFieldChecked("edit-language-$langcode", t('Language selector is accessible and correct language is selected.'));
}
}
@@ -1480,11 +1480,11 @@ class LocalePathFunctionalTest extends DrupalWebTestCase {
// Confirm English language path alias works.
$this->drupalGet($english_path);
- $this->assertText($node->title, 'English alias works.');
+ $this->assertText($node->title, t('English alias works.'));
// Confirm custom language path alias works.
$this->drupalGet($prefix . '/' . $custom_language_path);
- $this->assertText($node->title, 'Custom language alias works.');
+ $this->assertText($node->title, t('Custom language alias works.'));
$this->drupalLogout();
}
@@ -1563,28 +1563,28 @@ class LocaleContentFunctionalTest extends DrupalWebTestCase {
// Set "Basic page" content type to use multilingual support.
$this->drupalGet('admin/structure/types/manage/page');
- $this->assertText(t('Multilingual support'), 'Multilingual support fieldset present on content type configuration form.');
+ $this->assertText(t('Multilingual support'), t('Multilingual support fieldset present on content type configuration form.'));
$edit = array(
'language_content_type' => 1,
);
$this->drupalPost('admin/structure/types/manage/page', $edit, t('Save content type'));
- $this->assertRaw(t('The content type %type has been updated.', array('%type' => 'Basic page')), 'Basic page content type has been updated.');
+ $this->assertRaw(t('The content type %type has been updated.', array('%type' => 'Basic page')), t('Basic page content type has been updated.'));
$this->drupalLogout();
// Verify language selection is not present on add article form.
$this->drupalLogin($web_user);
$this->drupalGet('node/add/article');
// Verify language select list is not present.
- $this->assertNoFieldByName('language', '', 'Language select not present on add article form.');
+ $this->assertNoFieldByName('language', '', t('Language select not present on add article form.'));
// Verify language selection appears on add "Basic page" form.
$this->drupalGet('node/add/page');
// Verify language select list is present.
- $this->assertFieldByName('language', '', 'Language select present on add Basic page form.');
+ $this->assertFieldByName('language', '', t('Language select present on add Basic page form.'));
// Ensure enabled language appears.
- $this->assertText($name, 'Enabled language present.');
+ $this->assertText($name, t('Enabled language present.'));
// Ensure disabled language doesn't appear.
- $this->assertNoText($name_disabled, 'Disabled language not present.');
+ $this->assertNoText($name_disabled, t('Disabled language not present.'));
// Create "Basic page" content.
$node_title = $this->randomName();
@@ -1599,13 +1599,13 @@ class LocaleContentFunctionalTest extends DrupalWebTestCase {
// Edit the content and ensure correct language is selected.
$path = 'node/' . $node->nid . '/edit';
$this->drupalGet($path);
- $this->assertRaw('<option value="' . $langcode . '" selected="selected">' . $name . '</option>', 'Correct language selected.');
+ $this->assertRaw('<option value="' . $langcode . '" selected="selected">' . $name . '</option>', t('Correct language selected.'));
// Ensure we can change the node language.
$edit = array(
'language' => 'en',
);
$this->drupalPost($path, $edit, t('Save'));
- $this->assertRaw(t('%title has been updated.', array('%title' => $node_title)), 'Basic page content updated.');
+ $this->assertRaw(t('%title has been updated.', array('%title' => $node_title)), t('Basic page content updated.'));
$this->drupalLogout();
}
@@ -1698,7 +1698,7 @@ class LocaleUILanguageNegotiationTest extends DrupalWebTestCase {
$language_browser_fallback_string = "In $language_browser_fallback In $language_browser_fallback In $language_browser_fallback";
$language_string = "In $language In $language In $language";
// Do a translate search of our target string.
- $edit = array('string' => $default_string);
+ $edit = array( 'string' => $default_string);
$this->drupalPost('admin/config/regional/translate/translate', $edit, t('Filter'));
// Should find the string and now click edit to post translated string.
$this->clickLink('edit');
@@ -1840,7 +1840,7 @@ class LocaleMultilingualFieldsFunctionalTest extends DrupalWebTestCase {
'language_content_type' => 1,
);
$this->drupalPost('admin/structure/types/manage/page', $edit, t('Save content type'));
- $this->assertRaw(t('The content type %type has been updated.', array('%type' => 'Basic page')), 'Basic page content type has been updated.');
+ $this->assertRaw(t('The content type %type has been updated.', array('%type' => 'Basic page')), t('Basic page content type has been updated.'));
}
/**
@@ -1863,10 +1863,10 @@ class LocaleMultilingualFieldsFunctionalTest extends DrupalWebTestCase {
// Check that the node exists in the database.
$node = $this->drupalGetNodeByTitle($edit[$title_key]);
- $this->assertTrue($node, 'Node found in database.');
+ $this->assertTrue($node, t('Node found in database.'));
$assert = isset($node->body['en']) && !isset($node->body[LANGUAGE_NONE]) && $node->body['en'][0]['value'] == $body_value;
- $this->assertTrue($assert, 'Field language correctly set.');
+ $this->assertTrue($assert, t('Field language correctly set.'));
// Change node language.
$this->drupalGet("node/$node->nid/edit");
@@ -1876,20 +1876,20 @@ class LocaleMultilingualFieldsFunctionalTest extends DrupalWebTestCase {
);
$this->drupalPost(NULL, $edit, t('Save'));
$node = $this->drupalGetNodeByTitle($edit[$title_key]);
- $this->assertTrue($node, 'Node found in database.');
+ $this->assertTrue($node, t('Node found in database.'));
$assert = isset($node->body['it']) && !isset($node->body['en']) && $node->body['it'][0]['value'] == $body_value;
- $this->assertTrue($assert, 'Field language correctly changed.');
+ $this->assertTrue($assert, t('Field language correctly changed.'));
// Enable content language URL detection.
language_negotiation_set(LANGUAGE_TYPE_CONTENT, array(LOCALE_LANGUAGE_NEGOTIATION_URL => 0));
// Test multilingual field language fallback logic.
$this->drupalGet("it/node/$node->nid");
- $this->assertRaw($body_value, 'Body correctly displayed using Italian as requested language');
+ $this->assertRaw($body_value, t('Body correctly displayed using Italian as requested language'));
$this->drupalGet("node/$node->nid");
- $this->assertRaw($body_value, 'Body correctly displayed using English as requested language');
+ $this->assertRaw($body_value, t('Body correctly displayed using English as requested language'));
}
/*
@@ -1912,7 +1912,7 @@ class LocaleMultilingualFieldsFunctionalTest extends DrupalWebTestCase {
// Check that the node exists in the database.
$node = $this->drupalGetNodeByTitle($edit[$title_key]);
- $this->assertTrue($node, 'Node found in database.');
+ $this->assertTrue($node, t('Node found in database.'));
// Check if node body is showed.
$this->drupalGet("node/$node->nid");
@@ -1983,10 +1983,10 @@ class LocaleDateFormatsFunctionalTest extends DrupalWebTestCase {
// Configure format for the node posted date changes with the language.
$this->drupalGet('node/' . $node->nid);
$english_date = format_date($node->created, 'custom', 'j M Y');
- $this->assertText($english_date, 'English date format appears');
+ $this->assertText($english_date, t('English date format appears'));
$this->drupalGet('fr/node/' . $node->nid);
$french_date = format_date($node->created, 'custom', 'd.m.Y');
- $this->assertText($french_date, 'French date format appears');
+ $this->assertText($french_date, t('French date format appears'));
}
}
diff --git a/modules/menu/menu.test b/modules/menu/menu.test
index a050fd90c..d1b822699 100644
--- a/modules/menu/menu.test
+++ b/modules/menu/menu.test
@@ -71,7 +71,7 @@ class MenuTestCase extends DrupalWebTestCase {
$item['options']['attributes']['title'] = $description;
menu_link_save($item);
$saved_item = menu_link_load($item['mlid']);
- $this->assertEqual($description, $saved_item['options']['attributes']['title'], 'Saving an existing link updates the description (title attribute)');
+ $this->assertEqual($description, $saved_item['options']['attributes']['title'], t('Saving an existing link updates the description (title attribute)'));
$this->resetMenuLink($item, $old_title);
}
@@ -112,14 +112,14 @@ class MenuTestCase extends DrupalWebTestCase {
// Assert the new menu.
$this->drupalGet('admin/structure/menu/manage/' . $menu_name . '/edit');
- $this->assertText($title, 'Custom menu was added.');
+ $this->assertText($title, t('Custom menu was added.'));
// Edit the menu.
$new_title = $this->randomName(16);
$menu['title'] = $new_title;
menu_save($menu);
$this->drupalGet('admin/structure/menu/manage/' . $menu_name . '/edit');
- $this->assertText($new_title, 'Custom menu was edited.');
+ $this->assertText($new_title, t('Custom menu was edited.'));
}
/**
@@ -140,7 +140,7 @@ class MenuTestCase extends DrupalWebTestCase {
$this->drupalPost('admin/structure/menu/add', $edit, t('Save'));
// Verify that using a menu_name that is too long results in a validation message.
- $this->assertText(format_plural(MENU_MAX_MENU_NAME_LENGTH_UI, "The menu name can't be longer than 1 character.", "The menu name can't be longer than @count characters."), 'Validation failed when menu name is too long.');
+ $this->assertText(format_plural(MENU_MAX_MENU_NAME_LENGTH_UI, "The menu name can't be longer than 1 character.", "The menu name can't be longer than @count characters."), t('Validation failed when menu name is too long.'));
// Change the menu_name so it no longer exceeds the maximum length.
$menu_name = substr(hash('sha256', $this->randomName(16)), 0, MENU_MAX_MENU_NAME_LENGTH_UI);
@@ -148,7 +148,7 @@ class MenuTestCase extends DrupalWebTestCase {
$this->drupalPost('admin/structure/menu/add', $edit, t('Save'));
// Verify that no validation error is given for menu_name length.
- $this->assertNoText(format_plural(MENU_MAX_MENU_NAME_LENGTH_UI, "The menu name can't be longer than 1 character.", "The menu name can't be longer than @count characters."), 'Validation failed when menu name is too long.');
+ $this->assertNoText(format_plural(MENU_MAX_MENU_NAME_LENGTH_UI, "The menu name can't be longer than 1 character.", "The menu name can't be longer than @count characters."), t('Validation failed when menu name is too long.'));
// Unlike most other modules, there is no confirmation message displayed.
$this->drupalGet('admin/structure/menu');
@@ -160,7 +160,7 @@ class MenuTestCase extends DrupalWebTestCase {
$edit['menu_' . $menu_name . '[region]'] = 'sidebar_first';
$this->drupalPost('admin/structure/block', $edit, t('Save blocks'));
$this->assertResponse(200);
- $this->assertText(t('The block settings have been updated.'), 'Custom menu block was enabled');
+ $this->assertText(t('The block settings have been updated.'), t('Custom menu block was enabled'));
return menu_load($menu_name);
}
@@ -177,11 +177,11 @@ class MenuTestCase extends DrupalWebTestCase {
// Delete custom menu.
$this->drupalPost("admin/structure/menu/manage/$menu_name/delete", array(), t('Delete'));
$this->assertResponse(200);
- $this->assertRaw(t('The custom menu %title has been deleted.', array('%title' => $title)), 'Custom menu was deleted');
+ $this->assertRaw(t('The custom menu %title has been deleted.', array('%title' => $title)), t('Custom menu was deleted'));
$this->assertFalse(menu_load($menu_name), 'Custom menu was deleted');
// Test if all menu links associated to the menu were removed from database.
$result = db_query("SELECT menu_name FROM {menu_links} WHERE menu_name = :menu_name", array(':menu_name' => $menu_name))->fetchField();
- $this->assertFalse($result, 'All menu links associated to the custom menu were deleted.');
+ $this->assertFalse($result, t('All menu links associated to the custom menu were deleted.'));
}
/**
@@ -220,7 +220,7 @@ class MenuTestCase extends DrupalWebTestCase {
// Verify in the database.
$hidden = db_query("SELECT hidden FROM {menu_links} WHERE mlid = :mlid", array(':mlid' => $item1['mlid']))->fetchField();
- $this->assertEqual($hidden, 0, 'Link is not hidden in the database table when enabled via the overview form');
+ $this->assertEqual($hidden, 0, t('Link is not hidden in the database table when enabled via the overview form'));
// Save menu links for later tests.
$this->items[] = $item1;
@@ -238,13 +238,13 @@ class MenuTestCase extends DrupalWebTestCase {
$item = $this->addMenuLink(0, $path);
$this->drupalGet('admin/structure/menu/item/' . $item['mlid'] . '/edit');
- $this->assertFieldByName('link_path', $path, 'Path is found with both query and fragment.');
+ $this->assertFieldByName('link_path', $path, t('Path is found with both query and fragment.'));
// Now change the path to something without query and fragment.
$path = 'node';
$this->drupalPost('admin/structure/menu/item/' . $item['mlid'] . '/edit', array('link_path' => $path), t('Save'));
$this->drupalGet('admin/structure/menu/item/' . $item['mlid'] . '/edit');
- $this->assertFieldByName('link_path', $path, 'Path no longer has query or fragment.');
+ $this->assertFieldByName('link_path', $path, t('Path no longer has query or fragment.'));
}
/**
@@ -345,7 +345,7 @@ class MenuTestCase extends DrupalWebTestCase {
// Verify menu link link.
$this->clickLink($title);
$title = $parent_node->title;
- $this->assertTitle(t("@title | Drupal", array('@title' => $title)), 'Parent menu link link target was correct');
+ $this->assertTitle(t("@title | Drupal", array('@title' => $title)), t('Parent menu link link target was correct'));
}
// Verify menu link.
@@ -355,7 +355,7 @@ class MenuTestCase extends DrupalWebTestCase {
// Verify menu link link.
$this->clickLink($title);
$title = $item_node->title;
- $this->assertTitle(t("@title | Drupal", array('@title' => $title)), 'Menu link link target was correct');
+ $this->assertTitle(t("@title | Drupal", array('@title' => $title)), t('Menu link link target was correct'));
}
/**
@@ -394,7 +394,7 @@ class MenuTestCase extends DrupalWebTestCase {
// Reset menu link.
$this->drupalPost("admin/structure/menu/item/$mlid/reset", array(), t('Reset'));
$this->assertResponse(200);
- $this->assertRaw(t('The menu link was reset to its default settings.'), 'Menu link was reset');
+ $this->assertRaw(t('The menu link was reset to its default settings.'), t('Menu link was reset'));
// Verify menu link.
$this->drupalGet('');
@@ -414,7 +414,7 @@ class MenuTestCase extends DrupalWebTestCase {
// Delete menu link.
$this->drupalPost("admin/structure/menu/item/$mlid/delete", array(), t('Confirm'));
$this->assertResponse(200);
- $this->assertRaw(t('The menu link %title has been deleted.', array('%title' => $title)), 'Menu link was deleted');
+ $this->assertRaw(t('The menu link %title has been deleted.', array('%title' => $title)), t('Menu link was deleted'));
// Verify deletion.
$this->drupalGet('');
@@ -454,7 +454,7 @@ class MenuTestCase extends DrupalWebTestCase {
// Unlike most other modules, there is no confirmation message displayed.
// Verify in the database.
$hidden = db_query("SELECT hidden FROM {menu_links} WHERE mlid = :mlid", array(':mlid' => $mlid))->fetchField();
- $this->assertEqual($hidden, 1, 'Link is hidden in the database table');
+ $this->assertEqual($hidden, 1, t('Link is hidden in the database table'));
}
/**
@@ -470,7 +470,7 @@ class MenuTestCase extends DrupalWebTestCase {
// Verify in the database.
$hidden = db_query("SELECT hidden FROM {menu_links} WHERE mlid = :mlid", array(':mlid' => $mlid))->fetchField();
- $this->assertEqual($hidden, 0, 'Link is not hidden in the database table');
+ $this->assertEqual($hidden, 0, t('Link is not hidden in the database table'));
}
/**
@@ -497,21 +497,21 @@ class MenuTestCase extends DrupalWebTestCase {
$this->drupalGet('admin/help/menu');
$this->assertResponse($response);
if ($response == 200) {
- $this->assertText(t('Menu'), 'Menu help was displayed');
+ $this->assertText(t('Menu'), t('Menu help was displayed'));
}
// View menu build overview node.
$this->drupalGet('admin/structure/menu');
$this->assertResponse($response);
if ($response == 200) {
- $this->assertText(t('Menus'), 'Menu build overview node was displayed');
+ $this->assertText(t('Menus'), t('Menu build overview node was displayed'));
}
// View navigation menu customization node.
$this->drupalGet('admin/structure/menu/manage/navigation');
- $this->assertResponse($response);
+ $this->assertResponse($response);
if ($response == 200) {
- $this->assertText(t('Navigation'), 'Navigation menu node was displayed');
+ $this->assertText(t('Navigation'), t('Navigation menu node was displayed'));
}
// View menu edit node.
@@ -519,21 +519,21 @@ class MenuTestCase extends DrupalWebTestCase {
$this->drupalGet('admin/structure/menu/item/' . $item['mlid'] . '/edit');
$this->assertResponse($response);
if ($response == 200) {
- $this->assertText(t('Edit menu item'), 'Menu edit node was displayed');
+ $this->assertText(t('Edit menu item'), t('Menu edit node was displayed'));
}
// View menu settings node.
$this->drupalGet('admin/structure/menu/settings');
$this->assertResponse($response);
if ($response == 200) {
- $this->assertText(t('Menus'), 'Menu settings node was displayed');
+ $this->assertText(t('Menus'), t('Menu settings node was displayed'));
}
// View add menu node.
$this->drupalGet('admin/structure/menu/add');
$this->assertResponse($response);
if ($response == 200) {
- $this->assertText(t('Menus'), 'Add menu node was displayed');
+ $this->assertText(t('Menus'), t('Add menu node was displayed'));
}
}
}
@@ -614,7 +614,7 @@ class MenuNodeTestCase extends DrupalWebTestCase {
$this->assertLink($node_title);
$this->drupalGet('node/' . $node->nid . '/edit');
- $this->assertOptionSelected('edit-menu-weight', 17, 'Menu weight correct in edit form');
+ $this->assertOptionSelected('edit-menu-weight', 17, t('Menu weight correct in edit form'));
// Edit the node and remove the menu link.
$edit = array(
diff --git a/modules/node/node.test b/modules/node/node.test
index 2a47eb78f..f5d3aefe2 100644
--- a/modules/node/node.test
+++ b/modules/node/node.test
@@ -31,53 +31,53 @@ class NodeLoadMultipleUnitTest extends DrupalWebTestCase {
// Confirm that promoted nodes appear in the default node listing.
$this->drupalGet('node');
- $this->assertText($node1->title, 'Node title appears on the default listing.');
- $this->assertText($node2->title, 'Node title appears on the default listing.');
- $this->assertNoText($node3->title, 'Node title does not appear in the default listing.');
- $this->assertNoText($node4->title, 'Node title does not appear in the default listing.');
+ $this->assertText($node1->title, t('Node title appears on the default listing.'));
+ $this->assertText($node2->title, t('Node title appears on the default listing.'));
+ $this->assertNoText($node3->title, t('Node title does not appear in the default listing.'));
+ $this->assertNoText($node4->title, t('Node title does not appear in the default listing.'));
// Load nodes with only a condition. Nodes 3 and 4 will be loaded.
$nodes = node_load_multiple(NULL, array('promote' => 0));
- $this->assertEqual($node3->title, $nodes[$node3->nid]->title, 'Node was loaded.');
- $this->assertEqual($node4->title, $nodes[$node4->nid]->title, 'Node was loaded.');
+ $this->assertEqual($node3->title, $nodes[$node3->nid]->title, t('Node was loaded.'));
+ $this->assertEqual($node4->title, $nodes[$node4->nid]->title, t('Node was loaded.'));
$count = count($nodes);
- $this->assertTrue($count == 2, $count . ' nodes loaded.');
+ $this->assertTrue($count == 2, t('@count nodes loaded.', array('@count' => $count)));
// Load nodes by nid. Nodes 1, 2 and 4 will be loaded.
$nodes = node_load_multiple(array(1, 2, 4));
$count = count($nodes);
- $this->assertTrue(count($nodes) == 3, $count . ' nodes loaded');
- $this->assertTrue(isset($nodes[$node1->nid]), 'Node is correctly keyed in the array');
- $this->assertTrue(isset($nodes[$node2->nid]), 'Node is correctly keyed in the array');
- $this->assertTrue(isset($nodes[$node4->nid]), 'Node is correctly keyed in the array');
+ $this->assertTrue(count($nodes) == 3, t('@count nodes loaded', array('@count' => $count)));
+ $this->assertTrue(isset($nodes[$node1->nid]), t('Node is correctly keyed in the array'));
+ $this->assertTrue(isset($nodes[$node2->nid]), t('Node is correctly keyed in the array'));
+ $this->assertTrue(isset($nodes[$node4->nid]), t('Node is correctly keyed in the array'));
foreach ($nodes as $node) {
- $this->assertTrue(is_object($node), 'Node is an object');
+ $this->assertTrue(is_object($node), t('Node is an object'));
}
// Load nodes by nid, where type = article. Nodes 1, 2 and 3 will be loaded.
$nodes = node_load_multiple(array(1, 2, 3, 4), array('type' => 'article'));
$count = count($nodes);
- $this->assertTrue($count == 3, $count . ' nodes loaded');
- $this->assertEqual($nodes[$node1->nid]->title, $node1->title, 'Node successfully loaded.');
- $this->assertEqual($nodes[$node2->nid]->title, $node2->title, 'Node successfully loaded.');
- $this->assertEqual($nodes[$node3->nid]->title, $node3->title, 'Node successfully loaded.');
+ $this->assertTrue($count == 3, t('@count nodes loaded', array('@count' => $count)));
+ $this->assertEqual($nodes[$node1->nid]->title, $node1->title, t('Node successfully loaded.'));
+ $this->assertEqual($nodes[$node2->nid]->title, $node2->title, t('Node successfully loaded.'));
+ $this->assertEqual($nodes[$node3->nid]->title, $node3->title, t('Node successfully loaded.'));
$this->assertFalse(isset($nodes[$node4->nid]));
// Now that all nodes have been loaded into the static cache, ensure that
// they are loaded correctly again when a condition is passed.
$nodes = node_load_multiple(array(1, 2, 3, 4), array('type' => 'article'));
$count = count($nodes);
- $this->assertTrue($count == 3, $count . ' nodes loaded.');
- $this->assertEqual($nodes[$node1->nid]->title, $node1->title, 'Node successfully loaded');
- $this->assertEqual($nodes[$node2->nid]->title, $node2->title, 'Node successfully loaded');
- $this->assertEqual($nodes[$node3->nid]->title, $node3->title, 'Node successfully loaded');
- $this->assertFalse(isset($nodes[$node4->nid]), 'Node was not loaded');
+ $this->assertTrue($count == 3, t('@count nodes loaded.', array('@count' => $count)));
+ $this->assertEqual($nodes[$node1->nid]->title, $node1->title, t('Node successfully loaded'));
+ $this->assertEqual($nodes[$node2->nid]->title, $node2->title, t('Node successfully loaded'));
+ $this->assertEqual($nodes[$node3->nid]->title, $node3->title, t('Node successfully loaded'));
+ $this->assertFalse(isset($nodes[$node4->nid]), t('Node was not loaded'));
// Load nodes by nid, where type = article and promote = 0.
$nodes = node_load_multiple(array(1, 2, 3, 4), array('type' => 'article', 'promote' => 0));
$count = count($nodes);
- $this->assertTrue($count == 1, $count . ' node loaded');
- $this->assertEqual($nodes[$node3->nid]->title, $node3->title, 'Node successfully loaded.');
+ $this->assertTrue($count == 1, t('@count node loaded', array('@count' => $count)));
+ $this->assertEqual($nodes[$node3->nid]->title, $node3->title, t('Node successfully loaded.'));
}
}
@@ -141,28 +141,28 @@ class NodeRevisionsTestCase extends DrupalWebTestCase {
// Confirm the correct revision text appears on "view revisions" page.
$this->drupalGet("node/$node->nid/revisions/$node->vid/view");
- $this->assertText($node->body[LANGUAGE_NONE][0]['value'], 'Correct text displays for version.');
+ $this->assertText($node->body[LANGUAGE_NONE][0]['value'], t('Correct text displays for version.'));
// Confirm the correct log message appears on "revisions overview" page.
$this->drupalGet("node/$node->nid/revisions");
foreach ($logs as $log) {
- $this->assertText($log, 'Log message found.');
+ $this->assertText($log, t('Log message found.'));
}
// Confirm that revisions revert properly.
$this->drupalPost("node/$node->nid/revisions/{$nodes[1]->vid}/revert", array(), t('Revert'));
$this->assertRaw(t('@type %title has been reverted back to the revision from %revision-date.',
array('@type' => 'Basic page', '%title' => $nodes[1]->title,
- '%revision-date' => format_date($nodes[1]->revision_timestamp))), 'Revision reverted.');
+ '%revision-date' => format_date($nodes[1]->revision_timestamp))), t('Revision reverted.'));
$reverted_node = node_load($node->nid);
- $this->assertTrue(($nodes[1]->body[LANGUAGE_NONE][0]['value'] == $reverted_node->body[LANGUAGE_NONE][0]['value']), 'Node reverted correctly.');
+ $this->assertTrue(($nodes[1]->body[LANGUAGE_NONE][0]['value'] == $reverted_node->body[LANGUAGE_NONE][0]['value']), t('Node reverted correctly.'));
// Confirm revisions delete properly.
$this->drupalPost("node/$node->nid/revisions/{$nodes[1]->vid}/delete", array(), t('Delete'));
$this->assertRaw(t('Revision from %revision-date of @type %title has been deleted.',
array('%revision-date' => format_date($nodes[1]->revision_timestamp),
- '@type' => 'Basic page', '%title' => $nodes[1]->title)), 'Revision deleted.');
- $this->assertTrue(db_query('SELECT COUNT(vid) FROM {node_revision} WHERE nid = :nid and vid = :vid', array(':nid' => $node->nid, ':vid' => $nodes[1]->vid))->fetchField() == 0, 'Revision not found.');
+ '@type' => 'Basic page', '%title' => $nodes[1]->title)), t('Revision deleted.'));
+ $this->assertTrue(db_query('SELECT COUNT(vid) FROM {node_revision} WHERE nid = :nid and vid = :vid', array(':nid' => $node->nid, ':vid' => $nodes[1]->vid))->fetchField() == 0, t('Revision not found.'));
}
/**
@@ -188,9 +188,9 @@ class NodeRevisionsTestCase extends DrupalWebTestCase {
);
node_save($updated_node);
$this->drupalGet('node/' . $node->nid);
- $this->assertText($new_title, 'New node title appears on the page.');
+ $this->assertText($new_title, t('New node title appears on the page.'));
$node_revision = node_load($node->nid, NULL, TRUE);
- $this->assertEqual($node_revision->log, $log, 'After an existing node revision is re-saved without a log message, the original log message is preserved.');
+ $this->assertEqual($node_revision->log, $log, t('After an existing node revision is re-saved without a log message, the original log message is preserved.'));
// Create another node with an initial log message.
$node = $this->drupalCreateNode(array('log' => $log));
@@ -250,20 +250,20 @@ class PageEditTestCase extends DrupalWebTestCase {
// Check that the node exists in the database.
$node = $this->drupalGetNodeByTitle($edit[$title_key]);
- $this->assertTrue($node, 'Node found in database.');
+ $this->assertTrue($node, t('Node found in database.'));
// Check that "edit" link points to correct page.
$this->clickLink(t('Edit'));
$edit_url = url("node/$node->nid/edit", array('absolute' => TRUE));
$actual_url = $this->getURL();
- $this->assertEqual($edit_url, $actual_url, 'On edit page.');
+ $this->assertEqual($edit_url, $actual_url, t('On edit page.'));
// Check that the title and body fields are displayed with the correct values.
$active = '<span class="element-invisible">' . t('(active tab)') . '</span>';
$link_text = t('!local-task-title!active', array('!local-task-title' => t('Edit'), '!active' => $active));
- $this->assertText(strip_tags($link_text), 0, 'Edit tab found and marked active.');
- $this->assertFieldByName($title_key, $edit[$title_key], 'Title field displayed.');
- $this->assertFieldByName($body_key, $edit[$body_key], 'Body field displayed.');
+ $this->assertText(strip_tags($link_text), 0, t('Edit tab found and marked active.'));
+ $this->assertFieldByName($title_key, $edit[$title_key], t('Title field displayed.'));
+ $this->assertFieldByName($body_key, $edit[$body_key], t('Body field displayed.'));
// Edit the content of the node.
$edit = array();
@@ -273,8 +273,8 @@ class PageEditTestCase extends DrupalWebTestCase {
$this->drupalPost(NULL, $edit, t('Save'));
// Check that the title and body fields are displayed with the updated values.
- $this->assertText($edit[$title_key], 'Title displayed.');
- $this->assertText($edit[$body_key], 'Body displayed.');
+ $this->assertText($edit[$title_key], t('Title displayed.'));
+ $this->assertText($edit[$body_key], t('Body displayed.'));
// Login as a second administrator user.
$second_web_user = $this->drupalCreateUser(array('administer nodes', 'edit any page content'));
@@ -377,13 +377,13 @@ class PagePreviewTestCase extends DrupalWebTestCase {
$this->drupalPost('node/add/page', $edit, t('Preview'));
// Check that the preview is displaying the title and body.
- $this->assertTitle(t('Preview | Drupal'), 'Basic page title is preview.');
- $this->assertText($edit[$title_key], 'Title displayed.');
- $this->assertText($edit[$body_key], 'Body displayed.');
+ $this->assertTitle(t('Preview | Drupal'), t('Basic page title is preview.'));
+ $this->assertText($edit[$title_key], t('Title displayed.'));
+ $this->assertText($edit[$body_key], t('Body displayed.'));
// Check that the title and body fields are displayed with the correct values.
- $this->assertFieldByName($title_key, $edit[$title_key], 'Title field displayed.');
- $this->assertFieldByName($body_key, $edit[$body_key], 'Body field displayed.');
+ $this->assertFieldByName($title_key, $edit[$title_key], t('Title field displayed.'));
+ $this->assertFieldByName($body_key, $edit[$body_key], t('Body field displayed.'));
}
/**
@@ -404,16 +404,16 @@ class PagePreviewTestCase extends DrupalWebTestCase {
$this->drupalPost('node/add/page', $edit, t('Preview'));
// Check that the preview is displaying the title and body.
- $this->assertTitle(t('Preview | Drupal'), 'Basic page title is preview.');
- $this->assertText($edit[$title_key], 'Title displayed.');
- $this->assertText($edit[$body_key], 'Body displayed.');
+ $this->assertTitle(t('Preview | Drupal'), t('Basic page title is preview.'));
+ $this->assertText($edit[$title_key], t('Title displayed.'));
+ $this->assertText($edit[$body_key], t('Body displayed.'));
// Check that the title and body fields are displayed with the correct values.
- $this->assertFieldByName($title_key, $edit[$title_key], 'Title field displayed.');
- $this->assertFieldByName($body_key, $edit[$body_key], 'Body field displayed.');
+ $this->assertFieldByName($title_key, $edit[$title_key], t('Title field displayed.'));
+ $this->assertFieldByName($body_key, $edit[$body_key], t('Body field displayed.'));
// Check that the log field has the correct value.
- $this->assertFieldByName('log', $edit['log'], 'Log field displayed.');
+ $this->assertFieldByName('log', $edit['log'], t('Log field displayed.'));
}
}
@@ -446,11 +446,11 @@ class NodeCreationTestCase extends DrupalWebTestCase {
$this->drupalPost('node/add/page', $edit, t('Save'));
// Check that the Basic page has been created.
- $this->assertRaw(t('!post %title has been created.', array('!post' => 'Basic page', '%title' => $edit["title"])), 'Basic page created.');
+ $this->assertRaw(t('!post %title has been created.', array('!post' => 'Basic page', '%title' => $edit["title"])), t('Basic page created.'));
// Check that the node exists in the database.
$node = $this->drupalGetNodeByTitle($edit["title"]);
- $this->assertTrue($node, 'Node found in database.');
+ $this->assertTrue($node, t('Node found in database.'));
}
/**
@@ -468,30 +468,30 @@ class NodeCreationTestCase extends DrupalWebTestCase {
try {
node_save((object) $edit);
- $this->fail('Expected exception has not been thrown.');
+ $this->fail(t('Expected exception has not been thrown.'));
}
catch (Exception $e) {
- $this->pass('Expected exception has been thrown.');
+ $this->pass(t('Expected exception has been thrown.'));
}
if (Database::getConnection()->supportsTransactions()) {
// Check that the node does not exist in the database.
$node = $this->drupalGetNodeByTitle($edit['title']);
- $this->assertFalse($node, 'Transactions supported, and node not found in database.');
+ $this->assertFalse($node, t('Transactions supported, and node not found in database.'));
}
else {
// Check that the node exists in the database.
$node = $this->drupalGetNodeByTitle($edit['title']);
- $this->assertTrue($node, 'Transactions not supported, and node found in database.');
+ $this->assertTrue($node, t('Transactions not supported, and node found in database.'));
// Check that the failed rollback was logged.
$records = db_query("SELECT wid FROM {watchdog} WHERE message LIKE 'Explicit rollback failed%'")->fetchAll();
- $this->assertTrue(count($records) > 0, 'Transactions not supported, and rollback error logged to watchdog.');
+ $this->assertTrue(count($records) > 0, t('Transactions not supported, and rollback error logged to watchdog.'));
}
// Check that the rollback error was logged.
$records = db_query("SELECT wid FROM {watchdog} WHERE variables LIKE '%Test exception for rollback.%'")->fetchAll();
- $this->assertTrue(count($records) > 0, 'Rollback explanatory error logged to watchdog.');
+ $this->assertTrue(count($records) > 0, t('Rollback explanatory error logged to watchdog.'));
}
}
@@ -510,7 +510,7 @@ class PageViewTestCase extends DrupalWebTestCase {
function testPageView() {
// Create a node to view.
$node = $this->drupalCreateNode();
- $this->assertTrue(node_load($node->nid), 'Node created.');
+ $this->assertTrue(node_load($node->nid), t('Node created.'));
// Try to edit with anonymous user.
$html = $this->drupalGet("node/$node->nid/edit");
@@ -553,7 +553,7 @@ class SummaryLengthTestCase extends DrupalWebTestCase {
'promote' => 1,
);
$node = $this->drupalCreateNode($settings);
- $this->assertTrue(node_load($node->nid), 'Node created.');
+ $this->assertTrue(node_load($node->nid), t('Node created.'));
// Create user with permission to view the node.
$web_user = $this->drupalCreateUser(array('access content', 'administer content types'));
@@ -563,16 +563,16 @@ class SummaryLengthTestCase extends DrupalWebTestCase {
$this->drupalGet("node");
// The node teaser when it has 600 characters in length
$expected = 'What is a Drupalism?';
- $this->assertRaw($expected, 'Check that the summary is 600 characters in length', 'Node');
+ $this->assertRaw($expected, t('Check that the summary is 600 characters in length'), 'Node');
// Edit the teaser length for "Basic page" content type
- $edit = array(
+ $edit = array (
'teaser_length' => 200,
);
$this->drupalPost('admin/structure/types/manage/page', $edit, t('Save content type'));
// Attempt to access the front page again and check if the summary is now only 200 characters in length.
$this->drupalGet("node");
- $this->assertNoRaw($expected, 'Check that the summary is not longer than 200 characters', 'Node');
+ $this->assertNoRaw($expected, t('Check that the summary is not longer than 200 characters'), 'Node');
}
}
@@ -595,18 +595,18 @@ class NodeTitleXSSTestCase extends DrupalWebTestCase {
$edit = array("title" => $title);
$this->drupalPost('node/add/page', $edit, t('Preview'));
- $this->assertNoRaw($xss, 'Harmful tags are escaped when previewing a node.');
+ $this->assertNoRaw($xss, t('Harmful tags are escaped when previewing a node.'));
$settings = array('title' => $title);
$node = $this->drupalCreateNode($settings);
$this->drupalGet('node/' . $node->nid);
// assertTitle() decodes HTML-entities inside the <title> element.
- $this->assertTitle($edit["title"] . ' | Drupal', 'Title is diplayed when viewing a node.');
- $this->assertNoRaw($xss, 'Harmful tags are escaped when viewing a node.');
+ $this->assertTitle($edit["title"] . ' | Drupal', t('Title is diplayed when viewing a node.'));
+ $this->assertNoRaw($xss, t('Harmful tags are escaped when viewing a node.'));
$this->drupalGet('node/' . $node->nid . '/edit');
- $this->assertNoRaw($xss, 'Harmful tags are escaped when editing a node.');
+ $this->assertNoRaw($xss, t('Harmful tags are escaped when editing a node.'));
}
}
@@ -630,13 +630,13 @@ class NodeBlockTestCase extends DrupalWebTestCase {
function testSearchFormBlock() {
// Set block title to confirm that the interface is available.
$this->drupalPost('admin/structure/block/manage/node/syndicate/configure', array('title' => $this->randomName(8)), t('Save block'));
- $this->assertText(t('The block configuration has been saved.'), 'Block configuration set.');
+ $this->assertText(t('The block configuration has been saved.'), t('Block configuration set.'));
// Set the block to a region to confirm block is available.
$edit = array();
$edit['node_syndicate[region]'] = 'footer';
$this->drupalPost('admin/structure/block', $edit, t('Save blocks'));
- $this->assertText(t('The block settings have been updated.'), 'Block successfully move to footer region.');
+ $this->assertText(t('The block settings have been updated.'), t('Block successfully move to footer region.'));
}
}
@@ -679,7 +679,7 @@ class NodePostSettingsTestCase extends DrupalWebTestCase {
// Check that the post information is displayed.
$node = $this->drupalGetNodeByTitle($edit["title"]);
$elements = $this->xpath('//div[contains(@class,:class)]', array(':class' => 'submitted'));
- $this->assertEqual(count($elements), 1, 'Post information is displayed.');
+ $this->assertEqual(count($elements), 1, t('Post information is displayed.'));
}
/**
@@ -701,7 +701,7 @@ class NodePostSettingsTestCase extends DrupalWebTestCase {
// Check that the post information is displayed.
$node = $this->drupalGetNodeByTitle($edit["title"]);
- $this->assertNoRaw('<span class="submitted">', 'Post information is not displayed.');
+ $this->assertNoRaw('<span class="submitted">', t('Post information is not displayed.'));
}
}
@@ -744,12 +744,12 @@ class NodeRSSContentTestCase extends DrupalWebTestCase {
// Check that content added in 'rss' view mode appear in RSS feed.
$rss_only_content = t('Extra data that should appear only in the RSS feed for node !nid.', array('!nid' => $node->nid));
- $this->assertText($rss_only_content, 'Node content designated for RSS appear in RSS feed.');
+ $this->assertText($rss_only_content, t('Node content designated for RSS appear in RSS feed.'));
// Check that content added in view modes other than 'rss' doesn't
// appear in RSS feed.
$non_rss_content = t('Extra data that should appear everywhere except the RSS feed for node !nid.', array('!nid' => $node->nid));
- $this->assertNoText($non_rss_content, 'Node content not designed for RSS doesn\'t appear in RSS feed.');
+ $this->assertNoText($non_rss_content, t('Node content not designed for RSS doesn\'t appear in RSS feed.'));
// Check that extra RSS elements and namespaces are added to RSS feed.
$test_element = array(
@@ -757,13 +757,13 @@ class NodeRSSContentTestCase extends DrupalWebTestCase {
'value' => t('Value of testElement RSS element for node !nid.', array('!nid' => $node->nid)),
);
$test_ns = 'xmlns:drupaltest="http://example.com/test-namespace"';
- $this->assertRaw(format_xml_elements(array($test_element)), 'Extra RSS elements appear in RSS feed.');
- $this->assertRaw($test_ns, 'Extra namespaces appear in RSS feed.');
+ $this->assertRaw(format_xml_elements(array($test_element)), t('Extra RSS elements appear in RSS feed.'));
+ $this->assertRaw($test_ns, t('Extra namespaces appear in RSS feed.'));
// Check that content added in 'rss' view mode doesn't appear when
// viewing node.
$this->drupalGet("node/$node->nid");
- $this->assertNoText($rss_only_content, 'Node content designed for RSS doesn\'t appear when viewing node.');
+ $this->assertNoText($rss_only_content, t('Node content designed for RSS doesn\'t appear when viewing node.'));
}
}
@@ -860,44 +860,44 @@ class NodeAccessRecordsUnitTest extends DrupalWebTestCase {
function testNodeAccessRecords() {
// Create an article node.
$node1 = $this->drupalCreateNode(array('type' => 'article'));
- $this->assertTrue(node_load($node1->nid), 'Article node created.');
+ $this->assertTrue(node_load($node1->nid), t('Article node created.'));
// Check to see if grants added by node_test_node_access_records made it in.
$records = db_query('SELECT realm, gid FROM {node_access} WHERE nid = :nid', array(':nid' => $node1->nid))->fetchAll();
- $this->assertEqual(count($records), 1, 'Returned the correct number of rows.');
- $this->assertEqual($records[0]->realm, 'test_article_realm', 'Grant with article_realm acquired for node without alteration.');
- $this->assertEqual($records[0]->gid, 1, 'Grant with gid = 1 acquired for node without alteration.');
+ $this->assertEqual(count($records), 1, t('Returned the correct number of rows.'));
+ $this->assertEqual($records[0]->realm, 'test_article_realm', t('Grant with article_realm acquired for node without alteration.'));
+ $this->assertEqual($records[0]->gid, 1, t('Grant with gid = 1 acquired for node without alteration.'));
// Create an unpromoted "Basic page" node.
$node2 = $this->drupalCreateNode(array('type' => 'page', 'promote' => 0));
- $this->assertTrue(node_load($node1->nid), 'Unpromoted basic page node created.');
+ $this->assertTrue(node_load($node1->nid), t('Unpromoted basic page node created.'));
// Check to see if grants added by node_test_node_access_records made it in.
$records = db_query('SELECT realm, gid FROM {node_access} WHERE nid = :nid', array(':nid' => $node2->nid))->fetchAll();
- $this->assertEqual(count($records), 1, 'Returned the correct number of rows.');
- $this->assertEqual($records[0]->realm, 'test_page_realm', 'Grant with page_realm acquired for node without alteration.');
- $this->assertEqual($records[0]->gid, 1, 'Grant with gid = 1 acquired for node without alteration.');
+ $this->assertEqual(count($records), 1, t('Returned the correct number of rows.'));
+ $this->assertEqual($records[0]->realm, 'test_page_realm', t('Grant with page_realm acquired for node without alteration.'));
+ $this->assertEqual($records[0]->gid, 1, t('Grant with gid = 1 acquired for node without alteration.'));
// Create an unpromoted, unpublished "Basic page" node.
$node3 = $this->drupalCreateNode(array('type' => 'page', 'promote' => 0, 'status' => 0));
- $this->assertTrue(node_load($node3->nid), 'Unpromoted, unpublished basic page node created.');
+ $this->assertTrue(node_load($node3->nid), t('Unpromoted, unpublished basic page node created.'));
// Check to see if grants added by node_test_node_access_records made it in.
$records = db_query('SELECT realm, gid FROM {node_access} WHERE nid = :nid', array(':nid' => $node3->nid))->fetchAll();
- $this->assertEqual(count($records), 1, 'Returned the correct number of rows.');
- $this->assertEqual($records[0]->realm, 'test_page_realm', 'Grant with page_realm acquired for node without alteration.');
- $this->assertEqual($records[0]->gid, 1, 'Grant with gid = 1 acquired for node without alteration.');
+ $this->assertEqual(count($records), 1, t('Returned the correct number of rows.'));
+ $this->assertEqual($records[0]->realm, 'test_page_realm', t('Grant with page_realm acquired for node without alteration.'));
+ $this->assertEqual($records[0]->gid, 1, t('Grant with gid = 1 acquired for node without alteration.'));
// Create a promoted "Basic page" node.
$node4 = $this->drupalCreateNode(array('type' => 'page', 'promote' => 1));
- $this->assertTrue(node_load($node4->nid), 'Promoted basic page node created.');
+ $this->assertTrue(node_load($node4->nid), t('Promoted basic page node created.'));
// Check to see if grant added by node_test_node_access_records was altered
// by node_test_node_access_records_alter.
$records = db_query('SELECT realm, gid FROM {node_access} WHERE nid = :nid', array(':nid' => $node4->nid))->fetchAll();
- $this->assertEqual(count($records), 1, 'Returned the correct number of rows.');
- $this->assertEqual($records[0]->realm, 'test_alter_realm', 'Altered grant with alter_realm acquired for node.');
- $this->assertEqual($records[0]->gid, 2, 'Altered grant with gid = 2 acquired for node.');
+ $this->assertEqual(count($records), 1, t('Returned the correct number of rows.'));
+ $this->assertEqual($records[0]->realm, 'test_alter_realm', t('Altered grant with alter_realm acquired for node.'));
+ $this->assertEqual($records[0]->gid, 2, t('Altered grant with gid = 2 acquired for node.'));
// Check to see if we can alter grants with hook_node_grants_alter().
$operations = array('view', 'update', 'delete');
@@ -907,7 +907,7 @@ class NodeAccessRecordsUnitTest extends DrupalWebTestCase {
$grants = node_test_node_grants($op, $web_user);
$altered_grants = $grants;
drupal_alter('node_grants', $altered_grants, $web_user, $op);
- $this->assertNotEqual($grants, $altered_grants, 'Altered the ' . $op . ' grant for a user.');
+ $this->assertNotEqual($grants, $altered_grants, t('Altered the %op grant for a user.', array('%op' => $op)));
}
}
}
@@ -956,15 +956,15 @@ class NodeSaveTestCase extends DrupalWebTestCase {
$node = node_submit((object) $node);
// Verify that node_submit did not overwrite the user ID.
- $this->assertEqual($node->uid, $this->web_user->uid, 'Function node_submit() preserves user ID');
+ $this->assertEqual($node->uid, $this->web_user->uid, t('Function node_submit() preserves user ID'));
node_save($node);
// Test the import.
$node_by_nid = node_load($test_nid);
- $this->assertTrue($node_by_nid, 'Node load by node ID.');
+ $this->assertTrue($node_by_nid, t('Node load by node ID.'));
$node_by_title = $this->drupalGetNodeByTitle($title);
- $this->assertTrue($node_by_title, 'Node load by node title.');
+ $this->assertTrue($node_by_title, t('Node load by node title.'));
}
/**
@@ -981,8 +981,8 @@ class NodeSaveTestCase extends DrupalWebTestCase {
node_save((object) $edit);
$node = $this->drupalGetNodeByTitle($edit['title']);
- $this->assertEqual($node->created, REQUEST_TIME, 'Creating a node sets default "created" timestamp.');
- $this->assertEqual($node->changed, REQUEST_TIME, 'Creating a node sets default "changed" timestamp.');
+ $this->assertEqual($node->created, REQUEST_TIME, t('Creating a node sets default "created" timestamp.'));
+ $this->assertEqual($node->changed, REQUEST_TIME, t('Creating a node sets default "changed" timestamp.'));
// Store the timestamps.
$created = $node->created;
@@ -990,15 +990,15 @@ class NodeSaveTestCase extends DrupalWebTestCase {
node_save($node);
$node = $this->drupalGetNodeByTitle($edit['title']);
- $this->assertEqual($node->created, $created, 'Updating a node preserves "created" timestamp.');
+ $this->assertEqual($node->created, $created, t('Updating a node preserves "created" timestamp.'));
// Programmatically set the timestamps using hook_node_presave.
$node->title = 'testing_node_presave';
node_save($node);
$node = $this->drupalGetNodeByTitle('testing_node_presave');
- $this->assertEqual($node->created, 280299600, 'Saving a node uses "created" timestamp set in presave hook.');
- $this->assertEqual($node->changed, 979534800, 'Saving a node uses "changed" timestamp set in presave hook.');
+ $this->assertEqual($node->created, 280299600, t('Saving a node uses "created" timestamp set in presave hook.'));
+ $this->assertEqual($node->changed, 979534800, t('Saving a node uses "changed" timestamp set in presave hook.'));
// Programmatically set the timestamps on the node.
$edit = array(
@@ -1011,8 +1011,8 @@ class NodeSaveTestCase extends DrupalWebTestCase {
node_save((object) $edit);
$node = $this->drupalGetNodeByTitle($edit['title']);
- $this->assertEqual($node->created, 280299600, 'Creating a node uses user-set "created" timestamp.');
- $this->assertNotEqual($node->changed, 979534800, 'Creating a node doesn\'t use user-set "changed" timestamp.');
+ $this->assertEqual($node->created, 280299600, t('Creating a node uses user-set "created" timestamp.'));
+ $this->assertNotEqual($node->changed, 979534800, t('Creating a node doesn\'t use user-set "changed" timestamp.'));
// Update the timestamps.
$node->created = 979534800;
@@ -1020,8 +1020,8 @@ class NodeSaveTestCase extends DrupalWebTestCase {
node_save($node);
$node = $this->drupalGetNodeByTitle($edit['title']);
- $this->assertEqual($node->created, 979534800, 'Updating a node uses user-set "created" timestamp.');
- $this->assertNotEqual($node->changed, 280299600, 'Updating a node doesn\'t use user-set "changed" timestamp.');
+ $this->assertEqual($node->created, 979534800, t('Updating a node uses user-set "created" timestamp.'));
+ $this->assertNotEqual($node->changed, 280299600, t('Updating a node doesn\'t use user-set "changed" timestamp.'));
}
}
@@ -1046,14 +1046,14 @@ class NodeTypeTestCase extends DrupalWebTestCase {
$node_types = node_type_get_types();
$node_names = node_type_get_names();
- $this->assertTrue(isset($node_types['article']), 'Node type article is available.');
- $this->assertTrue(isset($node_types['page']), 'Node type basic page is available.');
+ $this->assertTrue(isset($node_types['article']), t('Node type article is available.'));
+ $this->assertTrue(isset($node_types['page']), t('Node type basic page is available.'));
- $this->assertEqual($node_types['article']->name, $node_names['article'], 'Correct node type base has been returned.');
+ $this->assertEqual($node_types['article']->name, $node_names['article'], t('Correct node type base has been returned.'));
- $this->assertEqual($node_types['article'], node_type_get_type('article'), 'Correct node type has been returned.');
- $this->assertEqual($node_types['article']->name, node_type_get_name('article'), 'Correct node type name has been returned.');
- $this->assertEqual($node_types['page']->base, node_type_get_base('page'), 'Correct node type base has been returned.');
+ $this->assertEqual($node_types['article'], node_type_get_type('article'), t('Correct node type has been returned.'));
+ $this->assertEqual($node_types['article']->name, node_type_get_name('article'), t('Correct node type name has been returned.'));
+ $this->assertEqual($node_types['page']->base, node_type_get_base('page'), t('Correct node type base has been returned.'));
}
/**
@@ -1072,7 +1072,7 @@ class NodeTypeTestCase extends DrupalWebTestCase {
$this->drupalGet('node/add/' . str_replace('_', '-', $type->name));
$this->assertResponse(200, 'The new content type can be accessed at node/add.');
-
+
// Create a content type via the user interface.
$web_user = $this->drupalCreateUser(array('bypass node access', 'administer content types'));
$this->drupalLogin($web_user);
@@ -1094,12 +1094,12 @@ class NodeTypeTestCase extends DrupalWebTestCase {
$this->drupalLogin($web_user);
$instance = field_info_instance('node', 'body', 'page');
- $this->assertEqual($instance['label'], 'Body', 'Body field was found.');
+ $this->assertEqual($instance['label'], 'Body', t('Body field was found.'));
// Verify that title and body fields are displayed.
$this->drupalGet('node/add/page');
- $this->assertRaw('Title', 'Title field was found.');
- $this->assertRaw('Body', 'Body field was found.');
+ $this->assertRaw('Title', t('Title field was found.'));
+ $this->assertRaw('Body', t('Body field was found.'));
// Rename the title field.
$edit = array(
@@ -1110,8 +1110,8 @@ class NodeTypeTestCase extends DrupalWebTestCase {
field_info_cache_clear();
$this->drupalGet('node/add/page');
- $this->assertRaw('Foo', 'New title label was displayed.');
- $this->assertNoRaw('Title', 'Old title label was not displayed.');
+ $this->assertRaw('Foo', t('New title label was displayed.'));
+ $this->assertNoRaw('Title', t('Old title label was not displayed.'));
// Change the name, machine name and description.
$edit = array(
@@ -1123,12 +1123,12 @@ class NodeTypeTestCase extends DrupalWebTestCase {
field_info_cache_clear();
$this->drupalGet('node/add');
- $this->assertRaw('Bar', 'New name was displayed.');
- $this->assertRaw('Lorem ipsum', 'New description was displayed.');
+ $this->assertRaw('Bar', t('New name was displayed.'));
+ $this->assertRaw('Lorem ipsum', t('New description was displayed.'));
$this->clickLink('Bar');
- $this->assertEqual(url('node/add/bar', array('absolute' => TRUE)), $this->getUrl(), 'New machine name was used in URL.');
- $this->assertRaw('Foo', 'Title field was found.');
- $this->assertRaw('Body', 'Body field was found.');
+ $this->assertEqual(url('node/add/bar', array('absolute' => TRUE)), $this->getUrl(), t('New machine name was used in URL.'));
+ $this->assertRaw('Foo', t('Title field was found.'));
+ $this->assertRaw('Body', t('Body field was found.'));
// Remove the body field.
$this->drupalPost('admin/structure/types/manage/bar/fields/body/delete', NULL, t('Delete'));
@@ -1136,7 +1136,7 @@ class NodeTypeTestCase extends DrupalWebTestCase {
$this->drupalPost('admin/structure/types/manage/bar', array(), t('Save content type'));
// Check that the body field doesn't exist.
$this->drupalGet('node/add/bar');
- $this->assertNoRaw('Body', 'Body field was not found.');
+ $this->assertNoRaw('Body', t('Body field was not found.'));
}
}
@@ -1216,7 +1216,7 @@ class NodeAdminTestCase extends DrupalWebTestCase {
$this->assertLinkByHref('node/' . $node->nid . '/edit');
$this->assertLinkByHref('node/' . $node->nid . '/delete');
// Verify tableselect.
- $this->assertFieldByName('nodes[' . $node->nid . ']', '', 'Tableselect found.');
+ $this->assertFieldByName('nodes[' . $node->nid . ']', '', t('Tableselect found.'));
}
// Verify filtering by publishing status.
@@ -1224,7 +1224,7 @@ class NodeAdminTestCase extends DrupalWebTestCase {
'status' => 'status-1',
);
$this->drupalPost(NULL, $edit, t('Filter'));
- $this->assertRaw(t('<strong>%type</strong> is <strong>%value</strong>', array('%type' => t('status'), '%value' => t('published'))), 'Content list is filtered by status.');
+ $this->assertRaw(t('<strong>%type</strong> is <strong>%value</strong>', array('%type' => t('status'), '%value' => t('published'))), t('Content list is filtered by status.'));
$this->assertLinkByHref('node/' . $nodes['published_page']->nid . '/edit');
$this->assertLinkByHref('node/' . $nodes['published_article']->nid . '/edit');
$this->assertNoLinkByHref('node/' . $nodes['unpublished_page_1']->nid . '/edit');
@@ -1234,8 +1234,8 @@ class NodeAdminTestCase extends DrupalWebTestCase {
'type' => 'page',
);
$this->drupalPost(NULL, $edit, t('Refine'));
- $this->assertRaw(t('<strong>%type</strong> is <strong>%value</strong>', array('%type' => t('status'), '%value' => t('published'))), 'Content list is filtered by status.');
- $this->assertRaw(t('<strong>%type</strong> is <strong>%value</strong>', array('%type' => t('type'), '%value' => 'Basic page')), 'Content list is filtered by content type.');
+ $this->assertRaw(t('<strong>%type</strong> is <strong>%value</strong>', array('%type' => t('status'), '%value' => t('published'))), t('Content list is filtered by status.'));
+ $this->assertRaw(t('<strong>%type</strong> is <strong>%value</strong>', array('%type' => t('type'), '%value' => 'Basic page')), t('Content list is filtered by content type.'));
$this->assertLinkByHref('node/' . $nodes['published_page']->nid . '/edit');
$this->assertNoLinkByHref('node/' . $nodes['published_article']->nid . '/edit');
@@ -1257,7 +1257,7 @@ class NodeAdminTestCase extends DrupalWebTestCase {
$this->assertNoLinkByHref('node/' . $nodes['unpublished_page_1']->nid . '/delete');
// Verify no tableselect.
- $this->assertNoFieldByName('nodes[' . $nodes['published_page']->nid . ']', '', 'No tableselect found.');
+ $this->assertNoFieldByName('nodes[' . $nodes['published_page']->nid . ']', '', t('No tableselect found.'));
// Verify unpublished content is displayed with permission.
$this->drupalLogout();
@@ -1275,7 +1275,7 @@ class NodeAdminTestCase extends DrupalWebTestCase {
$this->assertNoLinkByHref('node/' . $nodes['unpublished_page_1']->nid . '/delete');
// Verify no tableselect.
- $this->assertNoFieldByName('nodes[' . $nodes['unpublished_page_2']->nid . ']', '', 'No tableselect found.');
+ $this->assertNoFieldByName('nodes[' . $nodes['unpublished_page_2']->nid . ']', '', t('No tableselect found.'));
// Verify node access can be bypassed.
$this->drupalLogout();
@@ -1325,7 +1325,7 @@ class NodeTitleTestCase extends DrupalWebTestCase {
// Test <title> tag.
$this->drupalGet("node/$node->nid");
$xpath = '//title';
- $this->assertEqual(current($this->xpath($xpath)), $node->title . ' | Drupal', 'Page title is equal to node title.', 'Node');
+ $this->assertEqual(current($this->xpath($xpath)), $node->title .' | Drupal', 'Page title is equal to node title.', 'Node');
// Test breadcrumb in comment preview.
$this->drupalGet("comment/reply/$node->nid");
@@ -1401,7 +1401,7 @@ class NodeBlockFunctionalTest extends DrupalWebTestCase {
'node_recent[region]' => 'sidebar_first',
);
$this->drupalPost('admin/structure/block', $edit, t('Save blocks'));
- $this->assertText(t('The block settings have been updated.'), 'Block saved to first sidebar region.');
+ $this->assertText(t('The block settings have been updated.'), t('Block saved to first sidebar region.'));
// Set block title and variables.
$block = array(
@@ -1409,11 +1409,11 @@ class NodeBlockFunctionalTest extends DrupalWebTestCase {
'node_recent_block_count' => 2,
);
$this->drupalPost('admin/structure/block/manage/node/recent/configure', $block, t('Save block'));
- $this->assertText(t('The block configuration has been saved.'), 'Block saved.');
+ $this->assertText(t('The block configuration has been saved.'), t('Block saved.'));
// Test that block is not visible without nodes
$this->drupalGet('');
- $this->assertText(t('No content available.'), 'Block with "No content available." found.');
+ $this->assertText(t('No content available.'), t('Block with "No content available." found.'));
// Add some test nodes.
$default_settings = array('uid' => $this->web_user->uid, 'type' => 'article');
@@ -1439,16 +1439,16 @@ class NodeBlockFunctionalTest extends DrupalWebTestCase {
// see the block.
$this->drupalLogout();
$this->drupalGet('');
- $this->assertNoText($block['title'], 'Block was not found.');
+ $this->assertNoText($block['title'], t('Block was not found.'));
// Test that only the 2 latest nodes are shown.
$this->drupalLogin($this->web_user);
- $this->assertNoText($node1->title, 'Node not found in block.');
- $this->assertText($node2->title, 'Node found in block.');
- $this->assertText($node3->title, 'Node found in block.');
+ $this->assertNoText($node1->title, t('Node not found in block.'));
+ $this->assertText($node2->title, t('Node found in block.'));
+ $this->assertText($node3->title, t('Node found in block.'));
// Check to make sure nodes are in the right order.
- $this->assertTrue($this->xpath('//div[@id="block-node-recent"]/div/table/tbody/tr[position() = 1]/td/div/a[text() = "' . $node3->title . '"]'), 'Nodes were ordered correctly in block.');
+ $this->assertTrue($this->xpath('//div[@id="block-node-recent"]/div/table/tbody/tr[position() = 1]/td/div/a[text() = "' . $node3->title . '"]'), t('Nodes were ordered correctly in block.'));
// Set the number of recent nodes to show to 10.
$this->drupalLogout();
@@ -1457,17 +1457,17 @@ class NodeBlockFunctionalTest extends DrupalWebTestCase {
'node_recent_block_count' => 10,
);
$this->drupalPost('admin/structure/block/manage/node/recent/configure', $block, t('Save block'));
- $this->assertText(t('The block configuration has been saved.'), 'Block saved.');
+ $this->assertText(t('The block configuration has been saved.'), t('Block saved.'));
// Post an additional node.
$node4 = $this->drupalCreateNode($default_settings);
// Test that all four nodes are shown.
$this->drupalGet('');
- $this->assertText($node1->title, 'Node found in block.');
- $this->assertText($node2->title, 'Node found in block.');
- $this->assertText($node3->title, 'Node found in block.');
- $this->assertText($node4->title, 'Node found in block.');
+ $this->assertText($node1->title, t('Node found in block.'));
+ $this->assertText($node2->title, t('Node found in block.'));
+ $this->assertText($node3->title, t('Node found in block.'));
+ $this->assertText($node4->title, t('Node found in block.'));
// Create the custom block.
$custom_block = array();
@@ -1482,20 +1482,20 @@ class NodeBlockFunctionalTest extends DrupalWebTestCase {
$this->drupalPost('admin/structure/block/add', $custom_block, t('Save block'));
$bid = db_query("SELECT bid FROM {block_custom} WHERE info = :info", array(':info' => $custom_block['info']))->fetchField();
- $this->assertTrue($bid, 'Custom block with visibility rule was created.');
+ $this->assertTrue($bid, t('Custom block with visibility rule was created.'));
// Verify visibility rules.
$this->drupalGet('');
- $this->assertNoText($custom_block['title'], 'Block was displayed on the front page.');
+ $this->assertNoText($custom_block['title'], t('Block was displayed on the front page.'));
$this->drupalGet('node/add/article');
- $this->assertText($custom_block['title'], 'Block was displayed on the node/add/article page.');
+ $this->assertText($custom_block['title'], t('Block was displayed on the node/add/article page.'));
$this->drupalGet('node/' . $node1->nid);
- $this->assertText($custom_block['title'], 'Block was displayed on the node/N.');
+ $this->assertText($custom_block['title'], t('Block was displayed on the node/N.'));
// Delete the created custom block & verify that it's been deleted.
$this->drupalPost('admin/structure/block/manage/block/' . $bid . '/delete', array(), t('Delete'));
$bid = db_query("SELECT 1 FROM {block_node_type} WHERE module = 'block' AND delta = :delta", array(':delta' => $bid))->fetchField();
- $this->assertFalse($bid, 'Custom block was deleted.');
+ $this->assertFalse($bid, t('Custom block was deleted.'));
}
}
/**
@@ -1548,9 +1548,9 @@ class NodeBuildContent extends DrupalWebTestCase {
);
}
- /**
- * Test to ensure that a node's content array is rebuilt on every call to node_build_content().
- */
+ /**
+ * Test to ensure that a node's content array is rebuilt on every call to node_build_content().
+ */
function testNodeRebuildContent() {
$node = $this->drupalCreateNode();
@@ -1559,7 +1559,7 @@ class NodeBuildContent extends DrupalWebTestCase {
$content = node_build_content($node);
// If the property doesn't exist it means the node->content was rebuilt.
- $this->assertFalse(isset($content['test_content_property']), 'Node content was emptied prior to being built.');
+ $this->assertFalse(isset($content['test_content_property']), t('Node content was emptied prior to being built.'));
}
}
@@ -1636,10 +1636,10 @@ class NodeQueryAlter extends DrupalWebTestCase {
$query->addMetaData('account', $this->accessUser);
$result = $query->execute()->fetchAll();
- $this->assertEqual(count($result), 4, 'User with access can see correct nodes');
+ $this->assertEqual(count($result), 4, t('User with access can see correct nodes'));
}
catch (Exception $e) {
- $this->fail('Altered query is malformed');
+ $this->fail(t('Altered query is malformed'));
}
}
@@ -1659,10 +1659,10 @@ class NodeQueryAlter extends DrupalWebTestCase {
$query->addMetaData('account', $this->noAccessUser);
$result = $query->execute()->fetchAll();
- $this->assertEqual(count($result), 0, 'User with no access cannot see nodes');
+ $this->assertEqual(count($result), 0, t('User with no access cannot see nodes'));
}
catch (Exception $e) {
- $this->fail('Altered query is malformed');
+ $this->fail(t('Altered query is malformed'));
}
}
@@ -1682,12 +1682,12 @@ class NodeQueryAlter extends DrupalWebTestCase {
$query->addMetaData('account', $this->accessUser);
$result = $query->execute()->fetchAll();
- $this->assertEqual(count($result), 0, 'User with view-only access cannot edit nodes');
+ $this->assertEqual(count($result), 0, t('User with view-only access cannot edit nodes'));
}
catch (Exception $e) {
$this->fail($e->getMessage());
$this->fail((string) $query);
- $this->fail('Altered query is malformed');
+ $this->fail(t('Altered query is malformed'));
}
}
}
@@ -1747,11 +1747,11 @@ class NodeTokenReplaceTestCase extends DrupalWebTestCase {
$tests['[node:changed:since]'] = format_interval(REQUEST_TIME - $node->changed, 2, $language->language);
// Test to make sure that we generated something for each token.
- $this->assertFalse(in_array(0, array_map('strlen', $tests)), 'No empty tokens generated.');
+ $this->assertFalse(in_array(0, array_map('strlen', $tests)), t('No empty tokens generated.'));
foreach ($tests as $input => $expected) {
$output = token_replace($input, array('node' => $node), array('language' => $language));
- $this->assertFalse(strcmp($output, $expected), 'Sanitized node token ' . $input . ' replaced.');
+ $this->assertFalse(strcmp($output, $expected), t('Sanitized node token %token replaced.', array('%token' => $input)));
}
// Generate and test unsanitized tokens.
@@ -1763,7 +1763,7 @@ class NodeTokenReplaceTestCase extends DrupalWebTestCase {
foreach ($tests as $input => $expected) {
$output = token_replace($input, array('node' => $node), array('language' => $language, 'sanitize' => FALSE));
- $this->assertFalse(strcmp($output, $expected), 'Unsanitized node token ' . $input . ' replaced.');
+ $this->assertFalse(strcmp($output, $expected), t('Unsanitized node token %token replaced.', array('%token' => $input)));
}
}
}
diff --git a/modules/openid/openid.test b/modules/openid/openid.test
index 36d65f234..68313ae7e 100644
--- a/modules/openid/openid.test
+++ b/modules/openid/openid.test
@@ -15,7 +15,7 @@ abstract class OpenIDWebTestCase extends DrupalWebTestCase {
$this->drupalPost('', $edit, t('Log in'));
// Check we are on the OpenID redirect form.
- $this->assertTitle(t('OpenID redirect'), 'OpenID redirect page was displayed.');
+ $this->assertTitle(t('OpenID redirect'), t('OpenID redirect page was displayed.'));
// Submit form to the OpenID Provider Endpoint.
$this->drupalPost(NULL, array(), t('Send'));
@@ -126,7 +126,7 @@ class OpenIDFunctionalTestCase extends OpenIDWebTestCase {
// Test logging in via the login block on the front page.
$this->submitLoginForm($identity);
- $this->assertLink($this->web_user->name, 0, 'User was logged in.');
+ $this->assertLink($this->web_user->name, 0, t('User was logged in.'));
$this->drupalLogout();
@@ -135,12 +135,12 @@ class OpenIDFunctionalTestCase extends OpenIDWebTestCase {
$this->drupalPost('user/login', $edit, t('Log in'));
// Check we are on the OpenID redirect form.
- $this->assertTitle(t('OpenID redirect'), 'OpenID redirect page was displayed.');
+ $this->assertTitle(t('OpenID redirect'), t('OpenID redirect page was displayed.'));
// Submit form to the OpenID Provider Endpoint.
$this->drupalPost(NULL, array(), t('Send'));
- $this->assertLink($this->web_user->name, 0, 'User was logged in.');
+ $this->assertLink($this->web_user->name, 0, t('User was logged in.'));
// Verify user was redirected away from user/login to an accessible page.
$this->assertResponse(200);
@@ -166,12 +166,12 @@ class OpenIDFunctionalTestCase extends OpenIDWebTestCase {
$this->drupalPost('user/login', $edit, t('Log in'));
// Check we are on the OpenID redirect form.
- $this->assertTitle(t('OpenID redirect'), 'OpenID redirect page was displayed.');
+ $this->assertTitle(t('OpenID redirect'), t('OpenID redirect page was displayed.'));
// Submit form to the OpenID Provider Endpoint.
$this->drupalPost(NULL, array(), t('Send'));
- $this->assertLink($this->web_user->name, 0, 'User was logged in.');
+ $this->assertLink($this->web_user->name, 0, t('User was logged in.'));
// Verify user was redirected away from user/login to an accessible page.
$this->assertText(t('Operating in maintenance mode.'));
@@ -187,14 +187,14 @@ class OpenIDFunctionalTestCase extends OpenIDWebTestCase {
// Add identity to user's profile.
$identity = url('openid-test/yadis/xrds', array('absolute' => TRUE));
$this->addIdentity($identity);
- $this->assertText($identity, 'Identity appears in list.');
+ $this->assertText($identity, t('Identity appears in list.'));
// Delete the newly added identity.
$this->clickLink(t('Delete'));
$this->drupalPost(NULL, array(), t('Confirm'));
- $this->assertText(t('OpenID deleted.'), 'Identity deleted');
- $this->assertNoText($identity, 'Identity no longer appears in list.');
+ $this->assertText(t('OpenID deleted.'), t('Identity deleted'));
+ $this->assertNoText($identity, t('Identity no longer appears in list.'));
}
/**
@@ -218,11 +218,11 @@ class OpenIDFunctionalTestCase extends OpenIDWebTestCase {
'accounts[' . $this->web_user->uid . ']' => TRUE,
);
$this->drupalPost('admin/people', $edit, t('Update'));
- $this->assertRaw('The update has been performed.', 'Account was blocked.');
+ $this->assertRaw('The update has been performed.', t('Account was blocked.'));
$this->drupalLogout();
$this->submitLoginForm($identity);
- $this->assertRaw(t('The username %name has not been activated or is blocked.', array('%name' => $this->web_user->name)), 'User login was blocked.');
+ $this->assertRaw(t('The username %name has not been activated or is blocked.', array('%name' => $this->web_user->name)), t('User login was blocked.'));
}
/**
@@ -246,14 +246,14 @@ class OpenIDFunctionalTestCase extends OpenIDWebTestCase {
$this->drupalPost('user/' . $this->web_user->uid . '/openid', $edit, t('Add an OpenID'));
if ($claimed_id === FALSE) {
- $this->assertRaw(t('Sorry, that is not a valid OpenID. Ensure you have spelled your ID correctly.'), 'Invalid identity was rejected.');
+ $this->assertRaw(t('Sorry, that is not a valid OpenID. Ensure you have spelled your ID correctly.'), t('Invalid identity was rejected.'));
return;
}
// OpenID 1 used a HTTP redirect, OpenID 2 uses a HTML form that is submitted automatically using JavaScript.
if ($version == 2) {
// Check we are on the OpenID redirect form.
- $this->assertTitle(t('OpenID redirect'), 'OpenID redirect page was displayed.');
+ $this->assertTitle(t('OpenID redirect'), t('OpenID redirect page was displayed.'));
// Submit form to the OpenID Provider Endpoint.
$this->drupalPost(NULL, array(), t('Send'));
@@ -262,7 +262,7 @@ class OpenIDFunctionalTestCase extends OpenIDWebTestCase {
if (!isset($claimed_id)) {
$claimed_id = $identity;
}
- $this->assertRaw(t('Successfully added %identity', array('%identity' => $claimed_id)), 'Identity ' . $identity . ' was added.');
+ $this->assertRaw(t('Successfully added %identity', array('%identity' => $claimed_id)), t('Identity %identity was added.', array('%identity' => $identity)));
}
}
@@ -295,13 +295,13 @@ class OpenIDRegistrationTestCase extends OpenIDWebTestCase {
// Use a User-supplied Identity that is the URL of an XRDS document.
$identity = url('openid-test/yadis/xrds', array('absolute' => TRUE));
$this->submitLoginForm($identity);
- $this->assertRaw(t('Once you have verified your e-mail address, you may log in via OpenID.'), 'User was asked to verify e-mail address.');
- $this->assertRaw(t('A welcome message with further instructions has been sent to your e-mail address.'), 'A welcome message was sent to the user.');
+ $this->assertRaw(t('Once you have verified your e-mail address, you may log in via OpenID.'), t('User was asked to verify e-mail address.'));
+ $this->assertRaw(t('A welcome message with further instructions has been sent to your e-mail address.'), t('A welcome message was sent to the user.'));
$user = user_load_by_name('john');
- $this->assertTrue($user, 'User was registered with right username.');
- $this->assertEqual($user->mail, 'john@example.com', 'User was registered with right email address.');
- $this->assertFalse($user->data, 'No additional user info was saved.');
+ $this->assertTrue($user, t('User was registered with right username.'));
+ $this->assertEqual($user->mail, 'john@example.com', t('User was registered with right email address.'));
+ $this->assertFalse($user->data, t('No additional user info was saved.'));
$this->submitLoginForm($identity);
$this->assertRaw(t('You must validate your email address for this account before logging in via OpenID.'));
@@ -314,7 +314,7 @@ class OpenIDRegistrationTestCase extends OpenIDWebTestCase {
// Verify that the account was activated.
$this->submitLoginForm($identity);
- $this->assertLink('john', 0, 'User was logged in.');
+ $this->assertLink('john', 0, t('User was logged in.'));
}
/**
@@ -329,17 +329,17 @@ class OpenIDRegistrationTestCase extends OpenIDWebTestCase {
// Use a User-supplied Identity that is the URL of an XRDS document.
$identity = url('openid-test/yadis/xrds', array('absolute' => TRUE));
$this->submitLoginForm($identity);
- $this->assertLink('john', 0, 'User was logged in.');
+ $this->assertLink('john', 0, t('User was logged in.'));
$user = user_load_by_name('john');
- $this->assertTrue($user, 'User was registered with right username.');
- $this->assertEqual($user->mail, 'john@example.com', 'User was registered with right email address.');
- $this->assertFalse($user->data, 'No additional user info was saved.');
+ $this->assertTrue($user, t('User was registered with right username.'));
+ $this->assertEqual($user->mail, 'john@example.com', t('User was registered with right email address.'));
+ $this->assertFalse($user->data, t('No additional user info was saved.'));
$this->drupalLogout();
$this->submitLoginForm($identity);
- $this->assertLink('john', 0, 'User was logged in.');
+ $this->assertLink('john', 0, t('User was logged in.'));
}
/**
@@ -355,28 +355,28 @@ class OpenIDRegistrationTestCase extends OpenIDWebTestCase {
$identity = url('openid-test/yadis/xrds', array('absolute' => TRUE));
$this->submitLoginForm($identity);
- $this->assertRaw(t('Account registration using the information provided by your OpenID provider failed due to the reasons listed below. Complete the registration by filling out the form below. If you already have an account, you can <a href="@login">log in</a> now and add your OpenID under "My account".', array('@login' => url('user/login'))), 'User was asked to complete the registration process manually.');
- $this->assertRaw(t('The name %name is already taken.', array('%name' => $web_user->name)), 'Form validation error for username was displayed.');
- $this->assertRaw(t('The e-mail address %mail is not valid.', array('%mail' => 'mail@invalid#')), 'Form validation error for e-mail address was displayed.');
+ $this->assertRaw(t('Account registration using the information provided by your OpenID provider failed due to the reasons listed below. Complete the registration by filling out the form below. If you already have an account, you can <a href="@login">log in</a> now and add your OpenID under "My account".', array('@login' => url('user/login'))), t('User was asked to complete the registration process manually.'));
+ $this->assertRaw(t('The name %name is already taken.', array('%name' => $web_user->name)), t('Form validation error for username was displayed.'));
+ $this->assertRaw(t('The e-mail address %mail is not valid.', array('%mail' => 'mail@invalid#')), t('Form validation error for e-mail address was displayed.'));
// Enter username and e-mail address manually.
$edit = array('name' => 'john', 'mail' => 'john@example.com');
$this->drupalPost(NULL, $edit, t('Create new account'));
- $this->assertRaw(t('Once you have verified your e-mail address, you may log in via OpenID.'), 'User was asked to verify e-mail address.');
+ $this->assertRaw(t('Once you have verified your e-mail address, you may log in via OpenID.'), t('User was asked to verify e-mail address.'));
$user = user_load_by_name('john');
- $this->assertTrue($user, 'User was registered with right username.');
- $this->assertFalse($user->data, 'No additional user info was saved.');
+ $this->assertTrue($user, t('User was registered with right username.'));
+ $this->assertFalse($user->data, t('No additional user info was saved.'));
// Follow the one-time login that was sent in the welcome e-mail.
$this->drupalGet(user_pass_reset_url($user));
$this->drupalPost(NULL, array(), t('Log in'));
// The user is taken to user/%uid/edit.
- $this->assertFieldByName('mail', 'john@example.com', 'User was registered with right e-mail address.');
+ $this->assertFieldByName('mail', 'john@example.com', t('User was registered with right e-mail address.'));
$this->clickLink(t('OpenID identities'));
- $this->assertRaw($identity, 'OpenID identity was registered.');
+ $this->assertRaw($identity, t('OpenID identity was registered.'));
}
/**
@@ -390,28 +390,28 @@ class OpenIDRegistrationTestCase extends OpenIDWebTestCase {
// Use a User-supplied Identity that is the URL of an XRDS document.
$identity = url('openid-test/yadis/xrds', array('absolute' => TRUE));
$this->submitLoginForm($identity);
- $this->assertRaw(t('Complete the registration by filling out the form below. If you already have an account, you can <a href="@login">log in</a> now and add your OpenID under "My account".', array('@login' => url('user/login'))), 'User was asked to complete the registration process manually.');
- $this->assertNoRaw(t('You must enter a username.'), 'Form validation error for username was not displayed.');
- $this->assertNoRaw(t('You must enter an e-mail address.'), 'Form validation error for e-mail address was not displayed.');
+ $this->assertRaw(t('Complete the registration by filling out the form below. If you already have an account, you can <a href="@login">log in</a> now and add your OpenID under "My account".', array('@login' => url('user/login'))), t('User was asked to complete the registration process manually.'));
+ $this->assertNoRaw(t('You must enter a username.'), t('Form validation error for username was not displayed.'));
+ $this->assertNoRaw(t('You must enter an e-mail address.'), t('Form validation error for e-mail address was not displayed.'));
// Enter username and e-mail address manually.
$edit = array('name' => 'john', 'mail' => 'john@example.com');
$this->drupalPost(NULL, $edit, t('Create new account'));
- $this->assertRaw(t('Once you have verified your e-mail address, you may log in via OpenID.'), 'User was asked to verify e-mail address.');
+ $this->assertRaw(t('Once you have verified your e-mail address, you may log in via OpenID.'), t('User was asked to verify e-mail address.'));
$user = user_load_by_name('john');
- $this->assertTrue($user, 'User was registered with right username.');
- $this->assertFalse($user->data, 'No additional user info was saved.');
+ $this->assertTrue($user, t('User was registered with right username.'));
+ $this->assertFalse($user->data, t('No additional user info was saved.'));
// Follow the one-time login that was sent in the welcome e-mail.
$this->drupalGet(user_pass_reset_url($user));
$this->drupalPost(NULL, array(), t('Log in'));
// The user is taken to user/%uid/edit.
- $this->assertFieldByName('mail', 'john@example.com', 'User was registered with right e-mail address.');
+ $this->assertFieldByName('mail', 'john@example.com', t('User was registered with right e-mail address.'));
$this->clickLink(t('OpenID identities'));
- $this->assertRaw($identity, 'OpenID identity was registered.');
+ $this->assertRaw($identity, t('OpenID identity was registered.'));
}
/**
@@ -434,11 +434,11 @@ class OpenIDRegistrationTestCase extends OpenIDWebTestCase {
// Use a User-supplied Identity that is the URL of an XRDS document.
$identity = url('openid-test/yadis/xrds', array('absolute' => TRUE));
$this->submitLoginForm($identity);
- $this->assertLink('john', 0, 'User was logged in.');
+ $this->assertLink('john', 0, t('User was logged in.'));
$user = user_load_by_name('john');
- $this->assertTrue($user, 'User was registered with right username.');
- $this->assertEqual($user->mail, 'john@example.com', 'User was registered with right email address.');
+ $this->assertTrue($user, t('User was registered with right username.'));
+ $this->assertEqual($user->mail, 'john@example.com', t('User was registered with right email address.'));
}
}
@@ -463,25 +463,25 @@ class OpenIDUnitTest extends DrupalWebTestCase {
* Test _openid_dh_XXX_to_XXX() functions.
*/
function testConversion() {
- $this->assertEqual(_openid_dh_long_to_base64('12345678901234567890123456789012345678901234567890'), 'CHJ/Y2mq+DyhUCZ0evjH8ZbOPwrS', '_openid_dh_long_to_base64() returned expected result.');
- $this->assertEqual(_openid_dh_base64_to_long('BsH/g8Nrpn2dtBSdu/sr1y8hxwyx'), '09876543210987654321098765432109876543210987654321', '_openid_dh_base64_to_long() returned expected result.');
+ $this->assertEqual(_openid_dh_long_to_base64('12345678901234567890123456789012345678901234567890'), 'CHJ/Y2mq+DyhUCZ0evjH8ZbOPwrS', t('_openid_dh_long_to_base64() returned expected result.'));
+ $this->assertEqual(_openid_dh_base64_to_long('BsH/g8Nrpn2dtBSdu/sr1y8hxwyx'), '09876543210987654321098765432109876543210987654321', t('_openid_dh_base64_to_long() returned expected result.'));
- $this->assertEqual(_openid_dh_long_to_binary('12345678901234567890123456789012345678901234567890'), "\x08r\x7fci\xaa\xf8<\xa1P&tz\xf8\xc7\xf1\x96\xce?\x0a\xd2", '_openid_dh_long_to_binary() returned expected result.');
- $this->assertEqual(_openid_dh_binary_to_long("\x06\xc1\xff\x83\xc3k\xa6}\x9d\xb4\x14\x9d\xbb\xfb+\xd7/!\xc7\x0c\xb1"), '09876543210987654321098765432109876543210987654321', '_openid_dh_binary_to_long() returned expected result.');
+ $this->assertEqual(_openid_dh_long_to_binary('12345678901234567890123456789012345678901234567890'), "\x08r\x7fci\xaa\xf8<\xa1P&tz\xf8\xc7\xf1\x96\xce?\x0a\xd2", t('_openid_dh_long_to_binary() returned expected result.'));
+ $this->assertEqual(_openid_dh_binary_to_long("\x06\xc1\xff\x83\xc3k\xa6}\x9d\xb4\x14\x9d\xbb\xfb+\xd7/!\xc7\x0c\xb1"), '09876543210987654321098765432109876543210987654321', t('_openid_dh_binary_to_long() returned expected result.'));
}
/**
* Test _openid_dh_xorsecret().
*/
function testOpenidDhXorsecret() {
- $this->assertEqual(_openid_dh_xorsecret('123456790123456790123456790', "abc123ABC\x00\xFF"), "\xa4'\x06\xbe\xf1.\x00y\xff\xc2\xc1", '_openid_dh_xorsecret() returned expected result.');
+ $this->assertEqual(_openid_dh_xorsecret('123456790123456790123456790', "abc123ABC\x00\xFF"), "\xa4'\x06\xbe\xf1.\x00y\xff\xc2\xc1", t('_openid_dh_xorsecret() returned expected result.'));
}
/**
* Test _openid_get_bytes().
*/
function testOpenidGetBytes() {
- $this->assertEqual(strlen(_openid_get_bytes(20)), 20, '_openid_get_bytes() returned expected result.');
+ $this->assertEqual(strlen(_openid_get_bytes(20)), 20, t('_openid_get_bytes() returned expected result.'));
}
/**
@@ -501,7 +501,7 @@ class OpenIDUnitTest extends DrupalWebTestCase {
);
$association = new stdClass();
$association->mac_key = "1234567890abcdefghij\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\xF0\xF1\xF2\xF3\xF4\xF5\xF6\xF7\xF8\xF9";
- $this->assertEqual(_openid_signature($association, $response, array('foo', 'bar')), 'QnKZQzSFstT+GNiJDFOptdcZjrc=', 'Expected signature calculated.');
+ $this->assertEqual(_openid_signature($association, $response, array('foo', 'bar')), 'QnKZQzSFstT+GNiJDFOptdcZjrc=', t('Expected signature calculated.'));
}
/**
@@ -512,26 +512,26 @@ class OpenIDUnitTest extends DrupalWebTestCase {
// section 7.2. If the user-supplied string starts with xri:// it should be
// stripped and the resulting string should be treated as an XRI when it
// starts with "=", "@", "+", "$", "!" or "(".
- $this->assertTrue(_openid_is_xri('xri://=foo'), '_openid_is_xri() returned expected result for an xri identifier with xri scheme.');
- $this->assertTrue(_openid_is_xri('xri://@foo'), '_openid_is_xri() returned expected result for an xri identifier with xri scheme.');
- $this->assertTrue(_openid_is_xri('xri://+foo'), '_openid_is_xri() returned expected result for an xri identifier with xri scheme.');
- $this->assertTrue(_openid_is_xri('xri://$foo'), '_openid_is_xri() returned expected result for an xri identifier with xri scheme.');
- $this->assertTrue(_openid_is_xri('xri://!foo'), '_openid_is_xri() returned expected result for an xri identifier with xri scheme..');
- $this->assertTrue(_openid_is_xri('xri://(foo'), '_openid_is_xri() returned expected result for an xri identifier with xri scheme..');
-
- $this->assertTrue(_openid_is_xri('=foo'), '_openid_is_xri() returned expected result for an xri identifier.');
- $this->assertTrue(_openid_is_xri('@foo'), '_openid_is_xri() returned expected result for an xri identifier.');
- $this->assertTrue(_openid_is_xri('+foo'), '_openid_is_xri() returned expected result for an xri identifier.');
- $this->assertTrue(_openid_is_xri('$foo'), '_openid_is_xri() returned expected result for an xri identifier.');
- $this->assertTrue(_openid_is_xri('!foo'), '_openid_is_xri() returned expected result for an xri identifier.');
- $this->assertTrue(_openid_is_xri('(foo'), '_openid_is_xri() returned expected result for an xri identifier.');
-
- $this->assertFalse(_openid_is_xri('foo'), '_openid_is_xri() returned expected result for an http URL.');
- $this->assertFalse(_openid_is_xri('xri://foo'), '_openid_is_xri() returned expected result for an http URL.');
- $this->assertFalse(_openid_is_xri('http://foo/'), '_openid_is_xri() returned expected result for an http URL.');
- $this->assertFalse(_openid_is_xri('http://example.com/'), '_openid_is_xri() returned expected result for an http URL.');
- $this->assertFalse(_openid_is_xri('user@example.com/'), '_openid_is_xri() returned expected result for an http URL.');
- $this->assertFalse(_openid_is_xri('http://user@example.com/'), '_openid_is_xri() returned expected result for an http URL.');
+ $this->assertTrue(_openid_is_xri('xri://=foo'), t('_openid_is_xri() returned expected result for an xri identifier with xri scheme.'));
+ $this->assertTrue(_openid_is_xri('xri://@foo'), t('_openid_is_xri() returned expected result for an xri identifier with xri scheme.'));
+ $this->assertTrue(_openid_is_xri('xri://+foo'), t('_openid_is_xri() returned expected result for an xri identifier with xri scheme.'));
+ $this->assertTrue(_openid_is_xri('xri://$foo'), t('_openid_is_xri() returned expected result for an xri identifier with xri scheme.'));
+ $this->assertTrue(_openid_is_xri('xri://!foo'), t('_openid_is_xri() returned expected result for an xri identifier with xri scheme..'));
+ $this->assertTrue(_openid_is_xri('xri://(foo'), t('_openid_is_xri() returned expected result for an xri identifier with xri scheme..'));
+
+ $this->assertTrue(_openid_is_xri('=foo'), t('_openid_is_xri() returned expected result for an xri identifier.'));
+ $this->assertTrue(_openid_is_xri('@foo'), t('_openid_is_xri() returned expected result for an xri identifier.'));
+ $this->assertTrue(_openid_is_xri('+foo'), t('_openid_is_xri() returned expected result for an xri identifier.'));
+ $this->assertTrue(_openid_is_xri('$foo'), t('_openid_is_xri() returned expected result for an xri identifier.'));
+ $this->assertTrue(_openid_is_xri('!foo'), t('_openid_is_xri() returned expected result for an xri identifier.'));
+ $this->assertTrue(_openid_is_xri('(foo'), t('_openid_is_xri() returned expected result for an xri identifier.'));
+
+ $this->assertFalse(_openid_is_xri('foo'), t('_openid_is_xri() returned expected result for an http URL.'));
+ $this->assertFalse(_openid_is_xri('xri://foo'), t('_openid_is_xri() returned expected result for an http URL.'));
+ $this->assertFalse(_openid_is_xri('http://foo/'), t('_openid_is_xri() returned expected result for an http URL.'));
+ $this->assertFalse(_openid_is_xri('http://example.com/'), t('_openid_is_xri() returned expected result for an http URL.'));
+ $this->assertFalse(_openid_is_xri('user@example.com/'), t('_openid_is_xri() returned expected result for an http URL.'));
+ $this->assertFalse(_openid_is_xri('http://user@example.com/'), t('_openid_is_xri() returned expected result for an http URL.'));
}
/**
@@ -541,15 +541,15 @@ class OpenIDUnitTest extends DrupalWebTestCase {
// Test that the normalization is according to OpenID Authentication 2.0,
// section 7.2 and 11.5.2.
- $this->assertEqual(openid_normalize('$foo'), '$foo', 'openid_normalize() correctly normalized an XRI.');
- $this->assertEqual(openid_normalize('xri://$foo'), '$foo', 'openid_normalize() correctly normalized an XRI with an xri:// scheme.');
+ $this->assertEqual(openid_normalize('$foo'), '$foo', t('openid_normalize() correctly normalized an XRI.'));
+ $this->assertEqual(openid_normalize('xri://$foo'), '$foo', t('openid_normalize() correctly normalized an XRI with an xri:// scheme.'));
- $this->assertEqual(openid_normalize('example.com/'), 'http://example.com/', 'openid_normalize() correctly normalized a URL with a missing scheme.');
- $this->assertEqual(openid_normalize('example.com'), 'http://example.com/', 'openid_normalize() correctly normalized a URL with a missing scheme and empty path.');
- $this->assertEqual(openid_normalize('http://example.com'), 'http://example.com/', 'openid_normalize() correctly normalized a URL with an empty path.');
+ $this->assertEqual(openid_normalize('example.com/'), 'http://example.com/', t('openid_normalize() correctly normalized a URL with a missing scheme.'));
+ $this->assertEqual(openid_normalize('example.com'), 'http://example.com/', t('openid_normalize() correctly normalized a URL with a missing scheme and empty path.'));
+ $this->assertEqual(openid_normalize('http://example.com'), 'http://example.com/', t('openid_normalize() correctly normalized a URL with an empty path.'));
- $this->assertEqual(openid_normalize('http://example.com/path'), 'http://example.com/path', 'openid_normalize() correctly normalized a URL with a path.');
+ $this->assertEqual(openid_normalize('http://example.com/path'), 'http://example.com/path', t('openid_normalize() correctly normalized a URL with a path.'));
- $this->assertEqual(openid_normalize('http://example.com/path#fragment'), 'http://example.com/path', 'openid_normalize() correctly normalized a URL with a fragment.');
+ $this->assertEqual(openid_normalize('http://example.com/path#fragment'), 'http://example.com/path', t('openid_normalize() correctly normalized a URL with a fragment.'));
}
}
diff --git a/modules/path/path.test b/modules/path/path.test
index 8d48c712d..cca5fd972 100644
--- a/modules/path/path.test
+++ b/modules/path/path.test
@@ -40,12 +40,12 @@ class PathTestCase extends DrupalWebTestCase {
// created.
cache_clear_all('*', 'cache_path', TRUE);
$this->drupalGet($edit['source']);
- $this->assertTrue(cache_get($edit['source'], 'cache_path'), 'Cache entry was created.');
+ $this->assertTrue(cache_get($edit['source'], 'cache_path'), t('Cache entry was created.'));
// Visit the alias for the node and confirm a cache entry is created.
cache_clear_all('*', 'cache_path', TRUE);
$this->drupalGet($edit['alias']);
- $this->assertTrue(cache_get($edit['source'], 'cache_path'), 'Cache entry was created.');
+ $this->assertTrue(cache_get($edit['source'], 'cache_path'), t('Cache entry was created.'));
}
/**
@@ -191,7 +191,7 @@ class PathTaxonomyTermTestCase extends DrupalWebTestCase {
function testTermAlias() {
// Create a term in the default 'Tags' vocabulary with URL alias.
$vocabulary = taxonomy_vocabulary_load(1);
- $description = $this->randomName();
+ $description = $this->randomName();;
$edit = array();
$edit['name'] = $this->randomName();
$edit['description[value]'] = $description;
@@ -301,7 +301,7 @@ class PathLanguageTestCase extends DrupalWebTestCase {
drupal_static_reset('language_list');
$languages = language_list();
$url = url('node/' . $french_node->nid, array('language' => $languages[$french_node->language]));
- $this->assertTrue(strpos($url, $edit['path[alias]']), 'URL contains the path alias.');
+ $this->assertTrue(strpos($url, $edit['path[alias]']), t('URL contains the path alias.'));
// Confirm that the alias works even when changing language negotiation
// options. Enable User language detection and selection over URL one.
@@ -345,23 +345,23 @@ class PathLanguageTestCase extends DrupalWebTestCase {
// situation only aliases in the default language and language neutral ones
// should keep working.
$this->drupalGet($french_alias);
- $this->assertResponse(404, 'Alias for French translation is unavailable when URL language negotiation is disabled.');
+ $this->assertResponse(404, t('Alias for French translation is unavailable when URL language negotiation is disabled.'));
// drupal_lookup_path() has an internal static cache. Check to see that
// it has the appropriate contents at this point.
drupal_lookup_path('wipe');
$french_node_path = drupal_lookup_path('source', $french_alias, $french_node->language);
- $this->assertEqual($french_node_path, 'node/' . $french_node->nid, 'Normal path works.');
+ $this->assertEqual($french_node_path, 'node/' . $french_node->nid, t('Normal path works.'));
// Second call should return the same path.
$french_node_path = drupal_lookup_path('source', $french_alias, $french_node->language);
- $this->assertEqual($french_node_path, 'node/' . $french_node->nid, 'Normal path is the same.');
+ $this->assertEqual($french_node_path, 'node/' . $french_node->nid, t('Normal path is the same.'));
// Confirm that the alias works.
$french_node_alias = drupal_lookup_path('alias', 'node/' . $french_node->nid, $french_node->language);
- $this->assertEqual($french_node_alias, $french_alias, 'Alias works.');
+ $this->assertEqual($french_node_alias, $french_alias, t('Alias works.'));
// Second call should return the same alias.
$french_node_alias = drupal_lookup_path('alias', 'node/' . $french_node->nid, $french_node->language);
- $this->assertEqual($french_node_alias, $french_alias, 'Alias is the same.');
+ $this->assertEqual($french_node_alias, $french_alias, t('Alias is the same.'));
}
}
@@ -475,8 +475,8 @@ class PathMonolingualTestCase extends DrupalWebTestCase {
$this->drupalPost('admin/config/regional/language', $edit, t('Save configuration'));
// Verify that French is the only language.
- $this->assertFalse(drupal_multilingual(), 'Site is mono-lingual');
- $this->assertEqual(language_default('language'), 'fr', 'French is the default language');
+ $this->assertFalse(drupal_multilingual(), t('Site is mono-lingual'));
+ $this->assertEqual(language_default('language'), 'fr', t('French is the default language'));
// Set language detection to URL.
$edit = array('language[enabled][locale-url]' => TRUE);
diff --git a/modules/php/php.test b/modules/php/php.test
index 703c36ec7..6f36e4f5f 100644
--- a/modules/php/php.test
+++ b/modules/php/php.test
@@ -17,20 +17,20 @@ class PHPTestCase extends DrupalWebTestCase {
// Verify that the PHP code text format was inserted.
$php_format_id = db_query_range('SELECT format FROM {filter_format} WHERE name = :name', 0, 1, array(':name' => 'PHP code'))->fetchField();
$php_format = filter_format_load($php_format_id);
- $this->assertEqual($php_format->name, 'PHP code', 'PHP code text format was created.');
+ $this->assertEqual($php_format->name, 'PHP code', t('PHP code text format was created.'));
// Verify that the format has the PHP code filter enabled.
$filters = filter_list_format($php_format_id);
- $this->assertTrue($filters['php_code']->status, 'PHP code filter is enabled.');
+ $this->assertTrue($filters['php_code']->status, t('PHP code filter is enabled.'));
// Verify that the format exists on the administration page.
$this->drupalGet('admin/config/content/formats');
- $this->assertText('PHP code', 'PHP code text format was created.');
+ $this->assertText('PHP code', t('PHP code text format was created.'));
// Verify that anonymous and authenticated user roles do not have access.
$this->drupalGet('admin/config/content/formats/' . $php_format_id);
- $this->assertFieldByName('roles[1]', FALSE, 'Anonymous users do not have access to PHP code format.');
- $this->assertFieldByName('roles[2]', FALSE, 'Authenticated users do not have access to PHP code format.');
+ $this->assertFieldByName('roles[1]', FALSE, t('Anonymous users do not have access to PHP code format.'));
+ $this->assertFieldByName('roles[2]', FALSE, t('Authenticated users do not have access to PHP code format.'));
// Store the format ID of the PHP code text format for later use.
$this->php_code_format = $php_format_id;
@@ -72,18 +72,18 @@ class PHPFilterTestCase extends PHPTestCase {
// Make sure that the PHP code shows up as text.
$this->drupalGet('node/' . $node->nid);
- $this->assertText('print "SimpleTest PHP was executed!"', 'PHP code is displayed.');
+ $this->assertText('print "SimpleTest PHP was executed!"', t('PHP code is displayed.'));
// Change filter to PHP filter and see that PHP code is evaluated.
$edit = array();
$langcode = LANGUAGE_NONE;
$edit["body[$langcode][0][format]"] = $this->php_code_format;
$this->drupalPost('node/' . $node->nid . '/edit', $edit, t('Save'));
- $this->assertRaw(t('Basic page %title has been updated.', array('%title' => $node->title)), 'PHP code filter turned on.');
+ $this->assertRaw(t('Basic page %title has been updated.', array('%title' => $node->title)), t('PHP code filter turned on.'));
// Make sure that the PHP code shows up as text.
- $this->assertNoText('print "SimpleTest PHP was executed!"', "PHP code isn't displayed.");
- $this->assertText('SimpleTest PHP was executed!', 'PHP code has been evaluated.');
+ $this->assertNoText('print "SimpleTest PHP was executed!"', t("PHP code isn't displayed."));
+ $this->assertText('SimpleTest PHP was executed!', t('PHP code has been evaluated.'));
}
}
@@ -110,10 +110,10 @@ class PHPAccessTestCase extends PHPTestCase {
// Make sure that the PHP code shows up as text.
$this->drupalGet('node/' . $node->nid);
- $this->assertText('print', 'PHP code was not evaluated.');
+ $this->assertText('print', t('PHP code was not evaluated.'));
// Make sure that user doesn't have access to filter.
$this->drupalGet('node/' . $node->nid . '/edit');
- $this->assertNoRaw('<option value="' . $this->php_code_format . '">', 'PHP code format not available.');
+ $this->assertNoRaw('<option value="' . $this->php_code_format . '">', t('PHP code format not available.'));
}
}
diff --git a/modules/poll/poll.test b/modules/poll/poll.test
index 4b214cbff..061646492 100644
--- a/modules/poll/poll.test
+++ b/modules/poll/poll.test
@@ -39,7 +39,7 @@ class PollTestCase extends DrupalWebTestCase {
if ($test_preview) {
$this->drupalPost(NULL, $edit, t('Preview'));
foreach ($choices as $k => $choice_text) {
- $this->assertRaw($choice_text, 'Choice ' . $k . ' found was in preview.');
+ $this->assertRaw($choice_text, t('Choice @choice found was in preview.', array('@choice' => $k)));
}
list($edit, $index) = $this->_pollGenerateEdit($title, $choices, $index);
}
@@ -47,7 +47,7 @@ class PollTestCase extends DrupalWebTestCase {
$this->drupalPost(NULL, $edit, t('Save'));
$node = $this->drupalGetNodeByTitle($title);
$this->assertText(t('@type @title has been created.', array('@type' => node_type_get_name('poll'), '@title' => $title)), 'Poll has been created.');
- $this->assertTrue($node->nid, 'Poll has been found in the database.');
+ $this->assertTrue($node->nid, t('Poll has been found in the database.'));
return isset($node->nid) ? $node->nid : FALSE;
}
@@ -132,7 +132,7 @@ class PollCreateTestCase extends PollTestCase {
// Verify 'Vote' button no longer appears.
$this->drupalGet('node/' . $poll_nid);
$elements = $this->xpath('//input[@id="edit-vote"]');
- $this->assertTrue(empty($elements), "Vote button doesn't appear.");
+ $this->assertTrue(empty($elements), t("Vote button doesn't appear."));
// Verify status on 'poll' page is 'closed'.
$this->drupalGet('poll');
@@ -150,7 +150,7 @@ class PollCreateTestCase extends PollTestCase {
$this->drupalPost('node/' . $poll_nid, $vote_edit, t('Vote'));
$this->assertText('Your vote was recorded.', 'Your vote was recorded.');
$elements = $this->xpath('//input[@value="Cancel your vote"]');
- $this->assertTrue(isset($elements[0]), "'Cancel your vote' button appears.");
+ $this->assertTrue(isset($elements[0]), t("'Cancel your vote' button appears."));
// Edit the poll node and close the poll.
$this->drupalLogout();
@@ -161,7 +161,7 @@ class PollCreateTestCase extends PollTestCase {
// Verify 'Cancel your vote' button no longer appears.
$this->drupalGet('node/' . $poll_nid);
$elements = $this->xpath('//input[@value="Cancel your vote"]');
- $this->assertTrue(empty($elements), "'Cancel your vote' button no longer appears.");
+ $this->assertTrue(empty($elements), t("'Cancel your vote' button no longer appears."));
}
}
@@ -201,7 +201,7 @@ class PollVoteTestCase extends PollTestCase {
$this->assertText('Your vote was recorded.', 'Your vote was recorded.');
$this->assertText('Total votes: 1', 'Vote count updated correctly.');
$elements = $this->xpath('//input[@value="Cancel your vote"]');
- $this->assertTrue(isset($elements[0]), "'Cancel your vote' button appears.");
+ $this->assertTrue(isset($elements[0]), t("'Cancel your vote' button appears."));
$this->drupalGet("node/$poll_nid/votes");
$this->assertText(t('This table lists all the recorded votes for this poll. If anonymous users are allowed to vote, they will be identified by the IP address of the computer they used when they voted.'), 'Vote table text.');
@@ -237,7 +237,7 @@ class PollVoteTestCase extends PollTestCase {
$this->assertText('Your vote was recorded.', 'Your vote was recorded.');
$this->assertText('Total votes: 1', 'Vote count updated correctly.');
$elements = $this->xpath('//input[@value="Cancel your vote"]');
- $this->assertTrue(empty($elements), "'Cancel your vote' button does not appear.");
+ $this->assertTrue(empty($elements), t("'Cancel your vote' button does not appear."));
}
}
@@ -261,13 +261,13 @@ class PollBlockTestCase extends PollTestCase {
function testRecentBlock() {
// Set block title to confirm that the interface is available.
$this->drupalPost('admin/structure/block/manage/poll/recent/configure', array('title' => $this->randomName(8)), t('Save block'));
- $this->assertText(t('The block configuration has been saved.'), 'Block configuration set.');
+ $this->assertText(t('The block configuration has been saved.'), t('Block configuration set.'));
// Set the block to a region to confirm block is available.
$edit = array();
$edit['poll_recent[region]'] = 'footer';
$this->drupalPost('admin/structure/block', $edit, t('Save blocks'));
- $this->assertText(t('The block settings have been updated.'), 'Block successfully move to footer region.');
+ $this->assertText(t('The block settings have been updated.'), t('Block successfully move to footer region.'));
// Create a poll which should appear in recent polls block.
$title = $this->randomName();
@@ -344,9 +344,9 @@ class PollJSAddChoice extends DrupalWebTestCase {
$commands = $this->drupalPostAJAX(NULL, $edit, array('op' => t('More choices')));
$this->content = $commands[1]['data'];
- $this->assertFieldByName('choice[chid:0][chtext]', $edit['choice[new:0][chtext]'], 'Field ' . 0 . ' found');
- $this->assertFieldByName('choice[chid:1][chtext]', $edit['choice[new:1][chtext]'], 'Field ' . 1 . ' found');
- $this->assertFieldByName('choice[new:0][chtext]', '', 'Field ' . 2 . ' found');
+ $this->assertFieldByName('choice[chid:0][chtext]', $edit['choice[new:0][chtext]'], t('Field !i found', array('!i' => 0)));
+ $this->assertFieldByName('choice[chid:1][chtext]', $edit['choice[new:1][chtext]'], t('Field !i found', array('!i' => 1)));
+ $this->assertFieldByName('choice[new:0][chtext]', '', t('Field !i found', array('!i' => 2)));
}
}
@@ -403,49 +403,49 @@ class PollVoteCheckHostname extends PollTestCase {
// User1 vote on Poll.
$this->drupalPost('node/' . $this->poll_nid, $edit, t('Vote'));
- $this->assertText(t('Your vote was recorded.'), $this->web_user1->name . ' vote was recorded.');
- $this->assertText(t('Total votes: @votes', array('@votes' => 1)), 'Vote count updated correctly.');
+ $this->assertText(t('Your vote was recorded.'), t('%user vote was recorded.', array('%user' => $this->web_user1->name)));
+ $this->assertText(t('Total votes: @votes', array('@votes' => 1)), t('Vote count updated correctly.'));
// Check to make sure User1 cannot vote again.
$this->drupalGet('node/' . $this->poll_nid);
$elements = $this->xpath('//input[@value="Vote"]');
- $this->assertTrue(empty($elements), "" . $this->web_user1->name . " is not able to vote again.");
+ $this->assertTrue(empty($elements), t("%user is not able to vote again.", array('%user' => $this->web_user1->name)));
$elements = $this->xpath('//input[@value="Cancel your vote"]');
- $this->assertTrue(!empty($elements), "'Cancel your vote' button appears.");
+ $this->assertTrue(!empty($elements), t("'Cancel your vote' button appears."));
// Logout User1.
$this->drupalLogout();
// Fill the page cache by requesting the poll.
$this->drupalGet('node/' . $this->poll_nid);
- $this->assertEqual($this->drupalGetHeader('x-drupal-cache'), 'MISS', 'Page was cacheable but was not in the cache.');
+ $this->assertEqual($this->drupalGetHeader('x-drupal-cache'), 'MISS', t('Page was cacheable but was not in the cache.'));
$this->drupalGet('node/' . $this->poll_nid);
- $this->assertEqual($this->drupalGetHeader('x-drupal-cache'), 'HIT', 'Page was cached.');
+ $this->assertEqual($this->drupalGetHeader('x-drupal-cache'), 'HIT', t('Page was cached.'));
// Anonymous user vote on Poll.
$this->drupalPost(NULL, $edit, t('Vote'));
- $this->assertText(t('Your vote was recorded.'), 'Anonymous vote was recorded.');
- $this->assertText(t('Total votes: @votes', array('@votes' => 2)), 'Vote count updated correctly.');
+ $this->assertText(t('Your vote was recorded.'), t('Anonymous vote was recorded.'));
+ $this->assertText(t('Total votes: @votes', array('@votes' => 2)), t('Vote count updated correctly.'));
$elements = $this->xpath('//input[@value="Cancel your vote"]');
- $this->assertTrue(!empty($elements), "'Cancel your vote' button appears.");
+ $this->assertTrue(!empty($elements), t("'Cancel your vote' button appears."));
// Check to make sure Anonymous user cannot vote again.
$this->drupalGet('node/' . $this->poll_nid);
- $this->assertFalse($this->drupalGetHeader('x-drupal-cache'), 'Page was not cacheable.');
+ $this->assertFalse($this->drupalGetHeader('x-drupal-cache'), t('Page was not cacheable.'));
$elements = $this->xpath('//input[@value="Vote"]');
- $this->assertTrue(empty($elements), "Anonymous is not able to vote again.");
+ $this->assertTrue(empty($elements), t("Anonymous is not able to vote again."));
$elements = $this->xpath('//input[@value="Cancel your vote"]');
- $this->assertTrue(!empty($elements), "'Cancel your vote' button appears.");
+ $this->assertTrue(!empty($elements), t("'Cancel your vote' button appears."));
// Login User2.
$this->drupalLogin($this->web_user2);
// User2 vote on poll.
$this->drupalPost('node/' . $this->poll_nid, $edit, t('Vote'));
- $this->assertText(t('Your vote was recorded.'), $this->web_user2->name . ' vote was recorded.');
+ $this->assertText(t('Your vote was recorded.'), t('%user vote was recorded.', array('%user' => $this->web_user2->name)));
$this->assertText(t('Total votes: @votes', array('@votes' => 3)), 'Vote count updated correctly.');
$elements = $this->xpath('//input[@value="Cancel your vote"]');
- $this->assertTrue(empty($elements), "'Cancel your vote' button does not appear.");
+ $this->assertTrue(empty($elements), t("'Cancel your vote' button does not appear."));
// Logout User2.
$this->drupalLogout();
@@ -461,22 +461,22 @@ class PollVoteCheckHostname extends PollTestCase {
// Check to make sure Anonymous user can vote again with a new session after
// a hostname change.
$this->drupalGet('node/' . $this->poll_nid);
- $this->assertEqual($this->drupalGetHeader('x-drupal-cache'), 'MISS', 'Page was cacheable but was not in the cache.');
+ $this->assertEqual($this->drupalGetHeader('x-drupal-cache'), 'MISS', t('Page was cacheable but was not in the cache.'));
$this->drupalPost(NULL, $edit, t('Vote'));
- $this->assertText(t('Your vote was recorded.'), $this->web_user2->name . ' vote was recorded.');
+ $this->assertText(t('Your vote was recorded.'), t('%user vote was recorded.', array('%user' => $this->web_user2->name)));
$this->assertText(t('Total votes: @votes', array('@votes' => 4)), 'Vote count updated correctly.');
$elements = $this->xpath('//input[@value="Cancel your vote"]');
- $this->assertTrue(!empty($elements), "'Cancel your vote' button appears.");
+ $this->assertTrue(!empty($elements), t("'Cancel your vote' button appears."));
// Check to make sure Anonymous user cannot vote again with a new session,
// and that the vote from the previous session cannot be cancelledd.
$this->curlClose();
$this->drupalGet('node/' . $this->poll_nid);
- $this->assertEqual($this->drupalGetHeader('x-drupal-cache'), 'MISS', 'Page was cacheable but was not in the cache.');
+ $this->assertEqual($this->drupalGetHeader('x-drupal-cache'), 'MISS', t('Page was cacheable but was not in the cache.'));
$elements = $this->xpath('//input[@value="Vote"]');
- $this->assertTrue(empty($elements), 'Anonymous is not able to vote again.');
+ $this->assertTrue(empty($elements), t('Anonymous is not able to vote again.'));
$elements = $this->xpath('//input[@value="Cancel your vote"]');
- $this->assertTrue(empty($elements), "'Cancel your vote' button does not appear.");
+ $this->assertTrue(empty($elements), t("'Cancel your vote' button does not appear."));
// Login User1.
$this->drupalLogin($this->web_user1);
@@ -484,9 +484,9 @@ class PollVoteCheckHostname extends PollTestCase {
// Check to make sure User1 still cannot vote even after hostname changed.
$this->drupalGet('node/' . $this->poll_nid);
$elements = $this->xpath('//input[@value="Vote"]');
- $this->assertTrue(empty($elements), "" . $this->web_user1->name . " is not able to vote again.");
+ $this->assertTrue(empty($elements), t("%user is not able to vote again.", array('%user' => $this->web_user1->name)));
$elements = $this->xpath('//input[@value="Cancel your vote"]');
- $this->assertTrue(!empty($elements), "'Cancel your vote' button appears.");
+ $this->assertTrue(!empty($elements), t("'Cancel your vote' button appears."));
}
}
@@ -562,11 +562,11 @@ class PollTokenReplaceTestCase extends PollTestCase {
$tests['[node:poll-duration]'] = format_interval($poll->runtime, 1, $language->language);
// Test to make sure that we generated something for each token.
- $this->assertFalse(in_array(0, array_map('strlen', $tests)), 'No empty tokens generated.');
+ $this->assertFalse(in_array(0, array_map('strlen', $tests)), t('No empty tokens generated.'));
foreach ($tests as $input => $expected) {
$output = token_replace($input, array('node' => $poll), array('language' => $language));
- $this->assertFalse(strcmp($output, $expected), 'Sanitized poll token ' . $input . ' replaced.');
+ $this->assertFalse(strcmp($output, $expected), t('Sanitized poll token %token replaced.', array('%token' => $input)));
}
// Generate and test unsanitized tokens.
@@ -574,7 +574,7 @@ class PollTokenReplaceTestCase extends PollTestCase {
foreach ($tests as $input => $expected) {
$output = token_replace($input, array('node' => $poll), array('language' => $language, 'sanitize' => FALSE));
- $this->assertFalse(strcmp($output, $expected), 'Unsanitized poll token ' . $input . ' replaced.');
+ $this->assertFalse(strcmp($output, $expected), t('Unsanitized poll token %token replaced.', array('%token' => $input)));
}
}
}
@@ -597,33 +597,33 @@ class PollExpirationTestCase extends PollTestCase {
$title = $this->randomName();
$choices = $this->_generateChoices(2);
$poll_nid = $this->pollCreate($title, $choices, FALSE);
- $this->assertTrue($poll_nid, 'Poll for auto-expire test created.', 'Poll');
+ $this->assertTrue($poll_nid, t('Poll for auto-expire test created.'), t('Poll'));
// Visit the poll edit page and verify that by default, expiration
// is set to unlimited.
$this->drupalGet("node/$poll_nid/edit");
- $this->assertField('runtime', 'Poll expiration setting found.', 'Poll');
+ $this->assertField('runtime', t('Poll expiration setting found.'), t('Poll'));
$elements = $this->xpath('//select[@id="edit-runtime"]/option[@selected="selected"]');
- $this->assertTrue(isset($elements[0]['value']) && $elements[0]['value'] == 0, 'Poll expiration set to unlimited.', 'Poll');
+ $this->assertTrue(isset($elements[0]['value']) && $elements[0]['value'] == 0, t('Poll expiration set to unlimited.'), t('Poll'));
// Set the expiration to one week.
$edit = array();
$poll_expiration = 604800; // One week.
$edit['runtime'] = $poll_expiration;
$this->drupalPost(NULL, $edit, t('Save'));
- $this->assertRaw(t('Poll %title has been updated.', array('%title' => $title)), 'Poll expiration settings saved.', 'Poll');
+ $this->assertRaw(t('Poll %title has been updated.', array('%title' => $title)), t('Poll expiration settings saved.'), t('Poll'));
// Make sure that the changed expiration settings is kept.
$this->drupalGet("node/$poll_nid/edit");
$elements = $this->xpath('//select[@id="edit-runtime"]/option[@selected="selected"]');
- $this->assertTrue(isset($elements[0]['value']) && $elements[0]['value'] == $poll_expiration, 'Poll expiration set to unlimited.', 'Poll');
+ $this->assertTrue(isset($elements[0]['value']) && $elements[0]['value'] == $poll_expiration, t('Poll expiration set to unlimited.'), t('Poll'));
// Force a cron run. Since the expiration date has not yet been reached,
// the poll should remain active.
drupal_cron_run();
$this->drupalGet("node/$poll_nid/edit");
$elements = $this->xpath('//input[@id="edit-active-1"]');
- $this->assertTrue(isset($elements[0]) && !empty($elements[0]['checked']), 'Poll is still active.', 'Poll');
+ $this->assertTrue(isset($elements[0]) && !empty($elements[0]['checked']), t('Poll is still active.'), t('Poll'));
// Test expiration. Since REQUEST_TIME is a constant and we don't
// want to keep SimpleTest waiting until the moment of expiration arrives,
@@ -638,6 +638,6 @@ class PollExpirationTestCase extends PollTestCase {
drupal_cron_run();
$this->drupalGet("node/$poll_nid/edit");
$elements = $this->xpath('//input[@id="edit-active-0"]');
- $this->assertTrue(isset($elements[0]) && !empty($elements[0]['checked']), 'Poll has expired.', 'Poll');
+ $this->assertTrue(isset($elements[0]) && !empty($elements[0]['checked']), t('Poll has expired.'), t('Poll'));
}
-}
+} \ No newline at end of file
diff --git a/modules/profile/profile.test b/modules/profile/profile.test
index 37843cdef..27b32d3db 100644
--- a/modules/profile/profile.test
+++ b/modules/profile/profile.test
@@ -38,25 +38,25 @@ class ProfileTestCase extends DrupalWebTestCase {
$this->drupalPost('admin/config/people/profile/add/' . $type, $edit, t('Save field'));
$fid = db_query("SELECT fid FROM {profile_field} WHERE title = :title", array(':title' => $title))->fetchField();
- $this->assertTrue($fid, 'New Profile field has been entered in the database');
+ $this->assertTrue($fid, t('New Profile field has been entered in the database'));
// Check that the new field is appearing on the user edit form.
$this->drupalGet('user/' . $this->admin_user->uid . '/edit/' . $category);
// Checking field.
if ($type == 'date') {
- $this->assertField($form_name . '[month]', 'Found month selection field');
- $this->assertField($form_name . '[day]', 'Found day selection field');
- $this->assertField($form_name . '[year]', 'Found day selection field');
+ $this->assertField($form_name . '[month]', t('Found month selection field'));
+ $this->assertField($form_name . '[day]', t('Found day selection field'));
+ $this->assertField($form_name . '[year]', t('Found day selection field'));
}
else {
- $this->assertField($form_name, 'Found form named ' . $form_name);
+ $this->assertField($form_name , t('Found form named @name', array('@name' => $form_name)));
}
// Checking name.
- $this->assertText($title, 'Checking title for field ' . $title);
+ $this->assertText($title, t('Checking title for field %title', array('%title' => $title)));
// Checking explanation.
- $this->assertText($edit['explanation'], 'Checking explanation for field ' . $title);
+ $this->assertText($edit['explanation'], t('Checking explanation for field %title', array('%title' => $title)));
return array(
'fid' => $fid,
@@ -92,18 +92,18 @@ class ProfileTestCase extends DrupalWebTestCase {
// Checking field.
if ($type == 'date') {
- $this->assertField($form_name . '[month]', 'Found month selection field');
- $this->assertField($form_name . '[day]', 'Found day selection field');
- $this->assertField($form_name . '[year]', 'Found day selection field');
+ $this->assertField($form_name . '[month]', t('Found month selection field'));
+ $this->assertField($form_name . '[day]', t('Found day selection field'));
+ $this->assertField($form_name . '[year]', t('Found day selection field'));
}
else {
- $this->assertField($form_name, 'Found form named ' . $form_name);
+ $this->assertField($form_name , t('Found form named @name', array('@name' => $form_name)));
}
// Checking name.
- $this->assertText($title, 'Checking title for field ' . $title);
+ $this->assertText($title, t('Checking title for field %title', array('%title' => $title)));
// Checking explanation.
- $this->assertText($edit['explanation'], 'Checking explanation for field ' . $title);
+ $this->assertText($edit['explanation'], t('Checking explanation for field %title', array('%title' => $title)));
return array(
'fid' => $fid,
@@ -137,11 +137,11 @@ class ProfileTestCase extends DrupalWebTestCase {
// Check profile page.
$content = $this->drupalGet('user/' . $this->normal_user->uid);
- $this->assertText($field['title'], 'Found profile field with title ' . $field['title']);
+ $this->assertText($field['title'], t('Found profile field with title %title', array('%title' => $field['title'])));
if ($field['type'] != 'checkbox') {
// $value must be cast to a string in order to be found by assertText.
- $this->assertText("$value", 'Found profile field with value ' . $value);
+ $this->assertText("$value", t('Found profile field with value %value', array('%value' => $value)));
}
return $value;
@@ -156,7 +156,7 @@ class ProfileTestCase extends DrupalWebTestCase {
function deleteProfileField($field) {
$this->drupalPost('admin/config/people/profile/delete/' . $field['fid'], array(), t('Delete'));
$this->drupalGet('admin/config/people/profile');
- $this->assertNoText($field['title'], 'Checking deleted field ' . $field['title']);
+ $this->assertNoText($field['title'], t('Checking deleted field %title', array('%title' => $field['title'])));
}
}
@@ -266,9 +266,9 @@ class ProfileTestDate extends ProfileTestCase {
// Check profile page.
$this->drupalGet('user/' . $this->normal_user->uid);
- $this->assertText($field['title'], 'Found profile field with title ' . $field['title']);
+ $this->assertText($field['title'], t('Found profile field with title %title', array('%title' => $field['title'])));
- $this->assertText('01/09/1983', 'Found date profile field.');
+ $this->assertText('01/09/1983', t('Found date profile field.'));
$edit = array(
'name' => $field['form_name'],
@@ -301,10 +301,10 @@ class ProfileTestWeights extends ProfileTestCase {
$this->setProfileField($field2, $this->randomName(8));
$profile_edit = $this->drupalGet('user/' . $this->normal_user->uid . '/edit/' . $category);
- $this->assertTrue(strpos($profile_edit, $field1['title']) > strpos($profile_edit, $field2['title']), 'Profile field weights are respected on the user edit form.');
+ $this->assertTrue(strpos($profile_edit, $field1['title']) > strpos($profile_edit, $field2['title']), t('Profile field weights are respected on the user edit form.'));
$profile_page = $this->drupalGet('user/' . $this->normal_user->uid);
- $this->assertTrue(strpos($profile_page, $field1['title']) > strpos($profile_page, $field2['title']), 'Profile field weights are respected on the user profile page.');
+ $this->assertTrue(strpos($profile_page, $field1['title']) > strpos($profile_page, $field2['title']), t('Profile field weights are respected on the user profile page.'));
}
}
@@ -340,15 +340,15 @@ class ProfileTestAutocomplete extends ProfileTestCase {
// Check that autocompletion html is found on the user's profile edit page.
$this->drupalGet('user/' . $this->admin_user->uid . '/edit/' . $category);
- $this->assertRaw($autocomplete_html, 'Autocomplete found.');
- $this->assertRaw('misc/autocomplete.js', 'Autocomplete JavaScript found.');
- $this->assertRaw('class="form-text form-autocomplete"', 'Autocomplete form element class found.');
+ $this->assertRaw($autocomplete_html, t('Autocomplete found.'));
+ $this->assertRaw('misc/autocomplete.js', t('Autocomplete JavaScript found.'));
+ $this->assertRaw('class="form-text form-autocomplete"', t('Autocomplete form element class found.'));
// Check the autocompletion path using the first letter of our user's profile
// field value to make sure access is allowed and a valid result if found.
$this->drupalGet('profile/autocomplete/' . $field['fid'] . '/' . $field['value'][0]);
- $this->assertResponse(200, 'Autocomplete path allowed to user with permission.');
- $this->assertRaw($field['value'], 'Autocomplete value found.');
+ $this->assertResponse(200, t('Autocomplete path allowed to user with permission.'));
+ $this->assertRaw($field['value'], t('Autocomplete value found.'));
// Logout and login with a user without the 'access user profiles' permission.
$this->drupalLogout();
@@ -356,11 +356,11 @@ class ProfileTestAutocomplete extends ProfileTestCase {
// Check that autocompletion html is not found on the user's profile edit page.
$this->drupalGet('user/' . $this->normal_user->uid . '/edit/' . $category);
- $this->assertNoRaw($autocomplete_html, 'Autocomplete not found.');
+ $this->assertNoRaw($autocomplete_html, t('Autocomplete not found.'));
// User should be denied access to the profile autocomplete path.
$this->drupalGet('profile/autocomplete/' . $field['fid'] . '/' . $field['value'][0]);
- $this->assertResponse(403, 'Autocomplete path denied to user without permission.');
+ $this->assertResponse(403, t('Autocomplete path denied to user without permission.'));
}
}
@@ -399,48 +399,48 @@ class ProfileBlockTestCase extends ProfileTestCase {
$edit = array();
$edit['profile_author-information[region]'] = 'footer';
$this->drupalPost('admin/structure/block', $edit, t('Save blocks'));
- $this->assertText(t('The block settings have been updated.'), 'Block successfully move to footer region.');
+ $this->assertText(t('The block settings have been updated.'), t('Block successfully move to footer region.'));
// Enable field 1.
$this->drupalPost('admin/structure/block/manage/profile/author-information/configure', array(
'profile_block_author_fields[' . $this->field1['form_name'] . ']' => TRUE,
), t('Save block'));
- $this->assertText(t('The block configuration has been saved.'), 'Block configuration set.');
+ $this->assertText(t('The block configuration has been saved.'), t('Block configuration set.'));
// Visit the node and confirm that the field is displayed.
$this->drupalGet('node/' . $this->node->nid);
- $this->assertRaw($this->value1, 'Field 1 is displayed');
- $this->assertNoRaw($this->value2, 'Field 2 is not displayed');
+ $this->assertRaw($this->value1, t('Field 1 is displayed'));
+ $this->assertNoRaw($this->value2, t('Field 2 is not displayed'));
// Enable only field 2.
$this->drupalPost('admin/structure/block/manage/profile/author-information/configure', array(
'profile_block_author_fields[' . $this->field1['form_name'] . ']' => FALSE,
'profile_block_author_fields[' . $this->field2['form_name'] . ']' => TRUE,
), t('Save block'));
- $this->assertText(t('The block configuration has been saved.'), 'Block configuration set.');
+ $this->assertText(t('The block configuration has been saved.'), t('Block configuration set.'));
// Visit the node and confirm that the field is displayed.
$this->drupalGet('node/' . $this->node->nid);
- $this->assertNoRaw($this->value1, 'Field 1 is not displayed');
- $this->assertRaw($this->value2, 'Field 2 is displayed');
+ $this->assertNoRaw($this->value1, t('Field 1 is not displayed'));
+ $this->assertRaw($this->value2, t('Field 2 is displayed'));
// Enable both fields.
$this->drupalPost('admin/structure/block/manage/profile/author-information/configure', array(
'profile_block_author_fields[' . $this->field1['form_name'] . ']' => TRUE,
'profile_block_author_fields[' . $this->field2['form_name'] . ']' => TRUE,
), t('Save block'));
- $this->assertText(t('The block configuration has been saved.'), 'Block configuration set.');
+ $this->assertText(t('The block configuration has been saved.'), t('Block configuration set.'));
// Visit the node and confirm that the field is displayed.
$this->drupalGet('node/' . $this->node->nid);
- $this->assertRaw($this->value1, 'Field 1 is displayed');
- $this->assertRaw($this->value2, 'Field 2 is displayed');
+ $this->assertRaw($this->value1, t('Field 1 is displayed'));
+ $this->assertRaw($this->value2, t('Field 2 is displayed'));
// Enable the link to the user profile.
$this->drupalPost('admin/structure/block/manage/profile/author-information/configure', array(
'profile_block_author_fields[user_profile]' => TRUE,
), t('Save block'));
- $this->assertText(t('The block configuration has been saved.'), 'Block configuration set.');
+ $this->assertText(t('The block configuration has been saved.'), t('Block configuration set.'));
// Visit the node and confirm that the user profile link is displayed.
$this->drupalGet('node/' . $this->node->nid);
@@ -477,10 +477,10 @@ class ProfileTestBrowsing extends ProfileTestCase {
}
}
-/**
- * TODO:
- * - Test field visibility
- * - Test required fields
- * - Test fields on registration form
- * - Test updating fields
- */
+ /**
+ * TODO:
+ * - Test field visibility
+ * - Test required fields
+ * - Test fields on registration form
+ * - Test updating fields
+ */
diff --git a/modules/rdf/rdf.test b/modules/rdf/rdf.test
index 82da0c272..137bb7c78 100644
--- a/modules/rdf/rdf.test
+++ b/modules/rdf/rdf.test
@@ -25,17 +25,17 @@ class RdfMappingHookTestCase extends DrupalWebTestCase {
function testMapping() {
// Test that the mapping is returned correctly by the hook.
$mapping = rdf_mapping_load('test_entity', 'test_bundle');
- $this->assertIdentical($mapping['rdftype'], array('sioc:Post'), 'Mapping for rdftype is sioc:Post.');
- $this->assertIdentical($mapping['title'], array('predicates' => array('dc:title')), 'Mapping for title is dc:title.');
+ $this->assertIdentical($mapping['rdftype'], array('sioc:Post'), t('Mapping for rdftype is sioc:Post.'));
+ $this->assertIdentical($mapping['title'], array('predicates' => array('dc:title')), t('Mapping for title is dc:title.'));
$this->assertIdentical($mapping['created'], array(
'predicates' => array('dc:created'),
'datatype' => 'xsd:dateTime',
'callback' => 'date_iso8601',
- ), 'Mapping for created is dc:created with datatype xsd:dateTime and callback date_iso8601.');
- $this->assertIdentical($mapping['uid'], array('predicates' => array('sioc:has_creator', 'dc:creator'), 'type' => 'rel'), 'Mapping for uid is sioc:has_creator and dc:creator, and type is rel.');
+ ), t('Mapping for created is dc:created with datatype xsd:dateTime and callback date_iso8601.'));
+ $this->assertIdentical($mapping['uid'], array('predicates' => array('sioc:has_creator', 'dc:creator'), 'type' => 'rel'), t('Mapping for uid is sioc:has_creator and dc:creator, and type is rel.'));
$mapping = rdf_mapping_load('test_entity', 'test_bundle_no_mapping');
- $this->assertEqual($mapping, array(), 'Empty array returned when an entity type, bundle pair has no mapping.');
+ $this->assertEqual($mapping, array(), t('Empty array returned when an entity type, bundle pair has no mapping.'));
}
}
@@ -180,13 +180,13 @@ class RdfRdfaMarkupTestCase extends DrupalWebTestCase {
$file_rel = $this->xpath('//div[contains(@about, :node-uri)]//div[contains(@rel, "rdfs:seeAlso") and contains(@resource, ".txt")]', array(
':node-uri' => 'node/' . $nid,
));
- $this->assertTrue(!empty($file_rel), 'Attribute \'rel\' set on file field. Attribute \'resource\' is also set.');
+ $this->assertTrue(!empty($file_rel), t('Attribute \'rel\' set on file field. Attribute \'resource\' is also set.'));
$image_rel = $this->xpath('//div[contains(@about, :node-uri)]//div[contains(@rel, "rdfs:seeAlso") and contains(@resource, :image)]//img[contains(@typeof, "foaf:Image")]', array(
':node-uri' => 'node/' . $nid,
':image' => $image_filename,
));
- $this->assertTrue(!empty($image_rel), 'Attribute \'rel\' set on image field. Attribute \'resource\' is also set.');
+ $this->assertTrue(!empty($image_rel), t('Attribute \'rel\' set on image field. Attribute \'resource\' is also set.'));
}
}
@@ -209,7 +209,7 @@ class RdfCrudTestCase extends DrupalWebTestCase {
function testCRUD() {
// Verify loading of a default mapping.
$mapping = _rdf_mapping_load('test_entity', 'test_bundle');
- $this->assertTrue(count($mapping), 'Default mapping was found.');
+ $this->assertTrue(count($mapping), t('Default mapping was found.'));
// Verify saving a mapping.
$mapping = array(
@@ -226,35 +226,35 @@ class RdfCrudTestCase extends DrupalWebTestCase {
),
),
);
- $this->assertTrue(rdf_mapping_save($mapping) === SAVED_NEW, 'Mapping was saved.');
+ $this->assertTrue(rdf_mapping_save($mapping) === SAVED_NEW, t('Mapping was saved.'));
// Read the raw record from the {rdf_mapping} table.
$result = db_query('SELECT * FROM {rdf_mapping} WHERE type = :type AND bundle = :bundle', array(':type' => $mapping['type'], ':bundle' => $mapping['bundle']));
$stored_mapping = $result->fetchAssoc();
$stored_mapping['mapping'] = unserialize($stored_mapping['mapping']);
- $this->assertEqual($mapping, $stored_mapping, 'Mapping was stored properly in the {rdf_mapping} table.');
+ $this->assertEqual($mapping, $stored_mapping, t('Mapping was stored properly in the {rdf_mapping} table.'));
// Verify loading of saved mapping.
- $this->assertEqual($mapping['mapping'], _rdf_mapping_load($mapping['type'], $mapping['bundle']), 'Saved mapping loaded successfully.');
+ $this->assertEqual($mapping['mapping'], _rdf_mapping_load($mapping['type'], $mapping['bundle']), t('Saved mapping loaded successfully.'));
// Verify updating of mapping.
$mapping['mapping']['title'] = array(
'predicates' => array('dc2:bar2'),
);
- $this->assertTrue(rdf_mapping_save($mapping) === SAVED_UPDATED, 'Mapping was updated.');
+ $this->assertTrue(rdf_mapping_save($mapping) === SAVED_UPDATED, t('Mapping was updated.'));
// Read the raw record from the {rdf_mapping} table.
$result = db_query('SELECT * FROM {rdf_mapping} WHERE type = :type AND bundle = :bundle', array(':type' => $mapping['type'], ':bundle' => $mapping['bundle']));
$stored_mapping = $result->fetchAssoc();
$stored_mapping['mapping'] = unserialize($stored_mapping['mapping']);
- $this->assertEqual($mapping, $stored_mapping, 'Updated mapping was stored properly in the {rdf_mapping} table.');
+ $this->assertEqual($mapping, $stored_mapping, t('Updated mapping was stored properly in the {rdf_mapping} table.'));
// Verify loading of saved mapping.
- $this->assertEqual($mapping['mapping'], _rdf_mapping_load($mapping['type'], $mapping['bundle']), 'Saved mapping loaded successfully.');
+ $this->assertEqual($mapping['mapping'], _rdf_mapping_load($mapping['type'], $mapping['bundle']), t('Saved mapping loaded successfully.'));
// Verify deleting of mapping.
- $this->assertTrue(rdf_mapping_delete($mapping['type'], $mapping['bundle']), 'Mapping was deleted.');
- $this->assertFalse(_rdf_mapping_load($mapping['type'], $mapping['bundle']), 'Deleted mapping is no longer found in the database.');
+ $this->assertTrue(rdf_mapping_delete($mapping['type'], $mapping['bundle']), t('Mapping was deleted.'));
+ $this->assertFalse(_rdf_mapping_load($mapping['type'], $mapping['bundle']), t('Deleted mapping is no longer found in the database.'));
}
}
@@ -285,8 +285,8 @@ class RdfMappingDefinitionTestCase extends TaxonomyWebTestCase {
// from the node default bundle definition.
$blog_title = $this->xpath("//meta[@property='dc:title' and @content='$node->title']");
$blog_meta = $this->xpath("//div[(@about='$url') and (@typeof='sioct:Weblog')]//span[contains(@property, 'dc:date') and contains(@property, 'dc:created') and @datatype='xsd:dateTime' and @content='$isoDate']");
- $this->assertTrue(!empty($blog_title), 'Property dc:title is present in meta tag.');
- $this->assertTrue(!empty($blog_meta), 'RDF type is present on post. Properties dc:date and dc:created are present on post date.');
+ $this->assertTrue(!empty($blog_title), t('Property dc:title is present in meta tag.'));
+ $this->assertTrue(!empty($blog_meta), t('RDF type is present on post. Properties dc:date and dc:created are present on post date.'));
}
/**
@@ -303,8 +303,8 @@ class RdfMappingDefinitionTestCase extends TaxonomyWebTestCase {
// Ensure the mapping defined in rdf_module.test is used.
$test_bundle_title = $this->xpath("//meta[@property='dc:title' and @content='$node->title']");
$test_bundle_meta = $this->xpath("//div[(@about='$url') and contains(@typeof, 'foo:mapping_install1') and contains(@typeof, 'bar:mapping_install2')]//span[contains(@property, 'dc:date') and contains(@property, 'dc:created') and @datatype='xsd:dateTime' and @content='$isoDate']");
- $this->assertTrue(!empty($test_bundle_title), 'Property dc:title is present in meta tag.');
- $this->assertTrue(!empty($test_bundle_meta), 'RDF type is present on post. Properties dc:date and dc:created are present on post date.');
+ $this->assertTrue(!empty($test_bundle_title), t('Property dc:title is present in meta tag.'));
+ $this->assertTrue(!empty($test_bundle_meta), t('RDF type is present on post. Properties dc:date and dc:created are present on post date.'));
}
/**
@@ -322,8 +322,8 @@ class RdfMappingDefinitionTestCase extends TaxonomyWebTestCase {
// from the node default bundle definition.
$random_bundle_title = $this->xpath("//meta[@property='dc:title' and @content='$node->title']");
$random_bundle_meta = $this->xpath("//div[(@about='$url') and contains(@typeof, 'sioc:Item') and contains(@typeof, 'foaf:Document')]//span[contains(@property, 'dc:date') and contains(@property, 'dc:created') and @datatype='xsd:dateTime' and @content='$isoDate']");
- $this->assertTrue(!empty($random_bundle_title), 'Property dc:title is present in meta tag.');
- $this->assertTrue(!empty($random_bundle_meta), 'RDF type is present on post. Properties dc:date and dc:created are present on post date.');
+ $this->assertTrue(!empty($random_bundle_title), t('Property dc:title is present in meta tag.'));
+ $this->assertTrue(!empty($random_bundle_meta), t('RDF type is present on post. Properties dc:date and dc:created are present on post date.'));
}
/**
@@ -345,19 +345,19 @@ class RdfMappingDefinitionTestCase extends TaxonomyWebTestCase {
$user2_profile_about = $this->xpath('//div[@class="profile" and @typeof="sioc:UserAccount" and @about=:account-uri]', array(
':account-uri' => $account_uri,
));
- $this->assertTrue(!empty($user2_profile_about), 'RDFa markup found on user profile page');
+ $this->assertTrue(!empty($user2_profile_about), t('RDFa markup found on user profile page'));
$user_account_holder = $this->xpath('//meta[contains(@typeof, "foaf:Person") and @about=:person-uri and @resource=:account-uri and contains(@rel, "foaf:account")]', array(
':person-uri' => $person_uri,
':account-uri' => $account_uri,
));
- $this->assertTrue(!empty($user_account_holder), 'URI created for account holder and username set on sioc:UserAccount.');
+ $this->assertTrue(!empty($user_account_holder), t('URI created for account holder and username set on sioc:UserAccount.'));
$user_username = $this->xpath('//meta[@about=:account-uri and contains(@property, "foaf:name") and @content=:username]', array(
':account-uri' => $account_uri,
':username' => $username,
));
- $this->assertTrue(!empty($user_username), 'foaf:name set on username.');
+ $this->assertTrue(!empty($user_username), t('foaf:name set on username.'));
// User 2 creates node.
$this->drupalLogin($user2);
@@ -369,7 +369,7 @@ class RdfMappingDefinitionTestCase extends TaxonomyWebTestCase {
$author_about = $this->xpath('//a[@typeof="sioc:UserAccount" and @about=:account-uri and @property="foaf:name" and contains(@xml:lang, "")]', array(
':account-uri' => $account_uri,
));
- $this->assertTrue(!empty($author_about), 'RDFa markup found on author information on post. xml:lang on username is set to empty string.');
+ $this->assertTrue(!empty($author_about), t('RDFa markup found on author information on post. xml:lang on username is set to empty string.'));
}
/**
@@ -387,7 +387,7 @@ class RdfMappingDefinitionTestCase extends TaxonomyWebTestCase {
':term-url' => $term_url,
':term-name' => $term_name,
));
- $this->assertTrue(!empty($term_rdfa_meta), 'RDFa markup found on term page.');
+ $this->assertTrue(!empty($term_rdfa_meta), t('RDFa markup found on term page.'));
}
}
@@ -439,15 +439,15 @@ class RdfCommentAttributesTestCase extends CommentHelperCase {
// Tests number of comments in teaser view.
$this->drupalGet('node');
$comment_count_teaser = $this->xpath('//div[contains(@typeof, "sioc:Item")]//li[contains(@class, "comment-comments")]/a[contains(@property, "sioc:num_replies") and contains(@content, "2") and @datatype="xsd:integer"]');
- $this->assertTrue(!empty($comment_count_teaser), 'RDFa markup for the number of comments found on teaser view.');
+ $this->assertTrue(!empty($comment_count_teaser), t('RDFa markup for the number of comments found on teaser view.'));
$comment_count_link = $this->xpath('//div[@about=:url]//a[contains(@property, "sioc:num_replies") and @rel=""]', array(':url' => url("node/{$this->node1->nid}")));
- $this->assertTrue(!empty($comment_count_link), 'Empty rel attribute found in comment count link.');
+ $this->assertTrue(!empty($comment_count_link), t('Empty rel attribute found in comment count link.'));
// Tests number of comments in full node view.
$this->drupalGet('node/' . $this->node1->nid);
$node_url = url('node/' . $this->node1->nid);
$comment_count_teaser = $this->xpath('/html/head/meta[@about=:node-url and @property="sioc:num_replies" and @content="2" and @datatype="xsd:integer"]', array(':node-url' => $node_url));
- $this->assertTrue(!empty($comment_count_teaser), 'RDFa markup for the number of comments found on full node view.');
+ $this->assertTrue(!empty($comment_count_teaser), t('RDFa markup for the number of comments found on full node view.'));
}
/**
@@ -485,10 +485,10 @@ class RdfCommentAttributesTestCase extends CommentHelperCase {
$this->_testBasicCommentRdfaMarkup($comment2, $anonymous_user);
// Tests the RDFa markup for the homepage (specific to anonymous comments).
$comment_homepage = $this->xpath('//div[contains(@class, "comment") and contains(@typeof, "sioct:Comment")]//span[@rel="sioc:has_creator"]/a[contains(@class, "username") and @typeof="sioc:UserAccount" and @property="foaf:name" and @href="http://example.org/" and contains(@rel, "foaf:page")]');
- $this->assertTrue(!empty($comment_homepage), 'RDFa markup for the homepage of anonymous user found.');
+ $this->assertTrue(!empty($comment_homepage), t('RDFa markup for the homepage of anonymous user found.'));
// There should be no about attribute on anonymous comments.
$comment_homepage = $this->xpath('//div[contains(@class, "comment") and contains(@typeof, "sioct:Comment")]//span[@rel="sioc:has_creator"]/a[@about]');
- $this->assertTrue(empty($comment_homepage), 'No about attribute is present on anonymous user comment.');
+ $this->assertTrue(empty($comment_homepage), t('No about attribute is present on anonymous user comment.'));
// Tests comment #2 as logged in user.
$this->drupalLogin($this->web_user);
@@ -496,10 +496,10 @@ class RdfCommentAttributesTestCase extends CommentHelperCase {
$this->_testBasicCommentRdfaMarkup($comment2, $anonymous_user);
// Tests the RDFa markup for the homepage (specific to anonymous comments).
$comment_homepage = $this->xpath('//div[contains(@class, "comment") and contains(@typeof, "sioct:Comment")]//span[@rel="sioc:has_creator"]/a[contains(@class, "username") and @typeof="sioc:UserAccount" and @property="foaf:name" and @href="http://example.org/" and contains(@rel, "foaf:page")]');
- $this->assertTrue(!empty($comment_homepage), "RDFa markup for the homepage of anonymous user found.");
+ $this->assertTrue(!empty($comment_homepage), t("RDFa markup for the homepage of anonymous user found."));
// There should be no about attribute on anonymous comments.
$comment_homepage = $this->xpath('//div[contains(@class, "comment") and contains(@typeof, "sioct:Comment")]//span[@rel="sioc:has_creator"]/a[@about]');
- $this->assertTrue(empty($comment_homepage), "No about attribute is present on anonymous user comment.");
+ $this->assertTrue(empty($comment_homepage), t("No about attribute is present on anonymous user comment."));
}
/**
@@ -512,9 +512,9 @@ class RdfCommentAttributesTestCase extends CommentHelperCase {
// Tests the reply_of relationship of a first level comment.
$result = $this->xpath("id('comments')//div[@class='comment' and position()=0]//span[@rel='sioc:reply_of' and @resource=:node]", array(':node' => url("node/{$this->node1->nid}")));
- $this->assertEqual(1, count($result), 'RDFa markup referring to the node is present.');
+ $this->assertEqual(1, count($result), t('RDFa markup referring to the node is present.'));
$result = $this->xpath("id('comments')//div[@class='comment' and position()=0]//span[@rel='sioc:reply_of' and @resource=:comment]", array(':comment' => url('comment/1#comment-1')));
- $this->assertFalse($result, 'No RDFa markup referring to the comment itself is present.');
+ $this->assertFalse($result, t('No RDFa markup referring to the comment itself is present.'));
// Posts a reply to the first comment.
$this->drupalGet('comment/reply/' . $this->node1->nid . '/' . $comments[0]->id);
@@ -522,9 +522,9 @@ class RdfCommentAttributesTestCase extends CommentHelperCase {
// Tests the reply_of relationship of a second level comment.
$result = $this->xpath("id('comments')//div[@class='comment' and position()=1]//span[@rel='sioc:reply_of' and @resource=:node]", array(':node' => url("node/{$this->node1->nid}")));
- $this->assertEqual(1, count($result), 'RDFa markup referring to the node is present.');
+ $this->assertEqual(1, count($result), t('RDFa markup referring to the node is present.'));
$result = $this->xpath("id('comments')//div[@class='comment' and position()=1]//span[@rel='sioc:reply_of' and @resource=:comment]", array(':comment' => url('comment/1#comment-1')));
- $this->assertEqual(1, count($result), 'RDFa markup referring to the parent comment is present.');
+ $this->assertEqual(1, count($result), t('RDFa markup referring to the parent comment is present.'));
}
/**
@@ -539,17 +539,17 @@ class RdfCommentAttributesTestCase extends CommentHelperCase {
*/
function _testBasicCommentRdfaMarkup($comment, $account = array()) {
$comment_container = $this->xpath('//div[contains(@class, "comment") and contains(@typeof, "sioct:Comment")]');
- $this->assertTrue(!empty($comment_container), "Comment RDF type for comment found.");
+ $this->assertTrue(!empty($comment_container), t("Comment RDF type for comment found."));
$comment_title = $this->xpath('//div[contains(@class, "comment") and contains(@typeof, "sioct:Comment")]//h3[@property="dc:title"]');
- $this->assertEqual((string) $comment_title[0]->a, $comment->subject, "RDFa markup for the comment title found.");
+ $this->assertEqual((string)$comment_title[0]->a, $comment->subject, t("RDFa markup for the comment title found."));
$comment_date = $this->xpath('//div[contains(@class, "comment") and contains(@typeof, "sioct:Comment")]//*[contains(@property, "dc:date") and contains(@property, "dc:created")]');
- $this->assertTrue(!empty($comment_date), "RDFa markup for the date of the comment found.");
+ $this->assertTrue(!empty($comment_date), t("RDFa markup for the date of the comment found."));
// The author tag can be either a or span
$comment_author = $this->xpath('//div[contains(@class, "comment") and contains(@typeof, "sioct:Comment")]//span[@rel="sioc:has_creator"]/*[contains(@class, "username") and @typeof="sioc:UserAccount" and @property="foaf:name"]');
$name = empty($account["name"]) ? $this->web_user->name : $account["name"] . " (not verified)";
- $this->assertEqual((string) $comment_author[0], $name, "RDFa markup for the comment author found.");
+ $this->assertEqual((string)$comment_author[0], $name, t("RDFa markup for the comment author found."));
$comment_body = $this->xpath('//div[contains(@class, "comment") and contains(@typeof, "sioct:Comment")]//div[@class="content"]//div[contains(@class, "comment-body")]//div[@property="content:encoded"]');
- $this->assertEqual((string) $comment_body[0]->p, $comment->comment, "RDFa markup for the comment body found.");
+ $this->assertEqual((string)$comment_body[0]->p, $comment->comment, t("RDFa markup for the comment body found."));
}
}
@@ -610,35 +610,35 @@ class RdfTrackerAttributesTestCase extends DrupalWebTestCase {
// success of the following tests, but making it explicit will make
// debugging easier in case of failure.
$tracker_about = $this->xpath('//tr[@about=:url]', array(':url' => $url));
- $this->assertTrue(!empty($tracker_about), 'About attribute found on table row for ' . $user . ' content.');
+ $this->assertTrue(!empty($tracker_about), t('About attribute found on table row for @user content.', array('@user'=> $user)));
// Tests whether the title has the correct property attribute.
$tracker_title = $this->xpath('//tr[@about=:url]/td[@property="dc:title" and @datatype=""]', array(':url' => $url));
- $this->assertTrue(!empty($tracker_title), 'Title property attribute found on ' . $user . ' content.');
+ $this->assertTrue(!empty($tracker_title), t('Title property attribute found on @user content.', array('@user'=> $user)));
// Tests whether the relationship between the content and user has been set.
$tracker_user = $this->xpath('//tr[@about=:url]//td[contains(@rel, "sioc:has_creator")]//*[contains(@typeof, "sioc:UserAccount") and contains(@property, "foaf:name")]', array(':url' => $url));
- $this->assertTrue(!empty($tracker_user), 'Typeof and name property attributes found on ' . $user . '.');
+ $this->assertTrue(!empty($tracker_user), t('Typeof and name property attributes found on @user.', array('@user'=> $user)));
// There should be an about attribute on logged in users and no about
// attribute for anonymous users.
$tracker_user = $this->xpath('//tr[@about=:url]//td[@rel="sioc:has_creator"]/*[@about]', array(':url' => $url));
if ($node->uid == 0) {
- $this->assertTrue(empty($tracker_user), 'No about attribute is present on ' . $user . '.');
+ $this->assertTrue(empty($tracker_user), t('No about attribute is present on @user.', array('@user'=> $user)));
}
elseif ($node->uid > 0) {
- $this->assertTrue(!empty($tracker_user), 'About attribute is present on ' . $user . '.');
+ $this->assertTrue(!empty($tracker_user), t('About attribute is present on @user.', array('@user'=> $user)));
}
// Tests whether the property has been set for number of comments.
$tracker_replies = $this->xpath('//tr[@about=:url]//td[contains(@property, "sioc:num_replies") and contains(@content, "0") and @datatype="xsd:integer"]', array(':url' => $url));
- $this->assertTrue($tracker_replies, 'Num replies property and content attributes found on ' . $user . ' content.');
+ $this->assertTrue($tracker_replies, t('Num replies property and content attributes found on @user content.', array('@user'=> $user)));
// Tests that the appropriate RDFa markup to annotate the latest activity
// date has been added to the tracker output before comments have been
// posted, meaning the latest activity reflects changes to the node itself.
$isoDate = date('c', $node->changed);
$tracker_activity = $this->xpath('//tr[@about=:url]//td[contains(@property, "dc:modified") and contains(@property, "sioc:last_activity_date") and contains(@datatype, "xsd:dateTime") and @content=:date]', array(':url' => $url, ':date' => $isoDate));
- $this->assertTrue(!empty($tracker_activity), 'Latest activity date and changed properties found when there are no comments on ' . $user . ' content. Latest activity date content is correct.');
+ $this->assertTrue(!empty($tracker_activity), t('Latest activity date and changed properties found when there are no comments on @user content. Latest activity date content is correct.', array('@user'=> $user)));
// Tests that the appropriate RDFa markup to annotate the latest activity
// date has been added to the tracker output after a comment is posted.
@@ -651,7 +651,7 @@ class RdfTrackerAttributesTestCase extends DrupalWebTestCase {
// Tests whether the property has been set for number of comments.
$tracker_replies = $this->xpath('//tr[@about=:url]//td[contains(@property, "sioc:num_replies") and contains(@content, "1") and @datatype="xsd:integer"]', array(':url' => $url));
- $this->assertTrue($tracker_replies, 'Num replies property and content attributes found on ' . $user . ' content.');
+ $this->assertTrue($tracker_replies, t('Num replies property and content attributes found on @user content.', array('@user'=> $user)));
// Need to query database directly to obtain last_activity_date because
// it cannot be accessed via node_load().
@@ -661,7 +661,7 @@ class RdfTrackerAttributesTestCase extends DrupalWebTestCase {
}
$isoDate = date('c', $expected_last_activity_date);
$tracker_activity = $this->xpath('//tr[@about=:url]//td[@property="sioc:last_activity_date" and @datatype="xsd:dateTime" and @content=:date]', array(':url' => $url, ':date' => $isoDate));
- $this->assertTrue(!empty($tracker_activity), 'Latest activity date found when there are comments on ' . $user . ' content. Latest activity date content is correct.');
+ $this->assertTrue(!empty($tracker_activity), t('Latest activity date found when there are comments on @user content. Latest activity date content is correct.', array('@user'=> $user)));
}
}
@@ -688,9 +688,9 @@ class RdfGetRdfNamespacesTestCase extends DrupalWebTestCase {
// Get all RDF namespaces.
$ns = rdf_get_namespaces();
- $this->assertEqual($ns['owl'], 'http://www.w3.org/2002/07/owl#', 'A prefix declared once is included.');
- $this->assertEqual($ns['foaf'], 'http://xmlns.com/foaf/0.1/', 'The same prefix declared in several implementations of hook_rdf_namespaces() is valid as long as all the namespaces are the same.');
- $this->assertEqual($ns['foaf1'], 'http://xmlns.com/foaf/0.1/', 'Two prefixes can be assigned the same namespace.');
- $this->assertTrue(!isset($ns['dc']), 'A prefix with conflicting namespaces is discarded.');
+ $this->assertEqual($ns['owl'], 'http://www.w3.org/2002/07/owl#', t('A prefix declared once is included.'));
+ $this->assertEqual($ns['foaf'], 'http://xmlns.com/foaf/0.1/', t('The same prefix declared in several implementations of hook_rdf_namespaces() is valid as long as all the namespaces are the same.'));
+ $this->assertEqual($ns['foaf1'], 'http://xmlns.com/foaf/0.1/', t('Two prefixes can be assigned the same namespace.'));
+ $this->assertTrue(!isset($ns['dc']), t('A prefix with conflicting namespaces is discarded.'));
}
}
diff --git a/modules/search/search.test b/modules/search/search.test
index 8f7a1ca7d..9079326a1 100644
--- a/modules/search/search.test
+++ b/modules/search/search.test
@@ -91,14 +91,14 @@ class SearchMatchTestCase extends DrupalWebTestCase {
*/
function _testQueries() {
/*
- Note: OR queries that include short words in OR groups are only accepted
- if the ORed terms are ANDed with at least one long word in the rest of the query.
+ Note: OR queries that include short words in OR groups are only accepted
+ if the ORed terms are ANDed with at least one long word in the rest of the query.
- e.g. enim dolore OR ut = enim (dolore OR ut) = (enim dolor) OR (enim ut) -> good
- e.g. dolore OR ut = (dolore) OR (ut) -> bad
+ e.g. enim dolore OR ut = enim (dolore OR ut) = (enim dolor) OR (enim ut) -> good
+ e.g. dolore OR ut = (dolore) OR (ut) -> bad
- This is a design limitation to avoid full table scans.
- */
+ This is a design limitation to avoid full table scans.
+ */
$queries = array(
// Simple AND queries.
'ipsum' => array(1),
@@ -262,7 +262,7 @@ class SearchBikeShed extends DrupalWebTestCase {
$edit = array();
$edit['keys'] = 'bike shed ' . $this->randomName();
$this->drupalPost('search/node', $edit, t('Search'));
- $this->assertText(t('Consider loosening your query with OR. bike OR shed will often show more results than bike shed.'), 'Help text is displayed when search returns no results.');
+ $this->assertText(t('Consider loosening your query with OR. bike OR shed will often show more results than bike shed.'), t('Help text is displayed when search returns no results.'));
}
}
@@ -301,31 +301,31 @@ class SearchAdvancedSearchForm extends DrupalWebTestCase {
* Test using the advanced search form to limit search to nodes of type "Basic page".
*/
function testNodeType() {
- $this->assertTrue($this->node->type == 'page', 'Node type is Basic page.');
+ $this->assertTrue($this->node->type == 'page', t('Node type is Basic page.'));
// Assert that the dummy title doesn't equal the real title.
$dummy_title = 'Lorem ipsum';
- $this->assertNotEqual($dummy_title, $this->node->title, "Dummy title doens't equal node title");
+ $this->assertNotEqual($dummy_title, $this->node->title, t("Dummy title doens't equal node title"));
// Search for the dummy title with a GET query.
$this->drupalGet('search/node/' . $dummy_title);
- $this->assertNoText($this->node->title, 'Basic page node is not found with dummy title.');
+ $this->assertNoText($this->node->title, t('Basic page node is not found with dummy title.'));
// Search for the title of the node with a GET query.
$this->drupalGet('search/node/' . $this->node->title);
- $this->assertText($this->node->title, 'Basic page node is found with GET query.');
+ $this->assertText($this->node->title, t('Basic page node is found with GET query.'));
// Search for the title of the node with a POST query.
$edit = array('or' => $this->node->title);
$this->drupalPost('search/node', $edit, t('Advanced search'));
- $this->assertText($this->node->title, 'Basic page node is found with POST query.');
+ $this->assertText($this->node->title, t('Basic page node is found with POST query.'));
// Advanced search type option.
$this->drupalPost('search/node', array_merge($edit, array('type[page]' => 'page')), t('Advanced search'));
- $this->assertText($this->node->title, 'Basic page node is found with POST query and type:page.');
+ $this->assertText($this->node->title, t('Basic page node is found with POST query and type:page.'));
$this->drupalPost('search/node', array_merge($edit, array('type[article]' => 'article')), t('Advanced search'));
- $this->assertText('bike shed', 'Article node is not found with POST query and type:article.');
+ $this->assertText('bike shed', t('Article node is not found with POST query and type:article.'));
}
}
@@ -396,7 +396,7 @@ class SearchRankingTestCase extends DrupalWebTestCase {
variable_set('statistics_count_content_views', 1);
// Then View one of the nodes a bunch of times.
- for ($i = 0; $i < 5; $i++) {
+ for ($i = 0; $i < 5; $i ++) {
$this->drupalGet('node/' . $nodes['views'][1]->nid);
}
@@ -419,7 +419,7 @@ class SearchRankingTestCase extends DrupalWebTestCase {
function testHTMLRankings() {
// Login with sufficient privileges.
$this->drupalLogin($this->drupalCreateUser(array('create page content')));
-
+
// Test HTML tags with different weights.
$sorted_tags = array('h1', 'h2', 'h3', 'h4', 'a', 'h5', 'h6', 'notag');
$shuffled_tags = $sorted_tags;
@@ -451,7 +451,7 @@ class SearchRankingTestCase extends DrupalWebTestCase {
// Refresh variables after the treatment.
$this->refreshVariables();
-
+
// Disable all other rankings.
$node_ranks = array('sticky', 'promote', 'recent', 'comments', 'views');
foreach ($node_ranks as $node_rank) {
@@ -464,8 +464,7 @@ class SearchRankingTestCase extends DrupalWebTestCase {
// Assert the results.
if ($tag == 'notag') {
$this->assertEqual($set[$tag_rank]['node']->nid, $nodes[$tag]->nid, 'Search tag ranking for plain text order.');
- }
- else {
+ } else {
$this->assertEqual($set[$tag_rank]['node']->nid, $nodes[$tag]->nid, 'Search tag ranking for "&lt;' . $sorted_tags[$tag_rank] . '&gt;" order.');
}
}
@@ -490,7 +489,7 @@ class SearchRankingTestCase extends DrupalWebTestCase {
// Assert the results.
$this->assertEqual($set[0]['node']->nid, $node->nid, 'Search tag ranking for "&lt;' . $tag . '&gt;" order.');
-
+
// Delete node so it doesn't show up in subsequent search results.
node_delete($node->nid);
}
@@ -507,8 +506,8 @@ class SearchRankingTestCase extends DrupalWebTestCase {
// See testRankings() above - build a node that will rank high for sticky.
$settings = array(
- 'type' => 'page',
- 'title' => array(LANGUAGE_NONE => array(array('value' => 'Drupal rocks'))),
+ 'type' => 'page',
+ 'title' => array(LANGUAGE_NONE => array(array('value' => 'Drupal rocks'))),
'body' => array(LANGUAGE_NONE => array(array('value' => "Drupal's search rocks"))),
'sticky' => 1,
);
@@ -556,13 +555,13 @@ class SearchBlockTestCase extends DrupalWebTestCase {
function testSearchFormBlock() {
// Set block title to confirm that the interface is availble.
$this->drupalPost('admin/structure/block/manage/search/form/configure', array('title' => $this->randomName(8)), t('Save block'));
- $this->assertText(t('The block configuration has been saved.'), 'Block configuration set.');
+ $this->assertText(t('The block configuration has been saved.'), t('Block configuration set.'));
// Set the block to a region to confirm block is availble.
$edit = array();
$edit['search_form[region]'] = 'footer';
$this->drupalPost('admin/structure/block', $edit, t('Save blocks'));
- $this->assertText(t('The block settings have been updated.'), 'Block successfully move to footer region.');
+ $this->assertText(t('The block settings have been updated.'), t('Block successfully move to footer region.'));
}
/**
@@ -727,20 +726,20 @@ class SearchCommentTestCase extends DrupalWebTestCase {
'search_block_form' => "'" . $edit_comment['subject'] . "'",
);
$this->drupalPost('', $edit, t('Search'));
- $this->assertText($node->title, 'Node found in search results.');
- $this->assertText($edit_comment['subject'], 'Comment subject found in search results.');
+ $this->assertText($node->title, t('Node found in search results.'));
+ $this->assertText($edit_comment['subject'], t('Comment subject found in search results.'));
// Search for the comment body.
$edit = array(
'search_block_form' => "'" . $comment_body . "'",
);
$this->drupalPost('', $edit, t('Search'));
- $this->assertText($node->title, 'Node found in search results.');
+ $this->assertText($node->title, t('Node found in search results.'));
// Verify that comment is rendered using proper format.
- $this->assertText($comment_body, 'Comment body text found in search results.');
- $this->assertNoRaw(t('n/a'), 'HTML in comment body is not hidden.');
- $this->assertNoRaw(check_plain($edit_comment['comment_body[' . LANGUAGE_NONE . '][0][value]']), 'HTML in comment body is not escaped.');
+ $this->assertText($comment_body, t('Comment body text found in search results.'));
+ $this->assertNoRaw(t('n/a'), t('HTML in comment body is not hidden.'));
+ $this->assertNoRaw(check_plain($edit_comment['comment_body[' . LANGUAGE_NONE . '][0][value]']), t('HTML in comment body is not escaped.'));
// Hide comments.
$this->drupalLogin($this->admin_user);
@@ -753,7 +752,7 @@ class SearchCommentTestCase extends DrupalWebTestCase {
// Search for $title.
$this->drupalPost('', $edit, t('Search'));
- $this->assertNoText($comment_body, 'Comment body text not found in search results.');
+ $this->assertNoText($comment_body, t('Comment body text not found in search results.'));
}
/**
@@ -812,7 +811,7 @@ class SearchCommentTestCase extends DrupalWebTestCase {
$this->setRolePermissions(DRUPAL_AUTHENTICATED_RID, TRUE, TRUE);
$this->setRolePermissions($this->admin_role, TRUE, FALSE);
$this->checkCommentAccess('Admin user has access comments permission and no search permission, but comments should be indexed because admin user inherits authenticated user\'s permission to search', TRUE);
-
+
}
/**
@@ -849,9 +848,9 @@ class SearchCommentTestCase extends DrupalWebTestCase {
/**
* Tests that comment count display toggles properly on comment status of node
- *
+ *
* Issue 537278
- *
+ *
* - Nodes with comment status set to Open should always how comment counts
* - Nodes with comment status set to Closed should show comment counts
* only when there are comments
@@ -860,7 +859,7 @@ class SearchCommentTestCase extends DrupalWebTestCase {
class SearchCommentCountToggleTestCase extends DrupalWebTestCase {
protected $searching_user;
protected $searchable_nodes;
-
+
public static function getInfo() {
return array(
'name' => 'Comment count toggle',
@@ -877,23 +876,23 @@ class SearchCommentCountToggleTestCase extends DrupalWebTestCase {
// Create initial nodes.
$node_params = array('type' => 'article', 'body' => array(LANGUAGE_NONE => array(array('value' => 'SearchCommentToggleTestCase'))));
-
+
$this->searchable_nodes['1 comment'] = $this->drupalCreateNode($node_params);
$this->searchable_nodes['0 comments'] = $this->drupalCreateNode($node_params);
-
+
// Login with sufficient privileges.
$this->drupalLogin($this->searching_user);
-
+
// Create a comment array
$edit_comment = array();
$edit_comment['subject'] = $this->randomName();
$edit_comment['comment_body[' . LANGUAGE_NONE . '][0][value]'] = $this->randomName();
$filtered_html_format_id = db_query_range('SELECT format FROM {filter_format} WHERE name = :name', 0, 1, array(':name' => 'Filtered HTML'))->fetchField();
$edit_comment['comment_body[' . LANGUAGE_NONE . '][0][format]'] = $filtered_html_format_id;
-
+
// Post comment to the test node with comment
$this->drupalPost('comment/reply/' . $this->searchable_nodes['1 comment']->nid, $edit_comment, t('Save'));
-
+
// First update the index. This does the initial processing.
node_update_index();
@@ -914,28 +913,28 @@ class SearchCommentCountToggleTestCase extends DrupalWebTestCase {
// Test comment count display for nodes with comment status set to Open
$this->drupalPost('', $edit, t('Search'));
- $this->assertText(t('0 comments'), 'Empty comment count displays for nodes with comment status set to Open');
- $this->assertText(t('1 comment'), 'Non-empty comment count displays for nodes with comment status set to Open');
-
+ $this->assertText(t('0 comments'), t('Empty comment count displays for nodes with comment status set to Open'));
+ $this->assertText(t('1 comment'), t('Non-empty comment count displays for nodes with comment status set to Open'));
+
// Test comment count display for nodes with comment status set to Closed
$this->searchable_nodes['0 comments']->comment = COMMENT_NODE_CLOSED;
node_save($this->searchable_nodes['0 comments']);
$this->searchable_nodes['1 comment']->comment = COMMENT_NODE_CLOSED;
node_save($this->searchable_nodes['1 comment']);
-
+
$this->drupalPost('', $edit, t('Search'));
- $this->assertNoText(t('0 comments'), 'Empty comment count does not display for nodes with comment status set to Closed');
- $this->assertText(t('1 comment'), 'Non-empty comment count displays for nodes with comment status set to Closed');
+ $this->assertNoText(t('0 comments'), t('Empty comment count does not display for nodes with comment status set to Closed'));
+ $this->assertText(t('1 comment'), t('Non-empty comment count displays for nodes with comment status set to Closed'));
// Test comment count display for nodes with comment status set to Hidden
$this->searchable_nodes['0 comments']->comment = COMMENT_NODE_HIDDEN;
node_save($this->searchable_nodes['0 comments']);
$this->searchable_nodes['1 comment']->comment = COMMENT_NODE_HIDDEN;
- node_save($this->searchable_nodes['1 comment']);
-
+ node_save($this->searchable_nodes['1 comment']);
+
$this->drupalPost('', $edit, t('Search'));
- $this->assertNoText(t('0 comments'), 'Empty comment count does not display for nodes with comment status set to Hidden');
- $this->assertNoText(t('1 comment'), 'Non-empty comment count does not display for nodes with comment status set to Hidden');
+ $this->assertNoText(t('0 comments'), t('Empty comment count does not display for nodes with comment status set to Hidden'));
+ $this->assertNoText(t('1 comment'), t('Non-empty comment count does not display for nodes with comment status set to Hidden'));
}
}
@@ -968,7 +967,7 @@ class SearchSimplifyTestCase extends DrupalWebTestCase {
$string .= chr($i);
}
// Diff really does not like files starting with \0 so test it separately.
- $this->assertIdentical(' ', search_simplify($string), 'Search simplify works for ASCII control characters.');
+ $this->assertIdentical(' ', search_simplify($string), t('Search simplify works for ASCII control characters.'));
}
/**
diff --git a/modules/shortcut/shortcut.test b/modules/shortcut/shortcut.test
index 7c64083d1..34ae06183 100644
--- a/modules/shortcut/shortcut.test
+++ b/modules/shortcut/shortcut.test
@@ -74,7 +74,7 @@ class ShortcutTestCase extends DrupalWebTestCase {
/**
* Extracts information from shortcut set links.
- *
+ *
* @param object $set
* The shortcut set object to extract information from.
* @param string $key
@@ -131,7 +131,7 @@ class ShortcutLinksTestCase extends ShortcutTestCase {
$this->assertResponse(200);
$saved_set = shortcut_set_load($set->set_name);
$paths = $this->getShortcutInformation($saved_set, 'link_path');
- $this->assertTrue(in_array($test['path'], $paths), 'Shortcut created: ' . $test['path']);
+ $this->assertTrue(in_array($test['path'], $paths), 'Shortcut created: '. $test['path']);
$this->assertLink($title, 0, 'Shortcut link found on the page.');
}
}
@@ -283,7 +283,7 @@ class ShortcutSetsTestCase extends ShortcutTestCase {
*/
function testShortcutSetRename() {
$set = $this->set;
-
+
$new_title = $this->randomName(10);
$this->drupalPost('admin/config/user-interface/shortcut/' . $set->set_name . '/edit', array('title' => $new_title), t('Save'));
$set = shortcut_set_load($set->set_name);
@@ -299,7 +299,7 @@ class ShortcutSetsTestCase extends ShortcutTestCase {
$this->drupalPost('admin/config/user-interface/shortcut/' . $set->set_name . '/edit', array('title' => $existing_title), t('Save'));
$this->assertRaw(t('The shortcut set %name already exists. Choose another name.', array('%name' => $existing_title)));
$set = shortcut_set_load($set->set_name);
- $this->assertNotEqual($set->title, $existing_title, 'The shortcut set ' . $set->title . ' cannot be renamed to ' . $existing_title . ' because a shortcut set with that title already exists.');
+ $this->assertNotEqual($set->title, $existing_title, t('The shortcut set %title cannot be renamed to %new-title because a shortcut set with that title already exists.', array('%title' => $set->title, '%new-title' => $existing_title)));
}
/**
diff --git a/modules/simpletest/tests/actions.test b/modules/simpletest/tests/actions.test
index 5d279daa7..8e0220d4f 100644
--- a/modules/simpletest/tests/actions.test
+++ b/modules/simpletest/tests/actions.test
@@ -32,8 +32,8 @@ class ActionsConfigurationTestCase extends DrupalWebTestCase {
$this->drupalPost('admin/config/system/actions/configure/' . drupal_hash_base64('system_goto_action'), $edit, t('Save'));
// Make sure that the new complex action was saved properly.
- $this->assertText(t('The action has been successfully saved.'), "Make sure we get a confirmation that we've successfully saved the complex action.");
- $this->assertText($action_label, "Make sure the action label appears on the configuration page after we've saved the complex action.");
+ $this->assertText(t('The action has been successfully saved.'), t("Make sure we get a confirmation that we've successfully saved the complex action."));
+ $this->assertText($action_label, t("Make sure the action label appears on the configuration page after we've saved the complex action."));
// Make another POST request to the action edit page.
$this->clickLink(t('configure'));
@@ -46,9 +46,9 @@ class ActionsConfigurationTestCase extends DrupalWebTestCase {
$this->drupalPost(NULL, $edit, t('Save'));
// Make sure that the action updated properly.
- $this->assertText(t('The action has been successfully saved.'), "Make sure we get a confirmation that we've successfully updated the complex action.");
- $this->assertNoText($action_label, "Make sure the old action label does NOT appear on the configuration page after we've updated the complex action.");
- $this->assertText($new_action_label, "Make sure the action label appears on the configuration page after we've updated the complex action.");
+ $this->assertText(t('The action has been successfully saved.'), t("Make sure we get a confirmation that we've successfully updated the complex action."));
+ $this->assertNoText($action_label, t("Make sure the old action label does NOT appear on the configuration page after we've updated the complex action."));
+ $this->assertText($new_action_label, t("Make sure the action label appears on the configuration page after we've updated the complex action."));
// Make sure that deletions work properly.
$this->clickLink(t('delete'));
@@ -56,11 +56,11 @@ class ActionsConfigurationTestCase extends DrupalWebTestCase {
$this->drupalPost("admin/config/system/actions/delete/$aid", $edit, t('Delete'));
// Make sure that the action was actually deleted.
- $this->assertRaw(t('Action %action was deleted', array('%action' => $new_action_label)), 'Make sure that we get a delete confirmation message.');
+ $this->assertRaw(t('Action %action was deleted', array('%action' => $new_action_label)), t('Make sure that we get a delete confirmation message.'));
$this->drupalGet('admin/config/system/actions/manage');
- $this->assertNoText($new_action_label, "Make sure the action label does not appear on the overview page after we've deleted the action.");
+ $this->assertNoText($new_action_label, t("Make sure the action label does not appear on the overview page after we've deleted the action."));
$exists = db_query('SELECT aid FROM {actions} WHERE callback = :callback', array(':callback' => 'drupal_goto_action'))->fetchField();
- $this->assertFalse($exists, 'Make sure the action is gone from the database after being deleted.');
+ $this->assertFalse($exists, t('Make sure the action is gone from the database after being deleted.'));
}
}
@@ -120,8 +120,8 @@ class ActionLoopTestCase extends DrupalWebTestCase {
$loop_started = FALSE;
foreach ($result as $row) {
$expected_message = array_shift($expected);
- $this->assertEqual($row->message, $expected_message, 'Expected message ' . $expected_message . ', got ' . $row->message . '.');
+ $this->assertEqual($row->message, $expected_message, t('Expected message %expected, got %message.', array('%expected' => $expected_message, '%message' => $row->message)));
}
- $this->assertTrue(empty($expected), 'All expected messages found.');
+ $this->assertTrue(empty($expected), t('All expected messages found.'));
}
}
diff --git a/modules/simpletest/tests/ajax.test b/modules/simpletest/tests/ajax.test
index e711eec37..91572bda0 100644
--- a/modules/simpletest/tests/ajax.test
+++ b/modules/simpletest/tests/ajax.test
@@ -44,9 +44,9 @@ class AJAXFrameworkTestCase extends AJAXTestCase {
function testAJAXRender() {
$result = $this->drupalGetAJAX('ajax-test/render');
// Verify that JavaScript settings are contained (always first).
- $this->assertIdentical($result[0]['command'], 'settings', 'drupal_add_js() settings are contained first.');
+ $this->assertIdentical($result[0]['command'], 'settings', t('drupal_add_js() settings are contained first.'));
// Verify that basePath is contained in JavaScript settings.
- $this->assertEqual($result[0]['settings']['basePath'], base_path(), 'Base path is contained in JavaScript settings.');
+ $this->assertEqual($result[0]['settings']['basePath'], base_path(), t('Base path is contained in JavaScript settings.'));
}
/**
@@ -55,14 +55,14 @@ class AJAXFrameworkTestCase extends AJAXTestCase {
function testAJAXRenderError() {
$result = $this->discardSettings($this->drupalGetAJAX('ajax-test/render-error'));
// Verify default error message.
- $this->assertEqual($result[0]['command'], 'alert', 'ajax_render_error() invokes alert command.');
- $this->assertEqual($result[0]['text'], t('An error occurred while handling the request: The server received invalid input.'), 'Default error message is output.');
+ $this->assertEqual($result[0]['command'], 'alert', t('ajax_render_error() invokes alert command.'));
+ $this->assertEqual($result[0]['text'], t('An error occurred while handling the request: The server received invalid input.'), t('Default error message is output.'));
// Verify custom error message.
$edit = array(
'message' => 'Custom error message.',
);
$result = $this->discardSettings($this->drupalGetAJAX('ajax-test/render-error', array('query' => $edit)));
- $this->assertEqual($result[0]['text'], $edit['message'], 'Custom error message is output.');
+ $this->assertEqual($result[0]['text'], $edit['message'], t('Custom error message is output.'));
}
}
@@ -86,9 +86,9 @@ class AJAXCommandsTestCase extends AJAXTestCase {
$commands[] = ajax_command_settings(array('foo' => 42));
$result = $this->drupalGetAJAX('ajax-test/render', array('query' => array('commands' => $commands)));
// Verify that JavaScript settings are contained (always first).
- $this->assertIdentical($result[0]['command'], 'settings', 'drupal_add_js() settings are contained first.');
+ $this->assertIdentical($result[0]['command'], 'settings', t('drupal_add_js() settings are contained first.'));
// Verify that the custom setting is contained.
- $this->assertEqual($result[1]['settings']['foo'], 42, 'Custom setting is output.');
+ $this->assertEqual($result[1]['settings']['foo'], 42, t('Custom setting is output.'));
}
/**
@@ -192,7 +192,7 @@ class AJAXFormValuesTestCase extends AJAXTestCase {
*/
function testSimpleAJAXFormValue() {
// Verify form values of a select element.
- foreach (array('red', 'green', 'blue') as $item) {
+ foreach(array('red', 'green', 'blue') as $item) {
$edit = array(
'select' => $item,
);
@@ -202,7 +202,7 @@ class AJAXFormValuesTestCase extends AJAXTestCase {
}
// Verify form values of a checkbox element.
- foreach (array(FALSE, TRUE) as $item) {
+ foreach(array(FALSE, TRUE) as $item) {
$edit = array(
'checkbox' => $item,
);
@@ -270,8 +270,8 @@ class AJAXMultiFormTestCase extends AJAXTestCase {
// each form.
$this->drupalGet('form-test/two-instances-of-same-form');
foreach ($field_xpaths as $form_id => $field_xpath) {
- $this->assert(count($this->xpath($field_xpath . $field_items_xpath_suffix)) == 1, 'Found the correct number of field items on the initial page.');
- $this->assertFieldByXPath($field_xpath . $button_xpath_suffix, NULL, 'Found the "add more" button on the initial page.');
+ $this->assert(count($this->xpath($field_xpath . $field_items_xpath_suffix)) == 1, t('Found the correct number of field items on the initial page.'));
+ $this->assertFieldByXPath($field_xpath . $button_xpath_suffix, NULL, t('Found the "add more" button on the initial page.'));
}
$this->assertNoDuplicateIds(t('Initial page contains unique IDs'), 'Other');
@@ -282,13 +282,13 @@ class AJAXMultiFormTestCase extends AJAXTestCase {
preg_match('/jQuery\.extend\(Drupal\.settings, (.*?)\);/', $this->content, $matches);
$settings = drupal_json_decode($matches[1]);
foreach ($field_xpaths as $form_id => $field_xpath) {
- for ($i = 0; $i < 2; $i++) {
+ for ($i=0; $i<2; $i++) {
$button = $this->xpath($field_xpath . $button_xpath_suffix);
$button_id = (string) $button[0]['id'];
$commands = $this->drupalPostAJAX(NULL, array(), array($button_name => $button_value), 'system/ajax', array(), array(), $form_id, $settings['ajax'][$button_id]);
$settings = array_merge_recursive($settings, $commands[0]['settings']);
- $this->assert(count($this->xpath($field_xpath . $field_items_xpath_suffix)) == $i + 2, 'Found the correct number of field items after an AJAX submission.');
- $this->assertFieldByXPath($field_xpath . $button_xpath_suffix, NULL, 'Found the "add more" button after an AJAX submission.');
+ $this->assert(count($this->xpath($field_xpath . $field_items_xpath_suffix)) == $i+2, t('Found the correct number of field items after an AJAX submission.'));
+ $this->assertFieldByXPath($field_xpath . $button_xpath_suffix, NULL, t('Found the "add more" button after an AJAX submission.'));
$this->assertNoDuplicateIds(t('Updated page contains unique IDs'), 'Other');
}
}
@@ -322,8 +322,8 @@ class AJAXElementValidation extends AJAXTestCase {
// Post with 'drivertext' as the triggering element.
$post_result = $this->drupalPostAJAX('ajax_validation_test', $edit, 'drivertext');
// Look for a validation failure in the resultant JSON.
- $this->assertNoText(t('Error message'), "No error message in resultant JSON");
- $this->assertText('ajax_forms_test_validation_form_callback invoked', 'The correct callback was invoked');
+ $this->assertNoText(t('Error message'), t("No error message in resultant JSON"));
+ $this->assertText('ajax_forms_test_validation_form_callback invoked', t('The correct callback was invoked'));
}
}
diff --git a/modules/simpletest/tests/batch.test b/modules/simpletest/tests/batch.test
index f14f56ba9..451575cf2 100644
--- a/modules/simpletest/tests/batch.test
+++ b/modules/simpletest/tests/batch.test
@@ -28,9 +28,9 @@ class BatchProcessingTestCase extends DrupalWebTestCase {
function testBatchNoForm() {
// Displaying the page triggers batch 1.
$this->drupalGet('batch_test/no_form');
- $this->assertBatchMessages($this->_resultMessages(1), 'Batch for step 2 performed successfully.');
- $this->assertEqual(batch_test_stack(), $this->_resultStack('batch_1'), 'Execution order was correct.');
- $this->assertText('Redirection successful.', 'Redirection after batch execution is correct.');
+ $this->assertBatchMessages($this->_resultMessages(1), t('Batch for step 2 performed successfully.'));
+ $this->assertEqual(batch_test_stack(), $this->_resultStack('batch_1'), t('Execution order was correct.'));
+ $this->assertText('Redirection successful.', t('Redirection after batch execution is correct.'));
}
/**
@@ -40,36 +40,36 @@ class BatchProcessingTestCase extends DrupalWebTestCase {
// Batch 0: no operation.
$edit = array('batch' => 'batch_0');
$this->drupalPost('batch_test/simple', $edit, 'Submit');
- $this->assertBatchMessages($this->_resultMessages('batch_0'), 'Batch with no operation performed successfully.');
- $this->assertText('Redirection successful.', 'Redirection after batch execution is correct.');
+ $this->assertBatchMessages($this->_resultMessages('batch_0'), t('Batch with no operation performed successfully.'));
+ $this->assertText('Redirection successful.', t('Redirection after batch execution is correct.'));
// Batch 1: several simple operations.
$edit = array('batch' => 'batch_1');
$this->drupalPost('batch_test/simple', $edit, 'Submit');
- $this->assertBatchMessages($this->_resultMessages('batch_1'), 'Batch with simple operations performed successfully.');
- $this->assertEqual(batch_test_stack(), $this->_resultStack('batch_1'), 'Execution order was correct.');
- $this->assertText('Redirection successful.', 'Redirection after batch execution is correct.');
+ $this->assertBatchMessages($this->_resultMessages('batch_1'), t('Batch with simple operations performed successfully.'));
+ $this->assertEqual(batch_test_stack(), $this->_resultStack('batch_1'), t('Execution order was correct.'));
+ $this->assertText('Redirection successful.', t('Redirection after batch execution is correct.'));
// Batch 2: one multistep operation.
$edit = array('batch' => 'batch_2');
$this->drupalPost('batch_test/simple', $edit, 'Submit');
- $this->assertBatchMessages($this->_resultMessages('batch_2'), 'Batch with multistep operation performed successfully.');
- $this->assertEqual(batch_test_stack(), $this->_resultStack('batch_2'), 'Execution order was correct.');
- $this->assertText('Redirection successful.', 'Redirection after batch execution is correct.');
+ $this->assertBatchMessages($this->_resultMessages('batch_2'), t('Batch with multistep operation performed successfully.'));
+ $this->assertEqual(batch_test_stack(), $this->_resultStack('batch_2'), t('Execution order was correct.'));
+ $this->assertText('Redirection successful.', t('Redirection after batch execution is correct.'));
// Batch 3: simple + multistep combined.
$edit = array('batch' => 'batch_3');
$this->drupalPost('batch_test/simple', $edit, 'Submit');
- $this->assertBatchMessages($this->_resultMessages('batch_3'), 'Batch with simple and multistep operations performed successfully.');
- $this->assertEqual(batch_test_stack(), $this->_resultStack('batch_3'), 'Execution order was correct.');
- $this->assertText('Redirection successful.', 'Redirection after batch execution is correct.');
+ $this->assertBatchMessages($this->_resultMessages('batch_3'), t('Batch with simple and multistep operations performed successfully.'));
+ $this->assertEqual(batch_test_stack(), $this->_resultStack('batch_3'), t('Execution order was correct.'));
+ $this->assertText('Redirection successful.', t('Redirection after batch execution is correct.'));
// Batch 4: nested batch.
$edit = array('batch' => 'batch_4');
$this->drupalPost('batch_test/simple', $edit, 'Submit');
- $this->assertBatchMessages($this->_resultMessages('batch_4'), 'Nested batch performed successfully.');
- $this->assertEqual(batch_test_stack(), $this->_resultStack('batch_4'), 'Execution order was correct.');
- $this->assertText('Redirection successful.', 'Redirection after batch execution is correct.');
+ $this->assertBatchMessages($this->_resultMessages('batch_4'), t('Nested batch performed successfully.'));
+ $this->assertEqual(batch_test_stack(), $this->_resultStack('batch_4'), t('Execution order was correct.'));
+ $this->assertText('Redirection successful.', t('Redirection after batch execution is correct.'));
}
/**
@@ -77,19 +77,19 @@ class BatchProcessingTestCase extends DrupalWebTestCase {
*/
function testBatchFormMultistep() {
$this->drupalGet('batch_test/multistep');
- $this->assertText('step 1', 'Form is displayed in step 1.');
+ $this->assertText('step 1', t('Form is displayed in step 1.'));
// First step triggers batch 1.
$this->drupalPost(NULL, array(), 'Submit');
- $this->assertBatchMessages($this->_resultMessages('batch_1'), 'Batch for step 1 performed successfully.');
- $this->assertEqual(batch_test_stack(), $this->_resultStack('batch_1'), 'Execution order was correct.');
- $this->assertText('step 2', 'Form is displayed in step 2.');
+ $this->assertBatchMessages($this->_resultMessages('batch_1'), t('Batch for step 1 performed successfully.'));
+ $this->assertEqual(batch_test_stack(), $this->_resultStack('batch_1'), t('Execution order was correct.'));
+ $this->assertText('step 2', t('Form is displayed in step 2.'));
// Second step triggers batch 2.
$this->drupalPost(NULL, array(), 'Submit');
- $this->assertBatchMessages($this->_resultMessages('batch_2'), 'Batch for step 2 performed successfully.');
- $this->assertEqual(batch_test_stack(), $this->_resultStack('batch_2'), 'Execution order was correct.');
- $this->assertText('Redirection successful.', 'Redirection after batch execution is correct.');
+ $this->assertBatchMessages($this->_resultMessages('batch_2'), t('Batch for step 2 performed successfully.'));
+ $this->assertEqual(batch_test_stack(), $this->_resultStack('batch_2'), t('Execution order was correct.'));
+ $this->assertText('Redirection successful.', t('Redirection after batch execution is correct.'));
}
/**
@@ -102,11 +102,11 @@ class BatchProcessingTestCase extends DrupalWebTestCase {
$edit = array('value' => $value);
$this->drupalPost('batch_test/chained', $edit, 'Submit');
// Check that result messages are present and in the correct order.
- $this->assertBatchMessages($this->_resultMessages('chained'), 'Batches defined in separate submit handlers performed successfully.');
+ $this->assertBatchMessages($this->_resultMessages('chained'), t('Batches defined in separate submit handlers performed successfully.'));
// The stack contains execution order of batch callbacks and submit
// hanlders and logging of corresponding $form_state[{values'].
- $this->assertEqual(batch_test_stack(), $this->_resultStack('chained', $value), 'Execution order was correct, and $form_state is correctly persisted.');
- $this->assertText('Redirection successful.', 'Redirection after batch execution is correct.');
+ $this->assertEqual(batch_test_stack(), $this->_resultStack('chained', $value), t('Execution order was correct, and $form_state is correctly persisted.'));
+ $this->assertText('Redirection successful.', t('Redirection after batch execution is correct.'));
}
/**
@@ -120,11 +120,11 @@ class BatchProcessingTestCase extends DrupalWebTestCase {
$value = rand(0, 255);
$this->drupalGet('batch_test/programmatic/' . $value);
// Check that result messages are present and in the correct order.
- $this->assertBatchMessages($this->_resultMessages('chained'), 'Batches defined in separate submit handlers performed successfully.');
+ $this->assertBatchMessages($this->_resultMessages('chained'), t('Batches defined in separate submit handlers performed successfully.'));
// The stack contains execution order of batch callbacks and submit
// hanlders and logging of corresponding $form_state[{values'].
- $this->assertEqual(batch_test_stack(), $this->_resultStack('chained', $value), 'Execution order was correct, and $form_state is correctly persisted.');
- $this->assertText('Got out of a programmatic batched form.', 'Page execution continues normally.');
+ $this->assertEqual(batch_test_stack(), $this->_resultStack('chained', $value), t('Execution order was correct, and $form_state is correctly persisted.'));
+ $this->assertText('Got out of a programmatic batched form.', t('Page execution continues normally.'));
}
/**
@@ -135,7 +135,7 @@ class BatchProcessingTestCase extends DrupalWebTestCase {
// form.
$value = rand(0, 255);
$this->drupalGet('batch_test/nested_programmatic/' . $value);
- $this->assertEqual(batch_test_stack(), array('mock form submitted with value = ' . $value), 'drupal_form_submit() ran successfully within a batch operation.');
+ $this->assertEqual(batch_test_stack(), array('mock form submitted with value = ' . $value), t('drupal_form_submit() ran successfully within a batch operation.'));
}
/**
@@ -149,7 +149,7 @@ class BatchProcessingTestCase extends DrupalWebTestCase {
* TRUE on pass, FALSE on fail.
*/
function assertBatchMessages($texts, $message) {
- $pattern = '|' . implode('.*', $texts) . '|s';
+ $pattern = '|' . implode('.*', $texts) .'|s';
return $this->assertPattern($pattern, $message);
}
@@ -282,7 +282,7 @@ class BatchPageTestCase extends DrupalWebTestCase {
// administrative page.
$this->drupalGet('admin/batch_test/test_theme');
// The stack should contain the name of the the used on the progress page.
- $this->assertEqual(batch_test_stack(), array('seven'), 'A progressive batch correctly uses the theme of the page that started the batch.');
+ $this->assertEqual(batch_test_stack(), array('seven'), t('A progressive batch correctly uses the theme of the page that started the batch.'));
}
}
@@ -357,10 +357,10 @@ class BatchPercentagesUnitTestCase extends DrupalUnitTestCase {
$current = $arguments['current'];
$actual_result = _batch_api_percentage($total, $current);
if ($actual_result === $expected_result) {
- $this->pass('Expected the batch api percentage at the state ' . $current . '/' . $total . ' to be ' . $expected_result . '%, and got ' . $actual_result . '%.');
+ $this->pass(t('Expected the batch api percentage at the state @numerator/@denominator to be @expected%, and got @actual%.', array('@numerator' => $current, '@denominator' => $total, '@expected' => $expected_result, '@actual' => $actual_result)));
}
else {
- $this->fail('Expected the batch api percentage at the state ' . $current . '/' . $total . ' to be ' . $expected_result . '%, but got ' . $actual_result . '%.');
+ $this->fail(t('Expected the batch api percentage at the state @numerator/@denominator to be @expected%, but got @actual%.', array('@numerator' => $current, '@denominator' => $total, '@expected' => $expected_result, '@actual' => $actual_result)));
}
}
}
diff --git a/modules/simpletest/tests/bootstrap.test b/modules/simpletest/tests/bootstrap.test
index d41ecf333..d8a9d8c1b 100644
--- a/modules/simpletest/tests/bootstrap.test
+++ b/modules/simpletest/tests/bootstrap.test
@@ -42,48 +42,60 @@ class BootstrapIPAddressTestCase extends DrupalWebTestCase {
function testIPAddressHost() {
// Test the normal IP address.
$this->assertTrue(
- ip_address() == $this->remote_ip, 'Got remote IP address.');
+ ip_address() == $this->remote_ip,
+ t('Got remote IP address.')
+ );
// Proxy forwarding on but no proxy addresses defined.
variable_set('reverse_proxy', 1);
$this->assertTrue(
- ip_address() == $this->remote_ip, 'Proxy forwarding without trusted proxies got remote IP address.');
+ ip_address() == $this->remote_ip,
+ t('Proxy forwarding without trusted proxies got remote IP address.')
+ );
// Proxy forwarding on and proxy address not trusted.
variable_set('reverse_proxy_addresses', array($this->proxy_ip, $this->proxy2_ip));
drupal_static_reset('ip_address');
$_SERVER['REMOTE_ADDR'] = $this->untrusted_ip;
$this->assertTrue(
- ip_address() == $this->untrusted_ip, 'Proxy forwarding with untrusted proxy got remote IP address.');
+ ip_address() == $this->untrusted_ip,
+ t('Proxy forwarding with untrusted proxy got remote IP address.')
+ );
// Proxy forwarding on and proxy address trusted.
$_SERVER['REMOTE_ADDR'] = $this->proxy_ip;
$_SERVER['HTTP_X_FORWARDED_FOR'] = $this->forwarded_ip;
drupal_static_reset('ip_address');
$this->assertTrue(
- ip_address() == $this->forwarded_ip, 'Proxy forwarding with trusted proxy got forwarded IP address.');
+ ip_address() == $this->forwarded_ip,
+ t('Proxy forwarding with trusted proxy got forwarded IP address.')
+ );
// Multi-tier architecture with comma separated values in header.
$_SERVER['REMOTE_ADDR'] = $this->proxy_ip;
$_SERVER['HTTP_X_FORWARDED_FOR'] = implode(', ', array($this->untrusted_ip, $this->forwarded_ip, $this->proxy2_ip));
drupal_static_reset('ip_address');
$this->assertTrue(
- ip_address() == $this->forwarded_ip, 'Proxy forwarding with trusted 2-tier proxy got forwarded IP address.');
+ ip_address() == $this->forwarded_ip,
+ t('Proxy forwarding with trusted 2-tier proxy got forwarded IP address.')
+ );
// Custom client-IP header.
variable_set('reverse_proxy_header', 'HTTP_X_CLUSTER_CLIENT_IP');
$_SERVER['HTTP_X_CLUSTER_CLIENT_IP'] = $this->cluster_ip;
drupal_static_reset('ip_address');
$this->assertTrue(
- ip_address() == $this->cluster_ip, 'Cluster environment got cluster client IP.');
+ ip_address() == $this->cluster_ip,
+ t('Cluster environment got cluster client IP.')
+ );
// Verifies that drupal_valid_http_host() prevents invalid characters.
- $this->assertFalse(drupal_valid_http_host('security/.drupal.org:80'), 'HTTP_HOST with / is invalid');
- $this->assertFalse(drupal_valid_http_host('security\\.drupal.org:80'), 'HTTP_HOST with \\ is invalid');
- $this->assertFalse(drupal_valid_http_host('security<.drupal.org:80'), 'HTTP_HOST with &lt; is invalid');
- $this->assertFalse(drupal_valid_http_host('security..drupal.org:80'), 'HTTP_HOST with .. is invalid');
+ $this->assertFalse(drupal_valid_http_host('security/.drupal.org:80'), t('HTTP_HOST with / is invalid'));
+ $this->assertFalse(drupal_valid_http_host('security\\.drupal.org:80'), t('HTTP_HOST with \\ is invalid'));
+ $this->assertFalse(drupal_valid_http_host('security<.drupal.org:80'), t('HTTP_HOST with &lt; is invalid'));
+ $this->assertFalse(drupal_valid_http_host('security..drupal.org:80'), t('HTTP_HOST with .. is invalid'));
// IPv6 loopback address
- $this->assertTrue(drupal_valid_http_host('[::1]:80'), 'HTTP_HOST containing IPv6 loopback is valid');
+ $this->assertTrue(drupal_valid_http_host('[::1]:80'), t('HTTP_HOST containing IPv6 loopback is valid'));
}
}
@@ -111,32 +123,32 @@ class BootstrapPageCacheTestCase extends DrupalWebTestCase {
$this->drupalGet('');
$this->drupalHead('');
- $this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'HIT', 'Page was cached.');
+ $this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'HIT', t('Page was cached.'));
$etag = $this->drupalGetHeader('ETag');
$last_modified = $this->drupalGetHeader('Last-Modified');
$this->drupalGet('', array(), array('If-Modified-Since: ' . $last_modified, 'If-None-Match: ' . $etag));
- $this->assertResponse(304, 'Conditional request returned 304 Not Modified.');
+ $this->assertResponse(304, t('Conditional request returned 304 Not Modified.'));
$this->drupalGet('', array(), array('If-Modified-Since: ' . gmdate(DATE_RFC822, strtotime($last_modified)), 'If-None-Match: ' . $etag));
- $this->assertResponse(304, 'Conditional request with obsolete If-Modified-Since date returned 304 Not Modified.');
+ $this->assertResponse(304, t('Conditional request with obsolete If-Modified-Since date returned 304 Not Modified.'));
$this->drupalGet('', array(), array('If-Modified-Since: ' . gmdate(DATE_RFC850, strtotime($last_modified)), 'If-None-Match: ' . $etag));
- $this->assertResponse(304, 'Conditional request with obsolete If-Modified-Since date returned 304 Not Modified.');
+ $this->assertResponse(304, t('Conditional request with obsolete If-Modified-Since date returned 304 Not Modified.'));
$this->drupalGet('', array(), array('If-Modified-Since: ' . $last_modified));
- $this->assertResponse(200, 'Conditional request without If-None-Match returned 200 OK.');
- $this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'HIT', 'Page was cached.');
+ $this->assertResponse(200, t('Conditional request without If-None-Match returned 200 OK.'));
+ $this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'HIT', t('Page was cached.'));
$this->drupalGet('', array(), array('If-Modified-Since: ' . gmdate(DATE_RFC1123, strtotime($last_modified) + 1), 'If-None-Match: ' . $etag));
- $this->assertResponse(200, 'Conditional request with new a If-Modified-Since date newer than Last-Modified returned 200 OK.');
- $this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'HIT', 'Page was cached.');
+ $this->assertResponse(200, t('Conditional request with new a If-Modified-Since date newer than Last-Modified returned 200 OK.'));
+ $this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'HIT', t('Page was cached.'));
$user = $this->drupalCreateUser();
$this->drupalLogin($user);
$this->drupalGet('', array(), array('If-Modified-Since: ' . $last_modified, 'If-None-Match: ' . $etag));
- $this->assertResponse(200, 'Conditional request returned 200 OK for authenticated user.');
- $this->assertFalse($this->drupalGetHeader('X-Drupal-Cache'), 'Absense of Page was not cached.');
+ $this->assertResponse(200, t('Conditional request returned 200 OK for authenticated user.'));
+ $this->assertFalse($this->drupalGetHeader('X-Drupal-Cache'), t('Absense of Page was not cached.'));
}
/**
@@ -147,35 +159,35 @@ class BootstrapPageCacheTestCase extends DrupalWebTestCase {
// Fill the cache.
$this->drupalGet('system-test/set-header', array('query' => array('name' => 'Foo', 'value' => 'bar')));
- $this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'MISS', 'Page was not cached.');
- $this->assertEqual($this->drupalGetHeader('Vary'), 'Cookie,Accept-Encoding', 'Vary header was sent.');
- $this->assertEqual($this->drupalGetHeader('Cache-Control'), 'public, max-age=0', 'Cache-Control header was sent.');
- $this->assertEqual($this->drupalGetHeader('Expires'), 'Sun, 19 Nov 1978 05:00:00 GMT', 'Expires header was sent.');
- $this->assertEqual($this->drupalGetHeader('Foo'), 'bar', 'Custom header was sent.');
+ $this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'MISS', t('Page was not cached.'));
+ $this->assertEqual($this->drupalGetHeader('Vary'), 'Cookie,Accept-Encoding', t('Vary header was sent.'));
+ $this->assertEqual($this->drupalGetHeader('Cache-Control'), 'public, max-age=0', t('Cache-Control header was sent.'));
+ $this->assertEqual($this->drupalGetHeader('Expires'), 'Sun, 19 Nov 1978 05:00:00 GMT', t('Expires header was sent.'));
+ $this->assertEqual($this->drupalGetHeader('Foo'), 'bar', t('Custom header was sent.'));
// Check cache.
$this->drupalGet('system-test/set-header', array('query' => array('name' => 'Foo', 'value' => 'bar')));
- $this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'HIT', 'Page was cached.');
- $this->assertEqual($this->drupalGetHeader('Vary'), 'Cookie,Accept-Encoding', 'Vary: Cookie header was sent.');
- $this->assertEqual($this->drupalGetHeader('Cache-Control'), 'public, max-age=0', 'Cache-Control header was sent.');
- $this->assertEqual($this->drupalGetHeader('Expires'), 'Sun, 19 Nov 1978 05:00:00 GMT', 'Expires header was sent.');
- $this->assertEqual($this->drupalGetHeader('Foo'), 'bar', 'Custom header was sent.');
+ $this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'HIT', t('Page was cached.'));
+ $this->assertEqual($this->drupalGetHeader('Vary'), 'Cookie,Accept-Encoding', t('Vary: Cookie header was sent.'));
+ $this->assertEqual($this->drupalGetHeader('Cache-Control'), 'public, max-age=0', t('Cache-Control header was sent.'));
+ $this->assertEqual($this->drupalGetHeader('Expires'), 'Sun, 19 Nov 1978 05:00:00 GMT', t('Expires header was sent.'));
+ $this->assertEqual($this->drupalGetHeader('Foo'), 'bar', t('Custom header was sent.'));
// Check replacing default headers.
$this->drupalGet('system-test/set-header', array('query' => array('name' => 'Expires', 'value' => 'Fri, 19 Nov 2008 05:00:00 GMT')));
- $this->assertEqual($this->drupalGetHeader('Expires'), 'Fri, 19 Nov 2008 05:00:00 GMT', 'Default header was replaced.');
+ $this->assertEqual($this->drupalGetHeader('Expires'), 'Fri, 19 Nov 2008 05:00:00 GMT', t('Default header was replaced.'));
$this->drupalGet('system-test/set-header', array('query' => array('name' => 'Vary', 'value' => 'User-Agent')));
- $this->assertEqual($this->drupalGetHeader('Vary'), 'User-Agent,Accept-Encoding', 'Default header was replaced.');
+ $this->assertEqual($this->drupalGetHeader('Vary'), 'User-Agent,Accept-Encoding', t('Default header was replaced.'));
// Check that authenticated users bypass the cache.
$user = $this->drupalCreateUser();
$this->drupalLogin($user);
$this->drupalGet('system-test/set-header', array('query' => array('name' => 'Foo', 'value' => 'bar')));
- $this->assertFalse($this->drupalGetHeader('X-Drupal-Cache'), 'Caching was bypassed.');
- $this->assertTrue(strpos($this->drupalGetHeader('Vary'), 'Cookie') === FALSE, 'Vary: Cookie header was not sent.');
- $this->assertEqual($this->drupalGetHeader('Cache-Control'), 'no-cache, must-revalidate, post-check=0, pre-check=0', 'Cache-Control header was sent.');
- $this->assertEqual($this->drupalGetHeader('Expires'), 'Sun, 19 Nov 1978 05:00:00 GMT', 'Expires header was sent.');
- $this->assertEqual($this->drupalGetHeader('Foo'), 'bar', 'Custom header was sent.');
+ $this->assertFalse($this->drupalGetHeader('X-Drupal-Cache'), t('Caching was bypassed.'));
+ $this->assertTrue(strpos($this->drupalGetHeader('Vary'), 'Cookie') === FALSE, t('Vary: Cookie header was not sent.'));
+ $this->assertEqual($this->drupalGetHeader('Cache-Control'), 'no-cache, must-revalidate, post-check=0, pre-check=0', t('Cache-Control header was sent.'));
+ $this->assertEqual($this->drupalGetHeader('Expires'), 'Sun, 19 Nov 1978 05:00:00 GMT', t('Expires header was sent.'));
+ $this->assertEqual($this->drupalGetHeader('Foo'), 'bar', t('Custom header was sent.'));
}
@@ -191,23 +203,23 @@ class BootstrapPageCacheTestCase extends DrupalWebTestCase {
// Fill the cache and verify that output is compressed.
$this->drupalGet('', array(), array('Accept-Encoding: gzip,deflate'));
- $this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'MISS', 'Page was not cached.');
+ $this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'MISS', t('Page was not cached.'));
$this->drupalSetContent(gzinflate(substr($this->drupalGetContent(), 10, -8)));
- $this->assertRaw('</html>', 'Page was gzip compressed.');
+ $this->assertRaw('</html>', t('Page was gzip compressed.'));
// Verify that cached output is compressed.
$this->drupalGet('', array(), array('Accept-Encoding: gzip,deflate'));
- $this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'HIT', 'Page was cached.');
- $this->assertEqual($this->drupalGetHeader('Content-Encoding'), 'gzip', 'A Content-Encoding header was sent.');
+ $this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'HIT', t('Page was cached.'));
+ $this->assertEqual($this->drupalGetHeader('Content-Encoding'), 'gzip', t('A Content-Encoding header was sent.'));
$this->drupalSetContent(gzinflate(substr($this->drupalGetContent(), 10, -8)));
- $this->assertRaw('</html>', 'Page was gzip compressed.');
+ $this->assertRaw('</html>', t('Page was gzip compressed.'));
// Verify that a client without compression support gets an uncompressed page.
$this->drupalGet('');
- $this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'HIT', 'Page was cached.');
- $this->assertFalse($this->drupalGetHeader('Content-Encoding'), 'A Content-Encoding header was not sent.');
- $this->assertTitle(t('Welcome to @site-name | @site-name', array('@site-name' => variable_get('site_name', 'Drupal'))), 'Site title matches.');
- $this->assertRaw('</html>', 'Page was not compressed.');
+ $this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'HIT', t('Page was cached.'));
+ $this->assertFalse($this->drupalGetHeader('Content-Encoding'), t('A Content-Encoding header was not sent.'));
+ $this->assertTitle(t('Welcome to @site-name | @site-name', array('@site-name' => variable_get('site_name', 'Drupal'))), t('Site title matches.'));
+ $this->assertRaw('</html>', t('Page was not compressed.'));
}
}
@@ -232,17 +244,17 @@ class BootstrapVariableTestCase extends DrupalWebTestCase {
// Setting and retrieving values.
$variable = $this->randomName();
variable_set('simpletest_bootstrap_variable_test', $variable);
- $this->assertIdentical($variable, variable_get('simpletest_bootstrap_variable_test'), 'Setting and retrieving values');
+ $this->assertIdentical($variable, variable_get('simpletest_bootstrap_variable_test'), t('Setting and retrieving values'));
// Make sure the variable persists across multiple requests.
$this->drupalGet('system-test/variable-get');
- $this->assertText($variable, 'Variable persists across multiple requests');
+ $this->assertText($variable, t('Variable persists across multiple requests'));
// Deleting variables.
$default_value = $this->randomName();
variable_del('simpletest_bootstrap_variable_test');
$variable = variable_get('simpletest_bootstrap_variable_test', $default_value);
- $this->assertIdentical($variable, $default_value, 'Deleting variables');
+ $this->assertIdentical($variable, $default_value, t('Deleting variables'));
}
/**
@@ -250,10 +262,10 @@ class BootstrapVariableTestCase extends DrupalWebTestCase {
*/
function testVariableDefaults() {
// Tests passing nothing through to the default.
- $this->assertIdentical(NULL, variable_get('simpletest_bootstrap_variable_test'), 'Variables are correctly defaulting to NULL.');
+ $this->assertIdentical(NULL, variable_get('simpletest_bootstrap_variable_test'), t('Variables are correctly defaulting to NULL.'));
// Tests passing 5 to the default parameter.
- $this->assertIdentical(5, variable_get('simpletest_bootstrap_variable_test', 5), 'The default variable parameter is passed through correctly.');
+ $this->assertIdentical(5, variable_get('simpletest_bootstrap_variable_test', 5), t('The default variable parameter is passed through correctly.'));
}
}
@@ -283,29 +295,29 @@ class HookBootExitTestCase extends DrupalWebTestCase {
variable_set('cache', 0);
$this->drupalGet('');
$calls = 1;
- $this->assertEqual(db_query('SELECT COUNT(*) FROM {watchdog} WHERE type = :type AND message = :message', array(':type' => 'system_test', ':message' => 'hook_boot'))->fetchField(), $calls, 'hook_boot called with disabled cache.');
- $this->assertEqual(db_query('SELECT COUNT(*) FROM {watchdog} WHERE type = :type AND message = :message', array(':type' => 'system_test', ':message' => 'hook_exit'))->fetchField(), $calls, 'hook_exit called with disabled cache.');
+ $this->assertEqual(db_query('SELECT COUNT(*) FROM {watchdog} WHERE type = :type AND message = :message', array(':type' => 'system_test', ':message' => 'hook_boot'))->fetchField(), $calls, t('hook_boot called with disabled cache.'));
+ $this->assertEqual(db_query('SELECT COUNT(*) FROM {watchdog} WHERE type = :type AND message = :message', array(':type' => 'system_test', ':message' => 'hook_exit'))->fetchField(), $calls, t('hook_exit called with disabled cache.'));
// Test with normal cache. Boot and exit should be called.
variable_set('cache', 1);
$this->drupalGet('');
$calls++;
- $this->assertEqual(db_query('SELECT COUNT(*) FROM {watchdog} WHERE type = :type AND message = :message', array(':type' => 'system_test', ':message' => 'hook_boot'))->fetchField(), $calls, 'hook_boot called with normal cache.');
- $this->assertEqual(db_query('SELECT COUNT(*) FROM {watchdog} WHERE type = :type AND message = :message', array(':type' => 'system_test', ':message' => 'hook_exit'))->fetchField(), $calls, 'hook_exit called with normal cache.');
+ $this->assertEqual(db_query('SELECT COUNT(*) FROM {watchdog} WHERE type = :type AND message = :message', array(':type' => 'system_test', ':message' => 'hook_boot'))->fetchField(), $calls, t('hook_boot called with normal cache.'));
+ $this->assertEqual(db_query('SELECT COUNT(*) FROM {watchdog} WHERE type = :type AND message = :message', array(':type' => 'system_test', ':message' => 'hook_exit'))->fetchField(), $calls, t('hook_exit called with normal cache.'));
// Boot and exit should not fire since the page is cached.
variable_set('page_cache_invoke_hooks', FALSE);
- $this->assertTrue(cache_get(url('', array('absolute' => TRUE)), 'cache_page'), 'Page has been cached.');
+ $this->assertTrue(cache_get(url('', array('absolute' => TRUE)), 'cache_page'), t('Page has been cached.'));
$this->drupalGet('');
- $this->assertEqual(db_query('SELECT COUNT(*) FROM {watchdog} WHERE type = :type AND message = :message', array(':type' => 'system_test', ':message' => 'hook_boot'))->fetchField(), $calls, 'hook_boot not called with agressive cache and a cached page.');
- $this->assertEqual(db_query('SELECT COUNT(*) FROM {watchdog} WHERE type = :type AND message = :message', array(':type' => 'system_test', ':message' => 'hook_exit'))->fetchField(), $calls, 'hook_exit not called with agressive cache and a cached page.');
+ $this->assertEqual(db_query('SELECT COUNT(*) FROM {watchdog} WHERE type = :type AND message = :message', array(':type' => 'system_test', ':message' => 'hook_boot'))->fetchField(), $calls, t('hook_boot not called with agressive cache and a cached page.'));
+ $this->assertEqual(db_query('SELECT COUNT(*) FROM {watchdog} WHERE type = :type AND message = :message', array(':type' => 'system_test', ':message' => 'hook_exit'))->fetchField(), $calls, t('hook_exit not called with agressive cache and a cached page.'));
// Test with page cache cleared, boot and exit should be called.
- $this->assertTrue(db_delete('cache_page')->execute(), 'Page cache cleared.');
+ $this->assertTrue(db_delete('cache_page')->execute(), t('Page cache cleared.'));
$this->drupalGet('');
$calls++;
- $this->assertEqual(db_query('SELECT COUNT(*) FROM {watchdog} WHERE type = :type AND message = :message', array(':type' => 'system_test', ':message' => 'hook_boot'))->fetchField(), $calls, 'hook_boot called with agressive cache and no cached page.');
- $this->assertEqual(db_query('SELECT COUNT(*) FROM {watchdog} WHERE type = :type AND message = :message', array(':type' => 'system_test', ':message' => 'hook_exit'))->fetchField(), $calls, 'hook_exit called with agressive cache and no cached page.');
+ $this->assertEqual(db_query('SELECT COUNT(*) FROM {watchdog} WHERE type = :type AND message = :message', array(':type' => 'system_test', ':message' => 'hook_boot'))->fetchField(), $calls, t('hook_boot called with agressive cache and no cached page.'));
+ $this->assertEqual(db_query('SELECT COUNT(*) FROM {watchdog} WHERE type = :type AND message = :message', array(':type' => 'system_test', ':message' => 'hook_exit'))->fetchField(), $calls, t('hook_exit called with agressive cache and no cached page.'));
}
}
@@ -331,16 +343,16 @@ class BootstrapGetFilenameTestCase extends DrupalUnitTestCase {
drupal_static_reset('drupal_get_filename');
// Retrieving the location of a module.
- $this->assertIdentical(drupal_get_filename('module', 'php'), 'modules/php/php.module', 'Retrieve module location.');
+ $this->assertIdentical(drupal_get_filename('module', 'php'), 'modules/php/php.module', t('Retrieve module location.'));
// Retrieving the location of a theme.
- $this->assertIdentical(drupal_get_filename('theme', 'stark'), 'themes/stark/stark.info', 'Retrieve theme location.');
+ $this->assertIdentical(drupal_get_filename('theme', 'stark'), 'themes/stark/stark.info', t('Retrieve theme location.'));
// Retrieving the location of a theme engine.
- $this->assertIdentical(drupal_get_filename('theme_engine', 'phptemplate'), 'themes/engines/phptemplate/phptemplate.engine', 'Retrieve theme engine location.');
+ $this->assertIdentical(drupal_get_filename('theme_engine', 'phptemplate'), 'themes/engines/phptemplate/phptemplate.engine', t('Retrieve theme engine location.'));
// Retrieving a file that is definitely not stored in the database.
- $this->assertIdentical(drupal_get_filename('profile', 'standard'), 'profiles/standard/standard.profile', 'Retrieve install profile location.');
+ $this->assertIdentical(drupal_get_filename('profile', 'standard'), 'profiles/standard/standard.profile', t('Retrieve install profile location.'));
}
}
@@ -362,17 +374,17 @@ class BootstrapTimerTestCase extends DrupalUnitTestCase {
function testTimer() {
timer_start('test');
sleep(1);
- $this->assertTrue(timer_read('test') >= 1000, 'Timer measured 1 second of sleeping while running.');
+ $this->assertTrue(timer_read('test') >= 1000, t('Timer measured 1 second of sleeping while running.'));
sleep(1);
timer_stop('test');
- $this->assertTrue(timer_read('test') >= 2000, 'Timer measured 2 seconds of sleeping after being stopped.');
+ $this->assertTrue(timer_read('test') >= 2000, t('Timer measured 2 seconds of sleeping after being stopped.'));
timer_start('test');
sleep(1);
- $this->assertTrue(timer_read('test') >= 3000, 'Timer measured 3 seconds of sleeping after being restarted.');
+ $this->assertTrue(timer_read('test') >= 3000, t('Timer measured 3 seconds of sleeping after being restarted.'));
sleep(1);
$timer = timer_stop('test');
- $this->assertTrue(timer_read('test') >= 4000, 'Timer measured 4 seconds of sleeping after being stopped for a second time.');
- $this->assertEqual($timer['count'], 2, 'Timer counted 2 instances of being started.');
+ $this->assertTrue(timer_read('test') >= 4000, t('Timer measured 4 seconds of sleeping after being stopped for a second time.'));
+ $this->assertEqual($timer['count'], 2, t('Timer counted 2 instances of being started.'));
}
}
@@ -396,21 +408,21 @@ class BootstrapResettableStaticTestCase extends DrupalUnitTestCase {
function testDrupalStatic() {
$name = __CLASS__ . '_' . __METHOD__;
$var = &drupal_static($name, 'foo');
- $this->assertEqual($var, 'foo', 'Variable returned by drupal_static() was set to its default.');
+ $this->assertEqual($var, 'foo', t('Variable returned by drupal_static() was set to its default.'));
// Call the specific reset and the global reset each twice to ensure that
// multiple resets can be issued without odd side effects.
$var = 'bar';
drupal_static_reset($name);
- $this->assertEqual($var, 'foo', 'Variable was reset after first invocation of name-specific reset.');
+ $this->assertEqual($var, 'foo', t('Variable was reset after first invocation of name-specific reset.'));
$var = 'bar';
drupal_static_reset($name);
- $this->assertEqual($var, 'foo', 'Variable was reset after second invocation of name-specific reset.');
+ $this->assertEqual($var, 'foo', t('Variable was reset after second invocation of name-specific reset.'));
$var = 'bar';
drupal_static_reset();
- $this->assertEqual($var, 'foo', 'Variable was reset after first invocation of global reset.');
+ $this->assertEqual($var, 'foo', t('Variable was reset after first invocation of global reset.'));
$var = 'bar';
drupal_static_reset();
- $this->assertEqual($var, 'foo', 'Variable was reset after second invocation of global reset.');
+ $this->assertEqual($var, 'foo', t('Variable was reset after second invocation of global reset.'));
}
}
diff --git a/modules/simpletest/tests/cache.test b/modules/simpletest/tests/cache.test
index b45dd85ec..0fc9fe298 100644
--- a/modules/simpletest/tests/cache.test
+++ b/modules/simpletest/tests/cache.test
@@ -135,7 +135,7 @@ class CacheSavingCase extends CacheTestCase {
* Test the saving and restoring of an array.
*/
function testArray() {
- $this->checkVariable(array('drupal1','drupal2' => 'drupal3', 'drupal4' => array('drupal5', 'drupal6')));
+ $this->checkVariable(array('drupal1', 'drupal2' => 'drupal3', 'drupal4' => array('drupal5', 'drupal6')));
}
/**
@@ -145,11 +145,11 @@ class CacheSavingCase extends CacheTestCase {
$test_object = new stdClass();
$test_object->test1 = $this->randomName(100);
$test_object->test2 = 100;
- $test_object->test3 = array('drupal1','drupal2' => 'drupal3', 'drupal4' => array('drupal5', 'drupal6'));
+ $test_object->test3 = array('drupal1', 'drupal2' => 'drupal3', 'drupal4' => array('drupal5', 'drupal6'));
cache_set('test_object', $test_object, 'cache');
$cache = cache_get('test_object', 'cache');
- $this->assertTrue(isset($cache->data) && $cache->data == $test_object, 'Object is saved and restored properly.');
+ $this->assertTrue(isset($cache->data) && $cache->data == $test_object, t('Object is saved and restored properly.'));
}
/*
@@ -158,7 +158,7 @@ class CacheSavingCase extends CacheTestCase {
function checkVariable($var) {
cache_set('test_var', $var, 'cache');
$cache = cache_get('test_var', 'cache');
- $this->assertTrue(isset($cache->data) && $cache->data === $var, ucfirst(gettype($var)) . ' is saved and restored properly.');
+ $this->assertTrue(isset($cache->data) && $cache->data === $var, t('@type is saved and restored properly.', array('@type' => ucfirst(gettype($var)))));
}
}
@@ -188,14 +188,14 @@ class CacheGetMultipleUnitTest extends CacheTestCase {
$item2 = $this->randomName(10);
cache_set('item1', $item1, $this->default_bin);
cache_set('item2', $item2, $this->default_bin);
- $this->assertTrue($this->checkCacheExists('item1', $item1), 'Item 1 is cached.');
- $this->assertTrue($this->checkCacheExists('item2', $item2), 'Item 2 is cached.');
+ $this->assertTrue($this->checkCacheExists('item1', $item1), t('Item 1 is cached.'));
+ $this->assertTrue($this->checkCacheExists('item2', $item2), t('Item 2 is cached.'));
// Fetch both records from the database with cache_get_multiple().
$item_ids = array('item1', 'item2');
$items = cache_get_multiple($item_ids, $this->default_bin);
- $this->assertEqual($items['item1']->data, $item1, 'Item was returned from cache successfully.');
- $this->assertEqual($items['item2']->data, $item2, 'Item was returned from cache successfully.');
+ $this->assertEqual($items['item1']->data, $item1, t('Item was returned from cache successfully.'));
+ $this->assertEqual($items['item2']->data, $item2, t('Item was returned from cache successfully.'));
// Remove one item from the cache.
cache_clear_all('item2', $this->default_bin);
@@ -203,9 +203,9 @@ class CacheGetMultipleUnitTest extends CacheTestCase {
// Confirm that only one item is returned by cache_get_multiple().
$item_ids = array('item1', 'item2');
$items = cache_get_multiple($item_ids, $this->default_bin);
- $this->assertEqual($items['item1']->data, $item1, 'Item was returned from cache successfully.');
- $this->assertFalse(isset($items['item2']), 'Item was not returned from the cache.');
- $this->assertTrue(count($items) == 1, 'Only valid cache entries returned.');
+ $this->assertEqual($items['item1']->data, $item1, t('Item was returned from cache successfully.'));
+ $this->assertFalse(isset($items['item2']), t('Item was not returned from the cache.'));
+ $this->assertTrue(count($items) == 1, t('Only valid cache entries returned.'));
}
}
@@ -237,15 +237,17 @@ class CacheClearCase extends CacheTestCase {
$this->assertCacheExists(t('Cache was set for clearing cid.'), $this->default_value, 'test_cid_clear');
cache_clear_all('test_cid_clear', $this->default_bin);
- $this->assertCacheRemoved('Cache was removed after clearing cid.', 'test_cid_clear');
+ $this->assertCacheRemoved(t('Cache was removed after clearing cid.'), 'test_cid_clear');
cache_set('test_cid_clear1', $this->default_value, $this->default_bin);
cache_set('test_cid_clear2', $this->default_value, $this->default_bin);
$this->assertTrue($this->checkCacheExists('test_cid_clear1', $this->default_value)
- && $this->checkCacheExists('test_cid_clear2', $this->default_value), 'Two caches were created for checking cid "*" with wildcard false.');
+ && $this->checkCacheExists('test_cid_clear2', $this->default_value),
+ t('Two caches were created for checking cid "*" with wildcard false.'));
cache_clear_all('*', $this->default_bin);
$this->assertTrue($this->checkCacheExists('test_cid_clear1', $this->default_value)
- && $this->checkCacheExists('test_cid_clear2', $this->default_value), 'Two caches still exists after clearing cid "*" with wildcard false.');
+ && $this->checkCacheExists('test_cid_clear2', $this->default_value),
+ t('Two caches still exists after clearing cid "*" with wildcard false.'));
}
/**
@@ -255,18 +257,22 @@ class CacheClearCase extends CacheTestCase {
cache_set('test_cid_clear1', $this->default_value, $this->default_bin);
cache_set('test_cid_clear2', $this->default_value, $this->default_bin);
$this->assertTrue($this->checkCacheExists('test_cid_clear1', $this->default_value)
- && $this->checkCacheExists('test_cid_clear2', $this->default_value), 'Two caches were created for checking cid "*" with wildcard true.');
+ && $this->checkCacheExists('test_cid_clear2', $this->default_value),
+ t('Two caches were created for checking cid "*" with wildcard true.'));
cache_clear_all('*', $this->default_bin, TRUE);
$this->assertFalse($this->checkCacheExists('test_cid_clear1', $this->default_value)
- || $this->checkCacheExists('test_cid_clear2', $this->default_value), 'Two caches removed after clearing cid "*" with wildcard true.');
+ || $this->checkCacheExists('test_cid_clear2', $this->default_value),
+ t('Two caches removed after clearing cid "*" with wildcard true.'));
cache_set('test_cid_clear1', $this->default_value, $this->default_bin);
cache_set('test_cid_clear2', $this->default_value, $this->default_bin);
$this->assertTrue($this->checkCacheExists('test_cid_clear1', $this->default_value)
- && $this->checkCacheExists('test_cid_clear2', $this->default_value), 'Two caches were created for checking cid substring with wildcard true.');
+ && $this->checkCacheExists('test_cid_clear2', $this->default_value),
+ t('Two caches were created for checking cid substring with wildcard true.'));
cache_clear_all('test_', $this->default_bin, TRUE);
$this->assertFalse($this->checkCacheExists('test_cid_clear1', $this->default_value)
- || $this->checkCacheExists('test_cid_clear2', $this->default_value), 'Two caches removed after clearing cid substring with wildcard true.');
+ || $this->checkCacheExists('test_cid_clear2', $this->default_value),
+ t('Two caches removed after clearing cid substring with wildcard true.'));
}
/**
@@ -279,14 +285,17 @@ class CacheClearCase extends CacheTestCase {
cache_set('test_cid_clear3', $this->default_value, $this->default_bin);
$this->assertTrue($this->checkCacheExists('test_cid_clear1', $this->default_value)
&& $this->checkCacheExists('test_cid_clear2', $this->default_value)
- && $this->checkCacheExists('test_cid_clear3', $this->default_value), 'Three cache entries were created.');
+ && $this->checkCacheExists('test_cid_clear3', $this->default_value),
+ t('Three cache entries were created.'));
// Clear two entries using an array.
cache_clear_all(array('test_cid_clear1', 'test_cid_clear2'), $this->default_bin);
$this->assertFalse($this->checkCacheExists('test_cid_clear1', $this->default_value)
- || $this->checkCacheExists('test_cid_clear2', $this->default_value), 'Two cache entries removed after clearing with an array.');
+ || $this->checkCacheExists('test_cid_clear2', $this->default_value),
+ t('Two cache entries removed after clearing with an array.'));
- $this->assertTrue($this->checkCacheExists('test_cid_clear3', $this->default_value), 'Entry was not cleared from the cache');
+ $this->assertTrue($this->checkCacheExists('test_cid_clear3', $this->default_value),
+ t('Entry was not cleared from the cache'));
// Set the cache clear threshold to 2 to confirm that the full bin is cleared
// when the threshold is exceeded.
@@ -294,11 +303,13 @@ class CacheClearCase extends CacheTestCase {
cache_set('test_cid_clear1', $this->default_value, $this->default_bin);
cache_set('test_cid_clear2', $this->default_value, $this->default_bin);
$this->assertTrue($this->checkCacheExists('test_cid_clear1', $this->default_value)
- && $this->checkCacheExists('test_cid_clear2', $this->default_value), 'Two cache entries were created.');
+ && $this->checkCacheExists('test_cid_clear2', $this->default_value),
+ t('Two cache entries were created.'));
cache_clear_all(array('test_cid_clear1', 'test_cid_clear2', 'test_cid_clear3'), $this->default_bin);
$this->assertFalse($this->checkCacheExists('test_cid_clear1', $this->default_value)
|| $this->checkCacheExists('test_cid_clear2', $this->default_value)
- || $this->checkCacheExists('test_cid_clear3', $this->default_value), 'All cache entries removed when the array exceeded the cache clear threshold.');
+ || $this->checkCacheExists('test_cid_clear3', $this->default_value),
+ t('All cache entries removed when the array exceeded the cache clear threshold.'));
}
}
@@ -327,14 +338,14 @@ class CacheIsEmptyCase extends CacheTestCase {
function testIsEmpty() {
// Clear the cache bin.
cache_clear_all('*', $this->default_bin);
- $this->assertTrue(cache_is_empty($this->default_bin), 'The cache bin is empty');
+ $this->assertTrue(cache_is_empty($this->default_bin), t('The cache bin is empty'));
// Add some data to the cache bin.
cache_set($this->default_cid, $this->default_value, $this->default_bin);
$this->assertCacheExists(t('Cache was set.'), $this->default_value, $this->default_cid);
- $this->assertFalse(cache_is_empty($this->default_bin), 'The cache bin is not empty');
+ $this->assertFalse(cache_is_empty($this->default_bin), t('The cache bin is not empty'));
// Remove the cached data.
cache_clear_all($this->default_cid, $this->default_bin);
- $this->assertCacheRemoved('Cache was removed.', $this->default_cid);
- $this->assertTrue(cache_is_empty($this->default_bin), 'The cache bin is empty');
+ $this->assertCacheRemoved(t('Cache was removed.'), $this->default_cid);
+ $this->assertTrue(cache_is_empty($this->default_bin), t('The cache bin is empty'));
}
}
diff --git a/modules/simpletest/tests/common.test b/modules/simpletest/tests/common.test
index 24a681924..35c5bbc3b 100644
--- a/modules/simpletest/tests/common.test
+++ b/modules/simpletest/tests/common.test
@@ -37,13 +37,13 @@ class DrupalAlterTestCase extends DrupalWebTestCase {
$array_copy = $array;
$array_expected = array('foo' => 'Drupal theme');
drupal_alter('drupal_alter', $array_copy);
- $this->assertEqual($array_copy, $array_expected, 'Single array was altered.');
+ $this->assertEqual($array_copy, $array_expected, t('Single array was altered.'));
$entity_copy = clone $entity;
$entity_expected = clone $entity;
$entity_expected->foo = 'Drupal theme';
drupal_alter('drupal_alter', $entity_copy);
- $this->assertEqual($entity_copy, $entity_expected, 'Single object was altered.');
+ $this->assertEqual($entity_copy, $entity_expected, t('Single object was altered.'));
// Verify alteration of multiple arguments.
$array_copy = $array;
@@ -54,9 +54,9 @@ class DrupalAlterTestCase extends DrupalWebTestCase {
$array2_copy = $array;
$array2_expected = array('foo' => 'Drupal theme');
drupal_alter('drupal_alter', $array_copy, $entity_copy, $array2_copy);
- $this->assertEqual($array_copy, $array_expected, 'First argument to drupal_alter() was altered.');
- $this->assertEqual($entity_copy, $entity_expected, 'Second argument to drupal_alter() was altered.');
- $this->assertEqual($array2_copy, $array2_expected, 'Third argument to drupal_alter() was altered.');
+ $this->assertEqual($array_copy, $array_expected, t('First argument to drupal_alter() was altered.'));
+ $this->assertEqual($entity_copy, $entity_expected, t('Second argument to drupal_alter() was altered.'));
+ $this->assertEqual($array2_copy, $array2_expected, t('Third argument to drupal_alter() was altered.'));
}
}
@@ -83,7 +83,7 @@ class CommonURLUnitTest extends DrupalWebTestCase {
$path = "<SCRIPT>alert('XSS')</SCRIPT>";
$link = l($text, $path);
$sanitized_path = check_url(url($path));
- $this->assertTrue(strpos($link, $sanitized_path) !== FALSE, 'XSS attack ' . $path . ' was filtered');
+ $this->assertTrue(strpos($link, $sanitized_path) !== FALSE, t('XSS attack @path was filtered', array('@path' => $path)));
}
/*
@@ -91,7 +91,7 @@ class CommonURLUnitTest extends DrupalWebTestCase {
*/
function testLActiveClass() {
$link = l($this->randomName(), $_GET['q']);
- $this->assertTrue($this->hasClass($link, 'active'), 'Class ' . 'active' . ' is present on link to the current page');
+ $this->assertTrue($this->hasClass($link, 'active'), t('Class @class is present on link to the current page', array('@class' => 'active')));
}
/**
@@ -100,8 +100,8 @@ class CommonURLUnitTest extends DrupalWebTestCase {
function testLCustomClass() {
$class = $this->randomName();
$link = l($this->randomName(), $_GET['q'], array('attributes' => array('class' => array($class))));
- $this->assertTrue($this->hasClass($link, $class), 'Custom class ' . $class . ' is present on link when requested');
- $this->assertTrue($this->hasClass($link, 'active'), 'Class ' . 'active' . ' is present on link to the current page');
+ $this->assertTrue($this->hasClass($link, $class), t('Custom class @class is present on link when requested', array('@class' => $class)));
+ $this->assertTrue($this->hasClass($link, 'active'), t('Class @class is present on link to the current page', array('@class' => 'active')));
}
private function hasClass($link, $class) {
@@ -127,42 +127,42 @@ class CommonURLUnitTest extends DrupalWebTestCase {
// Default arguments.
$result = $_GET;
unset($result['q']);
- $this->assertEqual(drupal_get_query_parameters(), $result, "\$_GET['q'] was removed.");
+ $this->assertEqual(drupal_get_query_parameters(), $result, t("\$_GET['q'] was removed."));
// Default exclusion.
$result = $original;
unset($result['q']);
- $this->assertEqual(drupal_get_query_parameters($original), $result, "'q' was removed.");
+ $this->assertEqual(drupal_get_query_parameters($original), $result, t("'q' was removed."));
// First-level exclusion.
$result = $original;
unset($result['b']);
- $this->assertEqual(drupal_get_query_parameters($original, array('b')), $result, "'b' was removed.");
+ $this->assertEqual(drupal_get_query_parameters($original, array('b')), $result, t("'b' was removed."));
// Second-level exclusion.
$result = $original;
unset($result['b']['d']);
- $this->assertEqual(drupal_get_query_parameters($original, array('b[d]')), $result, "'b[d]' was removed.");
+ $this->assertEqual(drupal_get_query_parameters($original, array('b[d]')), $result, t("'b[d]' was removed."));
// Third-level exclusion.
$result = $original;
unset($result['b']['e']['f']);
- $this->assertEqual(drupal_get_query_parameters($original, array('b[e][f]')), $result, "'b[e][f]' was removed.");
+ $this->assertEqual(drupal_get_query_parameters($original, array('b[e][f]')), $result, t("'b[e][f]' was removed."));
// Multiple exclusions.
$result = $original;
unset($result['a'], $result['b']['e'], $result['c']);
- $this->assertEqual(drupal_get_query_parameters($original, array('a', 'b[e]', 'c')), $result, "'a', 'b[e]', 'c' were removed.");
+ $this->assertEqual(drupal_get_query_parameters($original, array('a', 'b[e]', 'c')), $result, t("'a', 'b[e]', 'c' were removed."));
}
/**
* Test drupal_http_build_query().
*/
function testDrupalHttpBuildQuery() {
- $this->assertEqual(drupal_http_build_query(array('a' => ' &#//+%20@۞')), 'a=%20%26%23//%2B%2520%40%DB%9E', 'Value was properly encoded.');
- $this->assertEqual(drupal_http_build_query(array(' &#//+%20@۞' => 'a')), '%20%26%23%2F%2F%2B%2520%40%DB%9E=a', 'Key was properly encoded.');
- $this->assertEqual(drupal_http_build_query(array('a' => '1', 'b' => '2', 'c' => '3')), 'a=1&b=2&c=3', 'Multiple values were properly concatenated.');
- $this->assertEqual(drupal_http_build_query(array('a' => array('b' => '2', 'c' => '3'), 'd' => 'foo')), 'a[b]=2&a[c]=3&d=foo', 'Nested array was properly encoded.');
+ $this->assertEqual(drupal_http_build_query(array('a' => ' &#//+%20@۞')), 'a=%20%26%23//%2B%2520%40%DB%9E', t('Value was properly encoded.'));
+ $this->assertEqual(drupal_http_build_query(array(' &#//+%20@۞' => 'a')), '%20%26%23%2F%2F%2B%2520%40%DB%9E=a', t('Key was properly encoded.'));
+ $this->assertEqual(drupal_http_build_query(array('a' => '1', 'b' => '2', 'c' => '3')), 'a=1&b=2&c=3', t('Multiple values were properly concatenated.'));
+ $this->assertEqual(drupal_http_build_query(array('a' => array('b' => '2', 'c' => '3'), 'd' => 'foo')), 'a[b]=2&a[c]=3&d=foo', t('Nested array was properly encoded.'));
}
/**
@@ -176,7 +176,7 @@ class CommonURLUnitTest extends DrupalWebTestCase {
'query' => array('foo' => 'bar', 'bar' => 'baz', 'baz' => ''),
'fragment' => 'foo',
);
- $this->assertEqual(drupal_parse_url($url), $result, 'Relative URL parsed correctly.');
+ $this->assertEqual(drupal_parse_url($url), $result, t('Relative URL parsed correctly.'));
// Relative URL that is known to confuse parse_url().
$url = 'foo/bar:1';
@@ -185,7 +185,7 @@ class CommonURLUnitTest extends DrupalWebTestCase {
'query' => array(),
'fragment' => '',
);
- $this->assertEqual(drupal_parse_url($url), $result, 'Relative URL parsed correctly.');
+ $this->assertEqual(drupal_parse_url($url), $result, t('Relative URL parsed correctly.'));
// Absolute URL.
$url = '/foo/bar?foo=bar&bar=baz&baz#foo';
@@ -194,13 +194,13 @@ class CommonURLUnitTest extends DrupalWebTestCase {
'query' => array('foo' => 'bar', 'bar' => 'baz', 'baz' => ''),
'fragment' => 'foo',
);
- $this->assertEqual(drupal_parse_url($url), $result, 'Absolute URL parsed correctly.');
+ $this->assertEqual(drupal_parse_url($url), $result, t('Absolute URL parsed correctly.'));
// External URL testing.
$url = 'http://drupal.org/foo/bar?foo=bar&bar=baz&baz#foo';
// Test that drupal can recognize an absolute URL. Used to prevent attack vectors.
- $this->assertTrue(url_is_external($url), 'Correctly identified an external URL.');
+ $this->assertTrue(url_is_external($url), t('Correctly identified an external URL.'));
// Test the parsing of absolute URLs.
$result = array(
@@ -208,7 +208,7 @@ class CommonURLUnitTest extends DrupalWebTestCase {
'query' => array('foo' => 'bar', 'bar' => 'baz', 'baz' => ''),
'fragment' => 'foo',
);
- $this->assertEqual(drupal_parse_url($url), $result, 'External URL parsed correctly.');
+ $this->assertEqual(drupal_parse_url($url), $result, t('External URL parsed correctly.'));
// Verify proper parsing of URLs when clean URLs are disabled.
$result = array(
@@ -218,19 +218,19 @@ class CommonURLUnitTest extends DrupalWebTestCase {
);
// Non-clean URLs #1: Absolute URL generated by url().
$url = $GLOBALS['base_url'] . '/?q=foo/bar&bar=baz#foo';
- $this->assertEqual(drupal_parse_url($url), $result, 'Absolute URL with clean URLs disabled parsed correctly.');
+ $this->assertEqual(drupal_parse_url($url), $result, t('Absolute URL with clean URLs disabled parsed correctly.'));
// Non-clean URLs #2: Relative URL generated by url().
$url = '?q=foo/bar&bar=baz#foo';
- $this->assertEqual(drupal_parse_url($url), $result, 'Relative URL with clean URLs disabled parsed correctly.');
+ $this->assertEqual(drupal_parse_url($url), $result, t('Relative URL with clean URLs disabled parsed correctly.'));
// Non-clean URLs #3: URL generated by url() on non-Apache webserver.
$url = 'index.php?q=foo/bar&bar=baz#foo';
- $this->assertEqual(drupal_parse_url($url), $result, 'Relative URL on non-Apache webserver with clean URLs disabled parsed correctly.');
+ $this->assertEqual(drupal_parse_url($url), $result, t('Relative URL on non-Apache webserver with clean URLs disabled parsed correctly.'));
// Test that drupal_parse_url() does not allow spoofing a URL to force a malicious redirect.
$parts = drupal_parse_url('forged:http://cwe.mitre.org/data/definitions/601.html');
- $this->assertFalse(valid_url($parts['path'], TRUE), 'drupal_parse_url() correctly parsed a forged URL.');
+ $this->assertFalse(valid_url($parts['path'], TRUE), t('drupal_parse_url() correctly parsed a forged URL.'));
}
/**
@@ -310,30 +310,30 @@ class CommonURLUnitTest extends DrupalWebTestCase {
// Verify external URL can contain a fragment.
$url = $test_url . '#drupal';
$result = url($url);
- $this->assertEqual($url, $result, 'External URL with fragment works without a fragment in $options.');
+ $this->assertEqual($url, $result, t('External URL with fragment works without a fragment in $options.'));
// Verify fragment can be overidden in an external URL.
$url = $test_url . '#drupal';
$fragment = $this->randomName(10);
$result = url($url, array('fragment' => $fragment));
- $this->assertEqual($test_url . '#' . $fragment, $result, 'External URL fragment is overidden with a custom fragment in $options.');
+ $this->assertEqual($test_url . '#' . $fragment, $result, t('External URL fragment is overidden with a custom fragment in $options.'));
// Verify external URL can contain a query string.
$url = $test_url . '?drupal=awesome';
$result = url($url);
- $this->assertEqual($url, $result, 'External URL with query string works without a query string in $options.');
+ $this->assertEqual($url, $result, t('External URL with query string works without a query string in $options.'));
// Verify external URL can be extended with a query string.
$url = $test_url;
$query = array($this->randomName(5) => $this->randomName(5));
$result = url($url, array('query' => $query));
- $this->assertEqual($url . '?' . http_build_query($query, '', '&'), $result, 'External URL can be extended with a query string in $options.');
+ $this->assertEqual($url . '?' . http_build_query($query, '', '&'), $result, t('External URL can be extended with a query string in $options.'));
// Verify query string can be extended in an external URL.
$url = $test_url . '?drupal=awesome';
$query = array($this->randomName(5) => $this->randomName(5));
$result = url($url, array('query' => $query));
- $this->assertEqual($url . '&' . http_build_query($query, '', '&'), $result, 'External URL query string can be extended with a custom query string in $options.');
+ $this->assertEqual($url . '&' . http_build_query($query, '', '&'), $result, t('External URL query string can be extended with a custom query string in $options.'));
}
}
@@ -354,23 +354,23 @@ class CommonXssUnitTest extends DrupalUnitTestCase {
* Check that invalid multi-byte sequences are rejected.
*/
function testInvalidMultiByte() {
- // Ignore PHP 5.3+ invalid multibyte sequence warning.
- $text = @check_plain("Foo\xC0barbaz");
- $this->assertEqual($text, '', 'check_plain() rejects invalid sequence "Foo\xC0barbaz"');
- $text = check_plain("Fooÿñ");
- $this->assertEqual($text, "Fooÿñ", 'check_plain() accepts valid sequence "Fooÿñ"');
- $text = filter_xss("Foo\xC0barbaz");
- $this->assertEqual($text, '', 'filter_xss() rejects invalid sequence "Foo\xC0barbaz"');
- $text = filter_xss("Fooÿñ");
- $this->assertEqual($text, "Fooÿñ", 'filter_xss() accepts valid sequence Fooÿñ');
+ // Ignore PHP 5.3+ invalid multibyte sequence warning.
+ $text = @check_plain("Foo\xC0barbaz");
+ $this->assertEqual($text, '', 'check_plain() rejects invalid sequence "Foo\xC0barbaz"');
+ $text = check_plain("Fooÿñ");
+ $this->assertEqual($text, "Fooÿñ", 'check_plain() accepts valid sequence "Fooÿñ"');
+ $text = filter_xss("Foo\xC0barbaz");
+ $this->assertEqual($text, '', 'filter_xss() rejects invalid sequence "Foo\xC0barbaz"');
+ $text = filter_xss("Fooÿñ");
+ $this->assertEqual($text, "Fooÿñ", 'filter_xss() accepts valid sequence Fooÿñ');
}
/**
* Check that special characters are escaped.
*/
function testEscaping() {
- $text = check_plain("<script>");
- $this->assertEqual($text, '&lt;script&gt;', 'check_plain() escapes &lt;script&gt;');
+ $text = check_plain("<script>");
+ $this->assertEqual($text, '&lt;script&gt;', 'check_plain() escapes &lt;script&gt;');
}
/**
@@ -383,8 +383,8 @@ class CommonXssUnitTest extends DrupalUnitTestCase {
$url = 'javascript:http://www.example.com/?x=1&y=2';
$expected_plain = 'http://www.example.com/?x=1&y=2';
$expected_html = 'http://www.example.com/?x=1&amp;y=2';
- $this->assertIdentical(check_url($url), $expected_html, 'check_url() filters a URL and encodes it for HTML.');
- $this->assertIdentical(drupal_strip_dangerous_protocols($url), $expected_plain, 'drupal_strip_dangerous_protocols() filters a URL and returns plain text.');
+ $this->assertIdentical(check_url($url), $expected_html, t('check_url() filters a URL and encodes it for HTML.'));
+ $this->assertIdentical(drupal_strip_dangerous_protocols($url), $expected_plain, t('drupal_strip_dangerous_protocols() filters a URL and returns plain text.'));
}
}
@@ -533,11 +533,11 @@ class DrupalTagsHandlingTestCase extends DrupalWebTestCase {
$original = $this->validTags;
foreach ($tags as $tag) {
$key = array_search($tag, $original);
- $this->assertTrue($key, 'Make sure tag ' . $tag . ' shows up in the final tags array (originally ' . $key . ')');
+ $this->assertTrue($key, t('Make sure tag %tag shows up in the final tags array (originally %original)', array('%tag' => $tag, '%original' => $key)));
unset($original[$key]);
}
foreach ($original as $leftover) {
- $this->fail('Leftover tag ' . $leftover . ' was left over.');
+ $this->fail(t('Leftover tag %leftover was left over.', array('%leftover' => $leftover)));
}
}
}
@@ -564,7 +564,7 @@ class CascadingStylesheetsTestCase extends DrupalWebTestCase {
* Check default stylesheets as empty.
*/
function testDefault() {
- $this->assertEqual(array(), drupal_add_css(), 'Default CSS is empty.');
+ $this->assertEqual(array(), drupal_add_css(), t('Default CSS is empty.'));
}
/**
@@ -573,7 +573,7 @@ class CascadingStylesheetsTestCase extends DrupalWebTestCase {
function testAddFile() {
$path = drupal_get_path('module', 'simpletest') . '/simpletest.css';
$css = drupal_add_css($path);
- $this->assertEqual($css[$path]['data'], $path, 'Adding a CSS file caches it properly.');
+ $this->assertEqual($css[$path]['data'], $path, t('Adding a CSS file caches it properly.'));
}
/**
@@ -582,7 +582,7 @@ class CascadingStylesheetsTestCase extends DrupalWebTestCase {
function testAddExternal() {
$path = 'http://example.com/style.css';
$css = drupal_add_css($path, 'external');
- $this->assertEqual($css[$path]['type'], 'external', 'Adding an external CSS file caches it properly.');
+ $this->assertEqual($css[$path]['type'], 'external', t('Adding an external CSS file caches it properly.'));
}
/**
@@ -590,7 +590,7 @@ class CascadingStylesheetsTestCase extends DrupalWebTestCase {
*/
function testReset() {
drupal_static_reset('drupal_add_css');
- $this->assertEqual(array(), drupal_add_css(), 'Resetting the CSS empties the cache.');
+ $this->assertEqual(array(), drupal_add_css(), t('Resetting the CSS empties the cache.'));
}
/**
@@ -600,7 +600,7 @@ class CascadingStylesheetsTestCase extends DrupalWebTestCase {
$css = drupal_get_path('module', 'simpletest') . '/simpletest.css';
drupal_add_css($css);
$styles = drupal_get_css();
- $this->assertTrue(strpos($styles, $css) > 0, 'Rendered CSS includes the added stylesheet.');
+ $this->assertTrue(strpos($styles, $css) > 0, t('Rendered CSS includes the added stylesheet.'));
}
/**
@@ -612,7 +612,7 @@ class CascadingStylesheetsTestCase extends DrupalWebTestCase {
$styles = drupal_get_css();
// Stylesheet URL may be the href of a LINK tag or in an @import statement
// of a STYLE tag.
- $this->assertTrue(strpos($styles, 'href="' . $css) > 0 || strpos($styles, '@import url("' . $css . '")') > 0, 'Rendering an external CSS file.');
+ $this->assertTrue(strpos($styles, 'href="' . $css) > 0 || strpos($styles, '@import url("' . $css . '")') > 0, t('Rendering an external CSS file.'));
}
/**
@@ -623,7 +623,7 @@ class CascadingStylesheetsTestCase extends DrupalWebTestCase {
$css_preprocessed = '<style type="text/css" media="all">' . drupal_load_stylesheet_content($css, TRUE) . '</style>';
drupal_add_css($css, array('type' => 'inline', 'preprocess' => TRUE));
$styles = drupal_get_css();
- $this->assertEqual(trim($styles), $css_preprocessed, 'Rendering preprocessed inline CSS adds it to the page.');
+ $this->assertEqual(trim($styles), $css_preprocessed, t('Rendering preprocessed inline CSS adds it to the page.'));
}
/**
@@ -633,7 +633,7 @@ class CascadingStylesheetsTestCase extends DrupalWebTestCase {
$css = 'body { padding: 0px; }';
drupal_add_css($css, array('type' => 'inline'));
$styles = drupal_get_css();
- $this->assertTrue(strpos($styles, $css) > 0, 'Rendering non-preprocessed inline CSS adds it to the page.');
+ $this->assertTrue(strpos($styles, $css) > 0, t('Rendering non-preprocessed inline CSS adds it to the page.'));
}
/**
@@ -661,7 +661,7 @@ class CascadingStylesheetsTestCase extends DrupalWebTestCase {
// Fetch the page.
$this->drupalGet('node/' . $node->nid);
- $this->assertRaw($expected, 'Inline stylesheets appear in the full page rendering.');
+ $this->assertRaw($expected, t('Inline stylesheets appear in the full page rendering.'));
}
/**
@@ -694,7 +694,7 @@ class CascadingStylesheetsTestCase extends DrupalWebTestCase {
$result = array();
}
- $this->assertIdentical($result, $expected, 'The CSS files are in the expected order.');
+ $this->assertIdentical($result, $expected, t('The CSS files are in the expected order.'));
}
/**
@@ -706,16 +706,16 @@ class CascadingStylesheetsTestCase extends DrupalWebTestCase {
// The dummy stylesheet should be the only one included.
$styles = drupal_get_css();
- $this->assert(strpos($styles, drupal_get_path('module', 'simpletest') . '/tests/system.css') !== FALSE, 'The overriding CSS file is output.');
- $this->assert(strpos($styles, drupal_get_path('module', 'system') . '/system.css') === FALSE, 'The overriden CSS file is not output.');
+ $this->assert(strpos($styles, drupal_get_path('module', 'simpletest') . '/tests/system.css') !== FALSE, t('The overriding CSS file is output.'));
+ $this->assert(strpos($styles, drupal_get_path('module', 'system') . '/system.css') === FALSE, t('The overriden CSS file is not output.'));
drupal_add_css(drupal_get_path('module', 'simpletest') . '/tests/system.css');
drupal_add_css(drupal_get_path('module', 'system') . '/system.css');
// The standard stylesheet should be the only one included.
$styles = drupal_get_css();
- $this->assert(strpos($styles, drupal_get_path('module', 'system') . '/system.css') !== FALSE, 'The overriding CSS file is output.');
- $this->assert(strpos($styles, drupal_get_path('module', 'simpletest') . '/tests/system.css') === FALSE, 'The overriden CSS file is not output.');
+ $this->assert(strpos($styles, drupal_get_path('module', 'system') . '/system.css') !== FALSE, t('The overriding CSS file is output.'));
+ $this->assert(strpos($styles, drupal_get_path('module', 'simpletest') . '/tests/system.css') === FALSE, t('The overriden CSS file is not output.'));
}
/**
@@ -729,7 +729,7 @@ class CascadingStylesheetsTestCase extends DrupalWebTestCase {
// Check to see if system-rtl.css was also added.
$styles = drupal_get_css();
- $this->assert(strpos($styles, drupal_get_path('module', 'system') . '/system-rtl.css') !== FALSE, 'CSS is alterable as right to left overrides are added.');
+ $this->assert(strpos($styles, drupal_get_path('module', 'system') . '/system-rtl.css') !== FALSE, t('CSS is alterable as right to left overrides are added.'));
// Change the language back to left to right.
$language->direction = LANGUAGE_LTR;
@@ -742,7 +742,7 @@ class CascadingStylesheetsTestCase extends DrupalWebTestCase {
function testAddCssFileWithQueryString() {
$this->drupalGet('common-test/query-string');
$query_string = substr(variable_get('css_js_query_string', '0'), 0, 1);
- $this->assertRaw(drupal_get_path('module', 'node') . '/node.css?arg1=value1&amp;arg2=value2&amp;' . $query_string, 'Query string was appended correctly to css.');
+ $this->assertRaw(drupal_get_path('module', 'node') . '/node.css?arg1=value1&amp;arg2=value2&amp;' . $query_string, t('Query string was appended correctly to css.'));
}
}
@@ -764,14 +764,14 @@ class DrupalHTMLIdentifierTestCase extends DrupalUnitTestCase {
function testDrupalCleanCSSIdentifier() {
// Verify that no valid ASCII characters are stripped from the identifier.
$identifier = 'abcdefghijklmnopqrstuvwxyz_ABCDEFGHIJKLMNOPQRSTUVWXYZ-0123456789';
- $this->assertIdentical(drupal_clean_css_identifier($identifier, array()), $identifier, 'Verify valid ASCII characters pass through.');
+ $this->assertIdentical(drupal_clean_css_identifier($identifier, array()), $identifier, t('Verify valid ASCII characters pass through.'));
// Verify that valid UTF-8 characters are not stripped from the identifier.
$identifier = '¡¢£¤¥';
- $this->assertIdentical(drupal_clean_css_identifier($identifier, array()), $identifier, 'Verify valid UTF-8 characters pass through.');
+ $this->assertIdentical(drupal_clean_css_identifier($identifier, array()), $identifier, t('Verify valid UTF-8 characters pass through.'));
// Verify that invalid characters (including non-breaking space) are stripped from the identifier.
- $this->assertIdentical(drupal_clean_css_identifier('invalid !"#$%&\'()*+,./:;<=>?@[\\]^`{|}~ identifier', array()), 'invalididentifier', 'Strip invalid characters.');
+ $this->assertIdentical(drupal_clean_css_identifier('invalid !"#$%&\'()*+,./:;<=>?@[\\]^`{|}~ identifier', array()), 'invalididentifier', t('Strip invalid characters.'));
}
/**
@@ -779,7 +779,7 @@ class DrupalHTMLIdentifierTestCase extends DrupalUnitTestCase {
*/
function testDrupalHTMLClass() {
// Verify Drupal coding standards are enforced.
- $this->assertIdentical(drupal_html_class('CLASS NAME_[Ü]'), 'class-name--ü', 'Enforce Drupal coding standards.');
+ $this->assertIdentical(drupal_html_class('CLASS NAME_[Ü]'), 'class-name--ü', t('Enforce Drupal coding standards.'));
}
/**
@@ -788,21 +788,21 @@ class DrupalHTMLIdentifierTestCase extends DrupalUnitTestCase {
function testDrupalHTMLId() {
// Verify that letters, digits, and hyphens are not stripped from the ID.
$id = 'abcdefghijklmnopqrstuvwxyz-0123456789';
- $this->assertIdentical(drupal_html_id($id), $id, 'Verify valid characters pass through.');
+ $this->assertIdentical(drupal_html_id($id), $id, t('Verify valid characters pass through.'));
// Verify that invalid characters are stripped from the ID.
- $this->assertIdentical(drupal_html_id('invalid,./:@\\^`{Üidentifier'), 'invalididentifier', 'Strip invalid characters.');
+ $this->assertIdentical(drupal_html_id('invalid,./:@\\^`{Üidentifier'), 'invalididentifier', t('Strip invalid characters.'));
// Verify Drupal coding standards are enforced.
- $this->assertIdentical(drupal_html_id('ID NAME_[1]'), 'id-name-1', 'Enforce Drupal coding standards.');
+ $this->assertIdentical(drupal_html_id('ID NAME_[1]'), 'id-name-1', t('Enforce Drupal coding standards.'));
// Reset the static cache so we can ensure the unique id count is at zero.
drupal_static_reset('drupal_html_id');
// Clean up IDs with invalid starting characters.
- $this->assertIdentical(drupal_html_id('test-unique-id'), 'test-unique-id', 'Test the uniqueness of IDs #1.');
- $this->assertIdentical(drupal_html_id('test-unique-id'), 'test-unique-id--2', 'Test the uniqueness of IDs #2.');
- $this->assertIdentical(drupal_html_id('test-unique-id'), 'test-unique-id--3', 'Test the uniqueness of IDs #3.');
+ $this->assertIdentical(drupal_html_id('test-unique-id'), 'test-unique-id', t('Test the uniqueness of IDs #1.'));
+ $this->assertIdentical(drupal_html_id('test-unique-id'), 'test-unique-id--2', t('Test the uniqueness of IDs #2.'));
+ $this->assertIdentical(drupal_html_id('test-unique-id'), 'test-unique-id--3', t('Test the uniqueness of IDs #3.'));
}
}
@@ -841,11 +841,11 @@ class CascadingStylesheetsUnitTest extends DrupalUnitTestCase {
foreach ($testfiles as $file) {
$expected = file_get_contents("$path/$file.unoptimized.css");
$unoptimized_output = drupal_load_stylesheet("$path/$file.unoptimized.css", FALSE);
- $this->assertEqual($unoptimized_output, $expected, 'Unoptimized CSS file has expected contents (' . $file . ')');
+ $this->assertEqual($unoptimized_output, $expected, t('Unoptimized CSS file has expected contents (@file)', array('@file' => $file)));
$expected = file_get_contents("$path/$file.optimized.css");
$optimized_output = drupal_load_stylesheet("$path/$file", TRUE);
- $this->assertEqual($optimized_output, $expected, 'Optimized CSS file has expected contents (' . $file . ')');
+ $this->assertEqual($optimized_output, $expected, t('Optimized CSS file has expected contents (@file)', array('@file' => $file)));
}
}
}
@@ -871,24 +871,24 @@ class DrupalHTTPRequestTestCase extends DrupalWebTestCase {
// Parse URL schema.
$missing_scheme = drupal_http_request('example.com/path');
- $this->assertEqual($missing_scheme->code, -1002, 'Returned with "-1002" error code.');
- $this->assertEqual($missing_scheme->error, 'missing schema', 'Returned with "missing schema" error message.');
+ $this->assertEqual($missing_scheme->code, -1002, t('Returned with "-1002" error code.'));
+ $this->assertEqual($missing_scheme->error, 'missing schema', t('Returned with "missing schema" error message.'));
$unable_to_parse = drupal_http_request('http:///path');
- $this->assertEqual($unable_to_parse->code, -1001, 'Returned with "-1001" error code.');
- $this->assertEqual($unable_to_parse->error, 'unable to parse URL', 'Returned with "unable to parse URL" error message.');
+ $this->assertEqual($unable_to_parse->code, -1001, t('Returned with "-1001" error code.'));
+ $this->assertEqual($unable_to_parse->error, 'unable to parse URL', t('Returned with "unable to parse URL" error message.'));
// Fetch page.
$result = drupal_http_request(url('node', array('absolute' => TRUE)));
- $this->assertEqual($result->code, 200, 'Fetched page successfully.');
+ $this->assertEqual($result->code, 200, t('Fetched page successfully.'));
$this->drupalSetContent($result->data);
- $this->assertTitle(t('Welcome to @site-name | @site-name', array('@site-name' => variable_get('site_name', 'Drupal'))), 'Site title matches.');
+ $this->assertTitle(t('Welcome to @site-name | @site-name', array('@site-name' => variable_get('site_name', 'Drupal'))), t('Site title matches.'));
// Test that code and status message is returned.
$result = drupal_http_request(url('pagedoesnotexist', array('absolute' => TRUE)));
- $this->assertTrue(!empty($result->protocol), 'Result protocol is returned.');
- $this->assertEqual($result->code, '404', 'Result code is 404');
- $this->assertEqual($result->status_message, 'Not Found', 'Result status message is "Not Found"');
+ $this->assertTrue(!empty($result->protocol), t('Result protocol is returned.'));
+ $this->assertEqual($result->code, '404', t('Result code is 404'));
+ $this->assertEqual($result->status_message, 'Not Found', t('Result status message is "Not Found"'));
// Skip the timeout tests when the testing environment is HTTPS because
// stream_set_timeout() does not work for SSL connections.
@@ -903,9 +903,9 @@ class DrupalHTTPRequestTestCase extends DrupalWebTestCase {
timer_start(__METHOD__);
$result = drupal_http_request(url('system-test/sleep/10', array('absolute' => TRUE)), array('timeout' => 2));
$time = timer_read(__METHOD__) / 1000;
- $this->assertTrue(1.8 < $time && $time < 5, 'Request timed out (' . $time . ' seconds).');
- $this->assertTrue($result->error, 'An error message was returned.');
- $this->assertEqual($result->code, HTTP_REQUEST_TIMEOUT, 'Proper error code was returned.');
+ $this->assertTrue(1.8 < $time && $time < 5, t('Request timed out (%time seconds).', array('%time' => $time)));
+ $this->assertTrue($result->error, t('An error message was returned.'));
+ $this->assertEqual($result->code, HTTP_REQUEST_TIMEOUT, t('Proper error code was returned.'));
}
}
@@ -918,40 +918,40 @@ class DrupalHTTPRequestTestCase extends DrupalWebTestCase {
$result = drupal_http_request($auth);
$this->drupalSetContent($result->data);
- $this->assertRaw($username, '$_SERVER["PHP_AUTH_USER"] is passed correctly.');
- $this->assertRaw($password, '$_SERVER["PHP_AUTH_PW"] is passed correctly.');
+ $this->assertRaw($username, t('$_SERVER["PHP_AUTH_USER"] is passed correctly.'));
+ $this->assertRaw($password, t('$_SERVER["PHP_AUTH_PW"] is passed correctly.'));
}
function testDrupalHTTPRequestRedirect() {
$redirect_301 = drupal_http_request(url('system-test/redirect/301', array('absolute' => TRUE)), array('max_redirects' => 1));
- $this->assertEqual($redirect_301->redirect_code, 301, 'drupal_http_request follows the 301 redirect.');
+ $this->assertEqual($redirect_301->redirect_code, 301, t('drupal_http_request follows the 301 redirect.'));
$redirect_301 = drupal_http_request(url('system-test/redirect/301', array('absolute' => TRUE)), array('max_redirects' => 0));
- $this->assertFalse(isset($redirect_301->redirect_code), 'drupal_http_request does not follow 301 redirect if max_redirects = 0.');
+ $this->assertFalse(isset($redirect_301->redirect_code), t('drupal_http_request does not follow 301 redirect if max_redirects = 0.'));
$redirect_invalid = drupal_http_request(url('system-test/redirect-noscheme', array('absolute' => TRUE)), array('max_redirects' => 1));
- $this->assertEqual($redirect_invalid->code, -1002, '301 redirect to invalid URL returned with error code ' . $redirect_invalid->error . '.');
- $this->assertEqual($redirect_invalid->error, 'missing schema', '301 redirect to invalid URL returned with error message "' . $redirect_invalid->error . '".');
+ $this->assertEqual($redirect_invalid->code, -1002, t('301 redirect to invalid URL returned with error code !error.', array('!error' => $redirect_invalid->error)));
+ $this->assertEqual($redirect_invalid->error, 'missing schema', t('301 redirect to invalid URL returned with error message "!error".', array('!error' => $redirect_invalid->error)));
$redirect_invalid = drupal_http_request(url('system-test/redirect-noparse', array('absolute' => TRUE)), array('max_redirects' => 1));
- $this->assertEqual($redirect_invalid->code, -1001, '301 redirect to invalid URL returned with error message code "' . $redirect_invalid->error . '".');
- $this->assertEqual($redirect_invalid->error, 'unable to parse URL', '301 redirect to invalid URL returned with error message "' . $redirect_invalid->error . '".');
+ $this->assertEqual($redirect_invalid->code, -1001, t('301 redirect to invalid URL returned with error message code "!error".', array('!error' => $redirect_invalid->error)));
+ $this->assertEqual($redirect_invalid->error, 'unable to parse URL', t('301 redirect to invalid URL returned with error message "!error".', array('!error' => $redirect_invalid->error)));
$redirect_invalid = drupal_http_request(url('system-test/redirect-invalid-scheme', array('absolute' => TRUE)), array('max_redirects' => 1));
- $this->assertEqual($redirect_invalid->code, -1003, '301 redirect to invalid URL returned with error code ' . $redirect_invalid->error . '.');
- $this->assertEqual($redirect_invalid->error, 'invalid schema ftp', '301 redirect to invalid URL returned with error message "' . $redirect_invalid->error . '".');
+ $this->assertEqual($redirect_invalid->code, -1003, t('301 redirect to invalid URL returned with error code !error.', array('!error' => $redirect_invalid->error)));
+ $this->assertEqual($redirect_invalid->error, 'invalid schema ftp', t('301 redirect to invalid URL returned with error message "!error".', array('!error' => $redirect_invalid->error)));
$redirect_302 = drupal_http_request(url('system-test/redirect/302', array('absolute' => TRUE)), array('max_redirects' => 1));
- $this->assertEqual($redirect_302->redirect_code, 302, 'drupal_http_request follows the 302 redirect.');
+ $this->assertEqual($redirect_302->redirect_code, 302, t('drupal_http_request follows the 302 redirect.'));
$redirect_302 = drupal_http_request(url('system-test/redirect/302', array('absolute' => TRUE)), array('max_redirects' => 0));
- $this->assertFalse(isset($redirect_302->redirect_code), 'drupal_http_request does not follow 302 redirect if $retry = 0.');
+ $this->assertFalse(isset($redirect_302->redirect_code), t('drupal_http_request does not follow 302 redirect if $retry = 0.'));
$redirect_307 = drupal_http_request(url('system-test/redirect/307', array('absolute' => TRUE)), array('max_redirects' => 1));
- $this->assertEqual($redirect_307->redirect_code, 307, 'drupal_http_request follows the 307 redirect.');
+ $this->assertEqual($redirect_307->redirect_code, 307, t('drupal_http_request follows the 307 redirect.'));
$redirect_307 = drupal_http_request(url('system-test/redirect/307', array('absolute' => TRUE)), array('max_redirects' => 0));
- $this->assertFalse(isset($redirect_307->redirect_code), 'drupal_http_request does not follow 307 redirect if max_redirects = 0.');
+ $this->assertFalse(isset($redirect_307->redirect_code), t('drupal_http_request does not follow 307 redirect if max_redirects = 0.'));
}
}
@@ -990,13 +990,13 @@ class DrupalSetContentTestCase extends DrupalWebTestCase {
// Ensure drupal_get_region_content returns expected results when fetching all regions.
$content = drupal_get_region_content(NULL, $delimiter);
foreach ($content as $region => $region_content) {
- $this->assertEqual($region_content, $values[$region], $region . ' region text verified when fetching all regions');
+ $this->assertEqual($region_content, $values[$region], t('@region region text verified when fetching all regions', array('@region' => $region)));
}
// Ensure drupal_get_region_content returns expected results when fetching a single region.
foreach ($block_regions as $region) {
$region_content = drupal_get_region_content($region, $delimiter);
- $this->assertEqual($region_content, $values[$region], $region . ' region text verified when fetching single region.');
+ $this->assertEqual($region_content, $values[$region], t('@region region text verified when fetching single region.', array('@region' => $region)));
}
}
}
@@ -1024,23 +1024,23 @@ class DrupalGotoTest extends DrupalWebTestCase {
$this->drupalGet('common-test/drupal_goto/redirect');
$headers = $this->drupalGetHeaders(TRUE);
list(, $status) = explode(' ', $headers[0][':status'], 3);
- $this->assertEqual($status, 302, 'Expected response code was sent.');
- $this->assertText('drupal_goto', 'Drupal goto redirect succeeded.');
- $this->assertEqual($this->getUrl(), url('common-test/drupal_goto', array('absolute' => TRUE)), 'Drupal goto redirected to expected URL.');
+ $this->assertEqual($status, 302, t('Expected response code was sent.'));
+ $this->assertText('drupal_goto', t('Drupal goto redirect succeeded.'));
+ $this->assertEqual($this->getUrl(), url('common-test/drupal_goto', array('absolute' => TRUE)), t('Drupal goto redirected to expected URL.'));
$this->drupalGet('common-test/drupal_goto/redirect_advanced');
$headers = $this->drupalGetHeaders(TRUE);
list(, $status) = explode(' ', $headers[0][':status'], 3);
- $this->assertEqual($status, 301, 'Expected response code was sent.');
- $this->assertText('drupal_goto', 'Drupal goto redirect succeeded.');
- $this->assertEqual($this->getUrl(), url('common-test/drupal_goto', array('query' => array('foo' => '123'), 'absolute' => TRUE)), 'Drupal goto redirected to expected URL.');
+ $this->assertEqual($status, 301, t('Expected response code was sent.'));
+ $this->assertText('drupal_goto', t('Drupal goto redirect succeeded.'));
+ $this->assertEqual($this->getUrl(), url('common-test/drupal_goto', array('query' => array('foo' => '123'), 'absolute' => TRUE)), t('Drupal goto redirected to expected URL.'));
// Test that drupal_goto() respects ?destination=xxx. Use an complicated URL
// to test that the path is encoded and decoded properly.
$destination = 'common-test/drupal_goto/destination?foo=%2525&bar=123';
$this->drupalGet('common-test/drupal_goto/redirect', array('query' => array('destination' => $destination)));
- $this->assertText('drupal_goto', 'Drupal goto redirect with destination succeeded.');
- $this->assertEqual($this->getUrl(), url('common-test/drupal_goto/destination', array('query' => array('foo' => '%25', 'bar' => '123'), 'absolute' => TRUE)), 'Drupal goto redirected to given query string destination. ');
+ $this->assertText('drupal_goto', t('Drupal goto redirect with destination succeeded.'));
+ $this->assertEqual($this->getUrl(), url('common-test/drupal_goto/destination', array('query' => array('foo' => '%25', 'bar' => '123'), 'absolute' => TRUE)), t('Drupal goto redirected to given query string destination. '));
}
/**
@@ -1049,8 +1049,8 @@ class DrupalGotoTest extends DrupalWebTestCase {
function testDrupalGotoAlter() {
$this->drupalGet('common-test/drupal_goto/redirect_fail');
- $this->assertNoText(t("Drupal goto failed to stop program"), "Drupal goto stopped program.");
- $this->assertNoText('drupal_goto_fail', "Drupal goto redirect failed.");
+ $this->assertNoText(t("Drupal goto failed to stop program"), t("Drupal goto stopped program."));
+ $this->assertNoText('drupal_goto_fail', t("Drupal goto redirect failed."));
}
/**
@@ -1061,12 +1061,12 @@ class DrupalGotoTest extends DrupalWebTestCase {
// Verify that a 'destination' query string is used as destination.
$this->drupalGet('common-test/destination', array('query' => array('destination' => $query)));
- $this->assertText('The destination: ' . $query, 'The given query string destination is determined as destination.');
+ $this->assertText('The destination: ' . $query, t('The given query string destination is determined as destination.'));
// Verify that the current path is used as destination.
$this->drupalGet('common-test/destination', array('query' => array($query => NULL)));
$url = 'common-test/destination?' . $query;
- $this->assertText('The destination: ' . $url, 'The current path is determined as destination.');
+ $this->assertText('The destination: ' . $url, t('The current path is determined as destination.'));
}
}
@@ -1110,7 +1110,7 @@ class JavaScriptTestCase extends DrupalWebTestCase {
* Test default JavaScript is empty.
*/
function testDefault() {
- $this->assertEqual(array(), drupal_add_js(), 'Default JavaScript is empty.');
+ $this->assertEqual(array(), drupal_add_js(), t('Default JavaScript is empty.'));
}
/**
@@ -1118,10 +1118,10 @@ class JavaScriptTestCase extends DrupalWebTestCase {
*/
function testAddFile() {
$javascript = drupal_add_js('misc/collapse.js');
- $this->assertTrue(array_key_exists('misc/jquery.js', $javascript), 'jQuery is added when a file is added.');
- $this->assertTrue(array_key_exists('misc/drupal.js', $javascript), 'Drupal.js is added when file is added.');
- $this->assertTrue(array_key_exists('misc/collapse.js', $javascript), 'JavaScript files are correctly added.');
- $this->assertEqual(base_path(), $javascript['settings']['data'][0]['basePath'], 'Base path JavaScript setting is correctly set.');
+ $this->assertTrue(array_key_exists('misc/jquery.js', $javascript), t('jQuery is added when a file is added.'));
+ $this->assertTrue(array_key_exists('misc/drupal.js', $javascript), t('Drupal.js is added when file is added.'));
+ $this->assertTrue(array_key_exists('misc/collapse.js', $javascript), t('JavaScript files are correctly added.'));
+ $this->assertEqual(base_path(), $javascript['settings']['data'][0]['basePath'], t('Base path JavaScript setting is correctly set.'));
}
/**
@@ -1129,8 +1129,8 @@ class JavaScriptTestCase extends DrupalWebTestCase {
*/
function testAddSetting() {
$javascript = drupal_add_js(array('drupal' => 'rocks', 'dries' => 280342800), 'setting');
- $this->assertEqual(280342800, $javascript['settings']['data'][1]['dries'], 'JavaScript setting is set correctly.');
- $this->assertEqual('rocks', $javascript['settings']['data'][1]['drupal'], 'The other JavaScript setting is set correctly.');
+ $this->assertEqual(280342800, $javascript['settings']['data'][1]['dries'], t('JavaScript setting is set correctly.'));
+ $this->assertEqual('rocks', $javascript['settings']['data'][1]['drupal'], t('The other JavaScript setting is set correctly.'));
}
/**
@@ -1139,7 +1139,7 @@ class JavaScriptTestCase extends DrupalWebTestCase {
function testAddExternal() {
$path = 'http://example.com/script.js';
$javascript = drupal_add_js($path, 'external');
- $this->assertTrue(array_key_exists('http://example.com/script.js', $javascript), 'Added an external JavaScript file.');
+ $this->assertTrue(array_key_exists('http://example.com/script.js', $javascript), t('Added an external JavaScript file.'));
}
/**
@@ -1148,9 +1148,9 @@ class JavaScriptTestCase extends DrupalWebTestCase {
function testHeaderSetting() {
drupal_add_js(array('testSetting' => 'testValue'), 'setting');
$javascript = drupal_get_js('header');
- $this->assertTrue(strpos($javascript, 'basePath') > 0, 'Rendered JavaScript header returns basePath setting.');
- $this->assertTrue(strpos($javascript, 'testSetting') > 0, 'Rendered JavaScript header returns custom setting.');
- $this->assertTrue(strpos($javascript, 'misc/jquery.js') > 0, 'Rendered JavaScript header includes jQuery.');
+ $this->assertTrue(strpos($javascript, 'basePath') > 0, t('Rendered JavaScript header returns basePath setting.'));
+ $this->assertTrue(strpos($javascript, 'testSetting') > 0, t('Rendered JavaScript header returns custom setting.'));
+ $this->assertTrue(strpos($javascript, 'misc/jquery.js') > 0, t('Rendered JavaScript header includes jQuery.'));
}
/**
@@ -1159,7 +1159,7 @@ class JavaScriptTestCase extends DrupalWebTestCase {
function testReset() {
drupal_add_js('misc/collapse.js');
drupal_static_reset('drupal_add_js');
- $this->assertEqual(array(), drupal_add_js(), 'Resetting the JavaScript correctly empties the cache.');
+ $this->assertEqual(array(), drupal_add_js(), t('Resetting the JavaScript correctly empties the cache.'));
}
/**
@@ -1168,9 +1168,9 @@ class JavaScriptTestCase extends DrupalWebTestCase {
function testAddInline() {
$inline = 'jQuery(function () { });';
$javascript = drupal_add_js($inline, array('type' => 'inline', 'scope' => 'footer'));
- $this->assertTrue(array_key_exists('misc/jquery.js', $javascript), 'jQuery is added when inline scripts are added.');
+ $this->assertTrue(array_key_exists('misc/jquery.js', $javascript), t('jQuery is added when inline scripts are added.'));
$data = end($javascript);
- $this->assertEqual($inline, $data['data'], 'Inline JavaScript is correctly added to the footer.');
+ $this->assertEqual($inline, $data['data'], t('Inline JavaScript is correctly added to the footer.'));
}
/**
@@ -1181,7 +1181,7 @@ class JavaScriptTestCase extends DrupalWebTestCase {
drupal_add_js($external, 'external');
$javascript = drupal_get_js();
// Local files have a base_path() prefix, external files should not.
- $this->assertTrue(strpos($javascript, 'src="' . $external) > 0, 'Rendering an external JavaScript file.');
+ $this->assertTrue(strpos($javascript, 'src="' . $external) > 0, t('Rendering an external JavaScript file.'));
}
/**
@@ -1191,7 +1191,7 @@ class JavaScriptTestCase extends DrupalWebTestCase {
$inline = 'jQuery(function () { });';
drupal_add_js($inline, array('type' => 'inline', 'scope' => 'footer'));
$javascript = drupal_get_js('footer');
- $this->assertTrue(strpos($javascript, $inline) > 0, 'Rendered JavaScript footer returns the inline code.');
+ $this->assertTrue(strpos($javascript, $inline) > 0, t('Rendered JavaScript footer returns the inline code.'));
}
/**
@@ -1199,7 +1199,7 @@ class JavaScriptTestCase extends DrupalWebTestCase {
*/
function testNoCache() {
$javascript = drupal_add_js('misc/collapse.js', array('cache' => FALSE));
- $this->assertFalse($javascript['misc/collapse.js']['preprocess'], 'Setting cache to FALSE sets proprocess to FALSE when adding JavaScript.');
+ $this->assertFalse($javascript['misc/collapse.js']['preprocess'], t('Setting cache to FALSE sets proprocess to FALSE when adding JavaScript.'));
}
/**
@@ -1207,7 +1207,7 @@ class JavaScriptTestCase extends DrupalWebTestCase {
*/
function testDifferentWeight() {
$javascript = drupal_add_js('misc/collapse.js', array('weight' => JS_THEME));
- $this->assertEqual($javascript['misc/collapse.js']['weight'], JS_THEME, 'Adding a JavaScript file with a different weight caches the given weight.');
+ $this->assertEqual($javascript['misc/collapse.js']['weight'], JS_THEME, t('Adding a JavaScript file with a different weight caches the given weight.'));
}
/**
@@ -1249,7 +1249,7 @@ class JavaScriptTestCase extends DrupalWebTestCase {
else {
$result = array();
}
- $this->assertIdentical($result, $expected, 'JavaScript is added in the expected weight order.');
+ $this->assertIdentical($result, $expected, t('JavaScript is added in the expected weight order.'));
}
/**
@@ -1258,7 +1258,7 @@ class JavaScriptTestCase extends DrupalWebTestCase {
function testRenderDifferentWeight() {
drupal_add_js('misc/collapse.js', array('weight' => JS_LIBRARY - 21));
$javascript = drupal_get_js();
- $this->assertTrue(strpos($javascript, 'misc/collapse.js') < strpos($javascript, 'misc/jquery.js'), 'Rendering a JavaScript file above jQuery.');
+ $this->assertTrue(strpos($javascript, 'misc/collapse.js') < strpos($javascript, 'misc/jquery.js'), t('Rendering a JavaScript file above jQuery.'));
}
/**
@@ -1275,7 +1275,7 @@ class JavaScriptTestCase extends DrupalWebTestCase {
// tableselect.js. See simpletest_js_alter() to see where this alteration
// takes place.
$javascript = drupal_get_js();
- $this->assertTrue(strpos($javascript, 'simpletest.js') < strpos($javascript, 'misc/tableselect.js'), 'Altering JavaScript weight through the alter hook.');
+ $this->assertTrue(strpos($javascript, 'simpletest.js') < strpos($javascript, 'misc/tableselect.js'), t('Altering JavaScript weight through the alter hook.'));
}
/**
@@ -1283,11 +1283,11 @@ class JavaScriptTestCase extends DrupalWebTestCase {
*/
function testLibraryRender() {
$result = drupal_add_library('system', 'farbtastic');
- $this->assertTrue($result !== FALSE, 'Library was added without errors.');
+ $this->assertTrue($result !== FALSE, t('Library was added without errors.'));
$scripts = drupal_get_js();
$styles = drupal_get_css();
- $this->assertTrue(strpos($scripts, 'misc/farbtastic/farbtastic.js'), 'JavaScript of library was added to the page.');
- $this->assertTrue(strpos($styles, 'misc/farbtastic/farbtastic.css'), 'Stylesheet of library was added to the page.');
+ $this->assertTrue(strpos($scripts, 'misc/farbtastic/farbtastic.js'), t('JavaScript of library was added to the page.'));
+ $this->assertTrue(strpos($styles, 'misc/farbtastic/farbtastic.css'), t('Stylesheet of library was added to the page.'));
}
/**
@@ -1298,12 +1298,12 @@ class JavaScriptTestCase extends DrupalWebTestCase {
function testLibraryAlter() {
// Verify that common_test altered the title of Farbtastic.
$library = drupal_get_library('system', 'farbtastic');
- $this->assertEqual($library['title'], 'Farbtastic: Altered Library', 'Registered libraries were altered.');
+ $this->assertEqual($library['title'], 'Farbtastic: Altered Library', t('Registered libraries were altered.'));
// common_test_library_alter() also added a dependency on jQuery Form.
drupal_add_library('system', 'farbtastic');
$scripts = drupal_get_js();
- $this->assertTrue(strpos($scripts, 'misc/jquery.form.js'), 'Altered library dependencies are added to the page.');
+ $this->assertTrue(strpos($scripts, 'misc/jquery.form.js'), t('Altered library dependencies are added to the page.'));
}
/**
@@ -1313,7 +1313,7 @@ class JavaScriptTestCase extends DrupalWebTestCase {
*/
function testLibraryNameConflicts() {
$farbtastic = drupal_get_library('common_test', 'farbtastic');
- $this->assertEqual($farbtastic['title'], 'Custom Farbtastic Library', 'Alternative libraries can be added to the page.');
+ $this->assertEqual($farbtastic['title'], 'Custom Farbtastic Library', t('Alternative libraries can be added to the page.'));
}
/**
@@ -1321,13 +1321,13 @@ class JavaScriptTestCase extends DrupalWebTestCase {
*/
function testLibraryUnknown() {
$result = drupal_get_library('unknown', 'unknown');
- $this->assertFalse($result, 'Unknown library returned FALSE.');
+ $this->assertFalse($result, t('Unknown library returned FALSE.'));
drupal_static_reset('drupal_get_library');
$result = drupal_add_library('unknown', 'unknown');
- $this->assertFalse($result, 'Unknown library returned FALSE.');
+ $this->assertFalse($result, t('Unknown library returned FALSE.'));
$scripts = drupal_get_js();
- $this->assertTrue(strpos($scripts, 'unknown') === FALSE, 'Unknown library was not added to the page.');
+ $this->assertTrue(strpos($scripts, 'unknown') === FALSE, t('Unknown library was not added to the page.'));
}
/**
@@ -1337,7 +1337,7 @@ class JavaScriptTestCase extends DrupalWebTestCase {
$element['#attached']['library'][] = array('system', 'farbtastic');
drupal_render($element);
$scripts = drupal_get_js();
- $this->assertTrue(strpos($scripts, 'misc/farbtastic/farbtastic.js'), 'The attached_library property adds the additional libraries.');
+ $this->assertTrue(strpos($scripts, 'misc/farbtastic/farbtastic.js'), t('The attached_library property adds the additional libraries.'));
}
/**
@@ -1347,7 +1347,7 @@ class JavaScriptTestCase extends DrupalWebTestCase {
function testAddJsFileWithQueryString() {
$this->drupalGet('common-test/query-string');
$query_string = substr(variable_get('css_js_query_string', '0'), 0, 1);
- $this->assertRaw(drupal_get_path('module', 'node') . '/node.js?arg1=value1&amp;arg2=value2&amp;' . $query_string, 'Query string was appended correctly to js.');
+ $this->assertRaw(drupal_get_path('module', 'node') . '/node.js?arg1=value1&amp;arg2=value2&amp;' . $query_string, t('Query string was appended correctly to js.'));
}
}
@@ -1387,17 +1387,17 @@ class DrupalRenderUnitTestCase extends DrupalWebTestCase {
$output = drupal_render($elements);
// The lowest weight element should appear last in $output.
- $this->assertTrue(strpos($output, $second) > strpos($output, $first), 'Elements were sorted correctly by weight.');
+ $this->assertTrue(strpos($output, $second) > strpos($output, $first), t('Elements were sorted correctly by weight.'));
// Confirm that the $elements array has '#sorted' set to TRUE.
- $this->assertTrue($elements['#sorted'], "'#sorted' => TRUE was added to the array");
+ $this->assertTrue($elements['#sorted'], t("'#sorted' => TRUE was added to the array"));
// Pass $elements through element_children() and ensure it remains
// sorted in the correct order. drupal_render() will return an empty string
// if used on the same array in the same request.
$children = element_children($elements);
- $this->assertTrue(array_shift($children) == 'first', 'Child found in the correct order.');
- $this->assertTrue(array_shift($children) == 'second', 'Child found in the correct order.');
+ $this->assertTrue(array_shift($children) == 'first', t('Child found in the correct order.'));
+ $this->assertTrue(array_shift($children) == 'second', t('Child found in the correct order.'));
// The same array structure again, but with #sorted set to TRUE.
@@ -1415,7 +1415,7 @@ class DrupalRenderUnitTestCase extends DrupalWebTestCase {
$output = drupal_render($elements);
// The elements should appear in output in the same order as the array.
- $this->assertTrue(strpos($output, $second) < strpos($output, $first), 'Elements were not sorted.');
+ $this->assertTrue(strpos($output, $second) < strpos($output, $first), t('Elements were not sorted.'));
}
/**
@@ -1479,7 +1479,7 @@ class ValidUrlTestCase extends DrupalUnitTestCase {
foreach ($valid_absolute_urls as $url) {
$test_url = $scheme . '://' . $url;
$valid_url = valid_url($test_url, TRUE);
- $this->assertTrue($valid_url, $test_url . ' is a valid url.');
+ $this->assertTrue($valid_url, t('@url is a valid url.', array('@url' => $test_url)));
}
}
}
@@ -1499,7 +1499,7 @@ class ValidUrlTestCase extends DrupalUnitTestCase {
foreach ($invalid_ablosule_urls as $url) {
$test_url = $scheme . '://' . $url;
$valid_url = valid_url($test_url, TRUE);
- $this->assertFalse($valid_url, $test_url . ' is NOT a valid url.');
+ $this->assertFalse($valid_url, t('@url is NOT a valid url.', array('@url' => $test_url)));
}
}
}
@@ -1520,7 +1520,7 @@ class ValidUrlTestCase extends DrupalUnitTestCase {
foreach ($valid_relative_urls as $url) {
$test_url = $front . $url;
$valid_url = valid_url($test_url);
- $this->assertTrue($valid_url, $test_url . ' is a valid url.');
+ $this->assertTrue($valid_url, t('@url is a valid url.', array('@url' => $test_url)));
}
}
}
@@ -1539,7 +1539,7 @@ class ValidUrlTestCase extends DrupalUnitTestCase {
foreach ($invalid_relative_urls as $url) {
$test_url = $front . $url;
$valid_url = valid_url($test_url);
- $this->assertFALSE($valid_url, $test_url . ' is NOT a valid url.');
+ $this->assertFALSE($valid_url, t('@url is NOT a valid url.', array('@url' => $test_url)));
}
}
}
@@ -1570,30 +1570,30 @@ class DrupalDataApiTest extends DrupalWebTestCase {
$person->name = 'John';
$person->unknown_column = 123;
$insert_result = drupal_write_record('test', $person);
- $this->assertTrue($insert_result == SAVED_NEW, 'Correct value returned when a record is inserted with drupal_write_record() for a table with a single-field primary key.');
- $this->assertTrue(isset($person->id), 'Primary key is set on record created with drupal_write_record().');
- $this->assertIdentical($person->age, 0, 'Age field set to default value.');
- $this->assertIdentical($person->job, 'Undefined', 'Job field set to default value.');
+ $this->assertTrue($insert_result == SAVED_NEW, t('Correct value returned when a record is inserted with drupal_write_record() for a table with a single-field primary key.'));
+ $this->assertTrue(isset($person->id), t('Primary key is set on record created with drupal_write_record().'));
+ $this->assertIdentical($person->age, 0, t('Age field set to default value.'));
+ $this->assertIdentical($person->job, 'Undefined', t('Job field set to default value.'));
// Verify that the record was inserted.
$result = db_query("SELECT * FROM {test} WHERE id = :id", array(':id' => $person->id))->fetchObject();
- $this->assertIdentical($result->name, 'John', 'Name field set.');
- $this->assertIdentical($result->age, '0', 'Age field set to default value.');
- $this->assertIdentical($result->job, 'Undefined', 'Job field set to default value.');
- $this->assertFalse(isset($result->unknown_column), 'Unknown column was ignored.');
+ $this->assertIdentical($result->name, 'John', t('Name field set.'));
+ $this->assertIdentical($result->age, '0', t('Age field set to default value.'));
+ $this->assertIdentical($result->job, 'Undefined', t('Job field set to default value.'));
+ $this->assertFalse(isset($result->unknown_column), t('Unknown column was ignored.'));
// Update the newly created record.
$person->name = 'Peter';
$person->age = 27;
$person->job = NULL;
$update_result = drupal_write_record('test', $person, array('id'));
- $this->assertTrue($update_result == SAVED_UPDATED, 'Correct value returned when a record updated with drupal_write_record() for table with single-field primary key.');
+ $this->assertTrue($update_result == SAVED_UPDATED, t('Correct value returned when a record updated with drupal_write_record() for table with single-field primary key.'));
// Verify that the record was updated.
$result = db_query("SELECT * FROM {test} WHERE id = :id", array(':id' => $person->id))->fetchObject();
- $this->assertIdentical($result->name, 'Peter', 'Name field set.');
- $this->assertIdentical($result->age, '27', 'Age field set.');
- $this->assertIdentical($result->job, '', 'Job field set and cast to string.');
+ $this->assertIdentical($result->name, 'Peter', t('Name field set.'));
+ $this->assertIdentical($result->age, '27', t('Age field set.'));
+ $this->assertIdentical($result->job, '', t('Job field set and cast to string.'));
// Try to insert NULL in columns that does not allow this.
$person = new stdClass();
@@ -1601,65 +1601,65 @@ class DrupalDataApiTest extends DrupalWebTestCase {
$person->age = NULL;
$person->job = NULL;
$insert_result = drupal_write_record('test', $person);
- $this->assertTrue(isset($person->id), 'Primary key is set on record created with drupal_write_record().');
+ $this->assertTrue(isset($person->id), t('Primary key is set on record created with drupal_write_record().'));
$result = db_query("SELECT * FROM {test} WHERE id = :id", array(':id' => $person->id))->fetchObject();
- $this->assertIdentical($result->name, 'Ringo', 'Name field set.');
- $this->assertIdentical($result->age, '0', 'Age field set.');
- $this->assertIdentical($result->job, '', 'Job field set.');
+ $this->assertIdentical($result->name, 'Ringo', t('Name field set.'));
+ $this->assertIdentical($result->age, '0', t('Age field set.'));
+ $this->assertIdentical($result->job, '', t('Job field set.'));
// Insert a record - the "age" column allows NULL.
$person = new stdClass();
$person->name = 'Paul';
$person->age = NULL;
$insert_result = drupal_write_record('test_null', $person);
- $this->assertTrue(isset($person->id), 'Primary key is set on record created with drupal_write_record().');
+ $this->assertTrue(isset($person->id), t('Primary key is set on record created with drupal_write_record().'));
$result = db_query("SELECT * FROM {test_null} WHERE id = :id", array(':id' => $person->id))->fetchObject();
- $this->assertIdentical($result->name, 'Paul', 'Name field set.');
- $this->assertIdentical($result->age, NULL, 'Age field set.');
+ $this->assertIdentical($result->name, 'Paul', t('Name field set.'));
+ $this->assertIdentical($result->age, NULL, t('Age field set.'));
// Insert a record - do not specify the value of a column that allows NULL.
$person = new stdClass();
$person->name = 'Meredith';
$insert_result = drupal_write_record('test_null', $person);
- $this->assertTrue(isset($person->id), 'Primary key is set on record created with drupal_write_record().');
- $this->assertIdentical($person->age, 0, 'Age field set to default value.');
+ $this->assertTrue(isset($person->id), t('Primary key is set on record created with drupal_write_record().'));
+ $this->assertIdentical($person->age, 0, t('Age field set to default value.'));
$result = db_query("SELECT * FROM {test_null} WHERE id = :id", array(':id' => $person->id))->fetchObject();
- $this->assertIdentical($result->name, 'Meredith', 'Name field set.');
- $this->assertIdentical($result->age, '0', 'Age field set to default value.');
+ $this->assertIdentical($result->name, 'Meredith', t('Name field set.'));
+ $this->assertIdentical($result->age, '0', t('Age field set to default value.'));
// Update the newly created record.
$person->name = 'Mary';
$person->age = NULL;
$update_result = drupal_write_record('test_null', $person, array('id'));
$result = db_query("SELECT * FROM {test_null} WHERE id = :id", array(':id' => $person->id))->fetchObject();
- $this->assertIdentical($result->name, 'Mary', 'Name field set.');
- $this->assertIdentical($result->age, NULL, 'Age field set.');
+ $this->assertIdentical($result->name, 'Mary', t('Name field set.'));
+ $this->assertIdentical($result->age, NULL, t('Age field set.'));
// Insert a record - the "data" column should be serialized.
$person = new stdClass();
$person->name = 'Dave';
$update_result = drupal_write_record('test_serialized', $person);
$result = db_query("SELECT * FROM {test_serialized} WHERE id = :id", array(':id' => $person->id))->fetchObject();
- $this->assertIdentical($result->name, 'Dave', 'Name field set.');
- $this->assertIdentical($result->info, NULL, 'Info field set.');
+ $this->assertIdentical($result->name, 'Dave', t('Name field set.'));
+ $this->assertIdentical($result->info, NULL, t('Info field set.'));
$person->info = array();
$update_result = drupal_write_record('test_serialized', $person, array('id'));
$result = db_query("SELECT * FROM {test_serialized} WHERE id = :id", array(':id' => $person->id))->fetchObject();
- $this->assertIdentical(unserialize($result->info), array(), 'Info field updated.');
+ $this->assertIdentical(unserialize($result->info), array(), t('Info field updated.'));
// Update the serialized record.
$data = array('foo' => 'bar', 1 => 2, 'empty' => '', 'null' => NULL);
$person->info = $data;
$update_result = drupal_write_record('test_serialized', $person, array('id'));
$result = db_query("SELECT * FROM {test_serialized} WHERE id = :id", array(':id' => $person->id))->fetchObject();
- $this->assertIdentical(unserialize($result->info), $data, 'Info field updated.');
+ $this->assertIdentical(unserialize($result->info), $data, t('Info field updated.'));
// Run an update query where no field values are changed. The database
// layer should return zero for number of affected rows, but
// db_write_record() should still return SAVED_UPDATED.
$update_result = drupal_write_record('test_null', $person, array('id'));
- $this->assertTrue($update_result == SAVED_UPDATED, 'Correct value returned when a valid update is run without changing any values.');
+ $this->assertTrue($update_result == SAVED_UPDATED, t('Correct value returned when a valid update is run without changing any values.'));
// Insert an object record for a table with a multi-field primary key.
$node_access = new stdClass();
@@ -1667,11 +1667,11 @@ class DrupalDataApiTest extends DrupalWebTestCase {
$node_access->gid = mt_rand();
$node_access->realm = $this->randomName();
$insert_result = drupal_write_record('node_access', $node_access);
- $this->assertTrue($insert_result == SAVED_NEW, 'Correct value returned when a record is inserted with drupal_write_record() for a table with a multi-field primary key.');
+ $this->assertTrue($insert_result == SAVED_NEW, t('Correct value returned when a record is inserted with drupal_write_record() for a table with a multi-field primary key.'));
// Update the record.
$update_result = drupal_write_record('node_access', $node_access, array('nid', 'gid', 'realm'));
- $this->assertTrue($update_result == SAVED_UPDATED, 'Correct value returned when a record is updated with drupal_write_record() for a table with a multi-field primary key.');
+ $this->assertTrue($update_result == SAVED_UPDATED, t('Correct value returned when a record is updated with drupal_write_record() for a table with a multi-field primary key.'));
}
}
@@ -1709,7 +1709,7 @@ class DrupalErrorCollectionUnitTest extends DrupalWebTestCase {
function testErrorCollect() {
$this->collectedErrors = array();
$this->drupalGet('error-test/generate-warnings-with-report');
- $this->assertEqual(count($this->collectedErrors), 3, 'Three errors were collected');
+ $this->assertEqual(count($this->collectedErrors), 3, t('Three errors were collected'));
if (count($this->collectedErrors) == 3) {
$this->assertError($this->collectedErrors[0], 'Notice', 'error_test_generate_warnings()', 'error_test.module', 'Undefined variable: bananas');
@@ -1738,11 +1738,11 @@ class DrupalErrorCollectionUnitTest extends DrupalWebTestCase {
* Assert that a collected error matches what we are expecting.
*/
function assertError($error, $group, $function, $file, $message = NULL) {
- $this->assertEqual($error['group'], $group, "Group was " . $group . "");
- $this->assertEqual($error['caller']['function'], $function, "Function was " . $function . "");
- $this->assertEqual(basename($error['caller']['file']), $file, "File was " . $file . "");
+ $this->assertEqual($error['group'], $group, t("Group was %group", array('%group' => $group)));
+ $this->assertEqual($error['caller']['function'], $function, t("Function was %function", array('%function' => $function)));
+ $this->assertEqual(basename($error['caller']['file']), $file, t("File was %file", array('%file' => $file)));
if (isset($message)) {
- $this->assertEqual($error['message'], $message, "Message was " . $message . "");
+ $this->assertEqual($error['message'], $message, t("Message was %message", array('%message' => $message)));
}
}
}
@@ -1764,9 +1764,9 @@ class ParseInfoFilesTestCase extends DrupalWebTestCase {
*/
function testParseInfoFile() {
$info_values = drupal_parse_info_file(drupal_get_path('module', 'simpletest') . '/tests/common_test_info.txt');
- $this->assertEqual($info_values['simple_string'], 'A simple string', 'Simple string value was parsed correctly.', 'System');
- $this->assertEqual($info_values['simple_constant'], WATCHDOG_INFO, 'Constant value was parsed correctly.', 'System');
- $this->assertEqual($info_values['double_colon'], 'dummyClassName::', 'Value containing double-colon was parsed correctly.', 'System');
+ $this->assertEqual($info_values['simple_string'], 'A simple string', t('Simple string value was parsed correctly.'), t('System'));
+ $this->assertEqual($info_values['simple_constant'], WATCHDOG_INFO, t('Constant value was parsed correctly.'), t('System'));
+ $this->assertEqual($info_values['double_colon'], 'dummyClassName::', t('Value containing double-colon was parsed correctly.'), t('System'));
}
}
@@ -1808,12 +1808,12 @@ class FormatDateUnitTest extends DrupalWebTestCase {
global $user, $language;
$timestamp = strtotime('2007-03-26T00:00:00+00:00');
- $this->assertIdentical(format_date($timestamp, 'custom', 'l, d-M-y H:i:s T', 'America/Los_Angeles', 'en'), 'Sunday, 25-Mar-07 17:00:00 PDT', 'Test all parameters.');
- $this->assertIdentical(format_date($timestamp, 'custom', 'l, d-M-y H:i:s T', 'America/Los_Angeles', self::LANGCODE), 'domingo, 25-Mar-07 17:00:00 PDT', 'Test translated format.');
- $this->assertIdentical(format_date($timestamp, 'custom', '\\l, d-M-y H:i:s T', 'America/Los_Angeles', self::LANGCODE), 'l, 25-Mar-07 17:00:00 PDT', 'Test an escaped format string.');
- $this->assertIdentical(format_date($timestamp, 'custom', '\\\\l, d-M-y H:i:s T', 'America/Los_Angeles', self::LANGCODE), '\\domingo, 25-Mar-07 17:00:00 PDT', 'Test format containing backslash character.');
- $this->assertIdentical(format_date($timestamp, 'custom', '\\\\\\l, d-M-y H:i:s T', 'America/Los_Angeles', self::LANGCODE), '\\l, 25-Mar-07 17:00:00 PDT', 'Test format containing backslash followed by escaped format string.');
- $this->assertIdentical(format_date($timestamp, 'custom', 'l, d-M-y H:i:s T', 'Europe/London', 'en'), 'Monday, 26-Mar-07 01:00:00 BST', 'Test a different time zone.');
+ $this->assertIdentical(format_date($timestamp, 'custom', 'l, d-M-y H:i:s T', 'America/Los_Angeles', 'en'), 'Sunday, 25-Mar-07 17:00:00 PDT', t('Test all parameters.'));
+ $this->assertIdentical(format_date($timestamp, 'custom', 'l, d-M-y H:i:s T', 'America/Los_Angeles', self::LANGCODE), 'domingo, 25-Mar-07 17:00:00 PDT', t('Test translated format.'));
+ $this->assertIdentical(format_date($timestamp, 'custom', '\\l, d-M-y H:i:s T', 'America/Los_Angeles', self::LANGCODE), 'l, 25-Mar-07 17:00:00 PDT', t('Test an escaped format string.'));
+ $this->assertIdentical(format_date($timestamp, 'custom', '\\\\l, d-M-y H:i:s T', 'America/Los_Angeles', self::LANGCODE), '\\domingo, 25-Mar-07 17:00:00 PDT', t('Test format containing backslash character.'));
+ $this->assertIdentical(format_date($timestamp, 'custom', '\\\\\\l, d-M-y H:i:s T', 'America/Los_Angeles', self::LANGCODE), '\\l, 25-Mar-07 17:00:00 PDT', t('Test format containing backslash followed by escaped format string.'));
+ $this->assertIdentical(format_date($timestamp, 'custom', 'l, d-M-y H:i:s T', 'Europe/London', 'en'), 'Monday, 26-Mar-07 01:00:00 BST', t('Test a different time zone.'));
// Create an admin user and add Spanish language.
$admin_user = $this->drupalCreateUser(array('administer languages'));
@@ -1843,13 +1843,13 @@ class FormatDateUnitTest extends DrupalWebTestCase {
// Simulate a Drupal bootstrap with the logged-in user.
date_default_timezone_set(drupal_get_user_timezone());
- $this->assertIdentical(format_date($timestamp, 'custom', 'l, d-M-y H:i:s T', 'America/Los_Angeles', 'en'), 'Sunday, 25-Mar-07 17:00:00 PDT', 'Test a different language.');
- $this->assertIdentical(format_date($timestamp, 'custom', 'l, d-M-y H:i:s T', 'Europe/London'), 'Monday, 26-Mar-07 01:00:00 BST', 'Test a different time zone.');
- $this->assertIdentical(format_date($timestamp, 'custom', 'l, d-M-y H:i:s T'), 'domingo, 25-Mar-07 17:00:00 PDT', 'Test custom date format.');
- $this->assertIdentical(format_date($timestamp, 'long'), 'domingo, 25. marzo 2007 - 17:00', 'Test long date format.');
- $this->assertIdentical(format_date($timestamp, 'medium'), '25. marzo 2007 - 17:00', 'Test medium date format.');
- $this->assertIdentical(format_date($timestamp, 'short'), '2007 Mar 25 - 5:00pm', 'Test short date format.');
- $this->assertIdentical(format_date($timestamp), '25. marzo 2007 - 17:00', 'Test default date format.');
+ $this->assertIdentical(format_date($timestamp, 'custom', 'l, d-M-y H:i:s T', 'America/Los_Angeles', 'en'), 'Sunday, 25-Mar-07 17:00:00 PDT', t('Test a different language.'));
+ $this->assertIdentical(format_date($timestamp, 'custom', 'l, d-M-y H:i:s T', 'Europe/London'), 'Monday, 26-Mar-07 01:00:00 BST', t('Test a different time zone.'));
+ $this->assertIdentical(format_date($timestamp, 'custom', 'l, d-M-y H:i:s T'), 'domingo, 25-Mar-07 17:00:00 PDT', t('Test custom date format.'));
+ $this->assertIdentical(format_date($timestamp, 'long'), 'domingo, 25. marzo 2007 - 17:00', t('Test long date format.'));
+ $this->assertIdentical(format_date($timestamp, 'medium'), '25. marzo 2007 - 17:00', t('Test medium date format.'));
+ $this->assertIdentical(format_date($timestamp, 'short'), '2007 Mar 25 - 5:00pm', t('Test short date format.'));
+ $this->assertIdentical(format_date($timestamp), '25. marzo 2007 - 17:00', t('Test default date format.'));
// Restore the original user and language, and enable session saving.
$user = $real_user;
@@ -1877,15 +1877,15 @@ class DrupalAttributesUnitTest extends DrupalUnitTestCase {
*/
function testDrupalAttributes() {
// Verify that special characters are HTML encoded.
- $this->assertIdentical(drupal_attributes(array('title' => '&"\'<>')), ' title="&amp;&quot;&#039;&lt;&gt;"', 'HTML encode attribute values.');
+ $this->assertIdentical(drupal_attributes(array('title' => '&"\'<>')), ' title="&amp;&quot;&#039;&lt;&gt;"', t('HTML encode attribute values.'));
// Verify multi-value attributes are concatenated with spaces.
$attributes = array('class' => array('first', 'last'));
- $this->assertIdentical(drupal_attributes(array('class' => array('first', 'last'))), ' class="first last"', 'Concatenate multi-value attributes.');
+ $this->assertIdentical(drupal_attributes(array('class' => array('first', 'last'))), ' class="first last"', t('Concatenate multi-value attributes.'));
// Verify empty attribute values are rendered.
- $this->assertIdentical(drupal_attributes(array('alt' => '')), ' alt=""', 'Empty attribute value #1.');
- $this->assertIdentical(drupal_attributes(array('alt' => NULL)), ' alt=""', 'Empty attribute value #2.');
+ $this->assertIdentical(drupal_attributes(array('alt' => '')), ' alt=""', t('Empty attribute value #1.'));
+ $this->assertIdentical(drupal_attributes(array('alt' => NULL)), ' alt=""', t('Empty attribute value #2.'));
// Verify multiple attributes are rendered.
$attributes = array(
@@ -1893,10 +1893,10 @@ class DrupalAttributesUnitTest extends DrupalUnitTestCase {
'class' => array('first', 'last'),
'alt' => 'Alternate',
);
- $this->assertIdentical(drupal_attributes($attributes), ' id="id-test" class="first last" alt="Alternate"', 'Multiple attributes.');
+ $this->assertIdentical(drupal_attributes($attributes), ' id="id-test" class="first last" alt="Alternate"', t('Multiple attributes.'));
// Verify empty attributes array is rendered.
- $this->assertIdentical(drupal_attributes(array()), '', 'Empty attributes array.');
+ $this->assertIdentical(drupal_attributes(array()), '', t('Empty attributes array.'));
}
}
@@ -1919,7 +1919,7 @@ class DrupalJSONTest extends DrupalUnitTestCase {
// Setup a string with the full ASCII table.
// @todo: Add tests for non-ASCII characters and Unicode.
$str = '';
- for ($i = 0; $i < 128; $i++) {
+ for ($i=0; $i < 128; $i++) {
$str .= chr($i);
}
// Characters that must be escaped.
@@ -1927,33 +1927,33 @@ class DrupalJSONTest extends DrupalUnitTestCase {
$html_unsafe_escaped = array('\u003c', '\u003e', '\u0026');
// Verify there aren't character encoding problems with the source string.
- $this->assertIdentical(strlen($str), 128, 'A string with the full ASCII table has the correct length.');
+ $this->assertIdentical(strlen($str), 128, t('A string with the full ASCII table has the correct length.'));
foreach ($html_unsafe as $char) {
- $this->assertTrue(strpos($str, $char) > 0, 'A string with the full ASCII table includes ' . $char . '.');
+ $this->assertTrue(strpos($str, $char) > 0, t('A string with the full ASCII table includes @s.', array('@s' => $char)));
}
// Verify that JSON encoding produces a string with all of the characters.
$json = drupal_json_encode($str);
- $this->assertTrue(strlen($json) > strlen($str), 'A JSON encoded string is larger than the source string.');
+ $this->assertTrue(strlen($json) > strlen($str), t('A JSON encoded string is larger than the source string.'));
// Verify that encoding/decoding is reversible.
$json_decoded = drupal_json_decode($json);
- $this->assertIdentical($str, $json_decoded, 'Encoding a string to JSON and decoding back results in the original string.');
+ $this->assertIdentical($str, $json_decoded, t('Encoding a string to JSON and decoding back results in the original string.'));
// Verify reversibility for structured data. Also verify that necessary
// characters are escaped.
$source = array(TRUE, FALSE, 0, 1, '0', '1', $str, array('key1' => $str, 'key2' => array('nested' => TRUE)));
$json = drupal_json_encode($source);
foreach ($html_unsafe as $char) {
- $this->assertTrue(strpos($json, $char) === FALSE, 'A JSON encoded string does not contain ' . $char . '.');
+ $this->assertTrue(strpos($json, $char) === FALSE, t('A JSON encoded string does not contain @s.', array('@s' => $char)));
}
// Verify that JSON encoding escapes the HTML unsafe characters
foreach ($html_unsafe_escaped as $char) {
- $this->assertTrue(strpos($json, $char) > 0, 'A JSON encoded string contains ' . $char . '.');
+ $this->assertTrue(strpos($json, $char) > 0, t('A JSON encoded string contains @s.', array('@s' => $char)));
}
$json_decoded = drupal_json_decode($json);
- $this->assertNotIdentical($source, $json, 'An array encoded in JSON is not identical to the source.');
- $this->assertIdentical($source, $json_decoded, 'Encoding structured data to JSON and decoding back results in the original data.');
+ $this->assertNotIdentical($source, $json, t('An array encoded in JSON is not identical to the source.'));
+ $this->assertIdentical($source, $json_decoded, t('Encoding structured data to JSON and decoding back results in the original data.'));
}
}
@@ -1982,9 +1982,9 @@ class DrupalGetRdfNamespacesTestCase extends DrupalWebTestCase {
$xml = new SimpleXMLElement($this->content);
$ns = $xml->getDocNamespaces();
- $this->assertEqual($ns['owl'], 'http://www.w3.org/2002/07/owl#', 'A prefix declared once is displayed.');
- $this->assertEqual($ns['foaf'], 'http://xmlns.com/foaf/0.1/', 'The same prefix declared in several implementations of hook_rdf_namespaces() is valid as long as all the namespaces are the same.');
- $this->assertEqual($ns['foaf1'], 'http://xmlns.com/foaf/0.1/', 'Two prefixes can be assigned the same namespace.');
- $this->assertTrue(!isset($ns['dc']), 'A prefix with conflicting namespaces is discarded.');
+ $this->assertEqual($ns['owl'], 'http://www.w3.org/2002/07/owl#', t('A prefix declared once is displayed.'));
+ $this->assertEqual($ns['foaf'], 'http://xmlns.com/foaf/0.1/', t('The same prefix declared in several implementations of hook_rdf_namespaces() is valid as long as all the namespaces are the same.'));
+ $this->assertEqual($ns['foaf1'], 'http://xmlns.com/foaf/0.1/', t('Two prefixes can be assigned the same namespace.'));
+ $this->assertTrue(!isset($ns['dc']), t('A prefix with conflicting namespaces is discarded.'));
}
}
diff --git a/modules/simpletest/tests/database_test.test b/modules/simpletest/tests/database_test.test
index 7f5efcf9f..b2efa6672 100644
--- a/modules/simpletest/tests/database_test.test
+++ b/modules/simpletest/tests/database_test.test
@@ -48,7 +48,7 @@ class DatabaseTestCase extends DrupalWebTestCase {
}
foreach ($schema as $name => $data) {
- $this->assertTrue(db_table_exists($name), 'Table ' . $name . ' created successfully.');
+ $this->assertTrue(db_table_exists($name), t('Table @name created successfully.', array('@name' => $name)));
}
}
@@ -191,25 +191,25 @@ class DatabaseConnectionTestCase extends DatabaseTestCase {
$db1 = Database::getConnection('default', 'default');
$db2 = Database::getConnection('slave', 'default');
- $this->assertNotNull($db1, 'default connection is a real connection object.');
- $this->assertNotNull($db2, 'slave connection is a real connection object.');
- $this->assertNotIdentical($db1, $db2, 'Each target refers to a different connection.');
+ $this->assertNotNull($db1, t('default connection is a real connection object.'));
+ $this->assertNotNull($db2, t('slave connection is a real connection object.'));
+ $this->assertNotIdentical($db1, $db2, t('Each target refers to a different connection.'));
// Try to open those targets another time, that should return the same objects.
$db1b = Database::getConnection('default', 'default');
$db2b = Database::getConnection('slave', 'default');
- $this->assertIdentical($db1, $db1b, 'A second call to getConnection() returns the same object.');
- $this->assertIdentical($db2, $db2b, 'A second call to getConnection() returns the same object.');
+ $this->assertIdentical($db1, $db1b, t('A second call to getConnection() returns the same object.'));
+ $this->assertIdentical($db2, $db2b, t('A second call to getConnection() returns the same object.'));
// Try to open an unknown target.
$unknown_target = $this->randomName();
$db3 = Database::getConnection($unknown_target, 'default');
- $this->assertNotNull($db3, 'Opening an unknown target returns a real connection object.');
- $this->assertIdentical($db1, $db3, 'An unknown target opens the default connection.');
+ $this->assertNotNull($db3, t('Opening an unknown target returns a real connection object.'));
+ $this->assertIdentical($db1, $db3, t('An unknown target opens the default connection.'));
// Try to open that unknown target another time, that should return the same object.
$db3b = Database::getConnection($unknown_target, 'default');
- $this->assertIdentical($db3, $db3b, 'A second call to getConnection() returns the same object.');
+ $this->assertIdentical($db3, $db3b, t('A second call to getConnection() returns the same object.'));
}
/**
@@ -227,7 +227,7 @@ class DatabaseConnectionTestCase extends DatabaseTestCase {
$db1 = Database::getConnection('default', 'default');
$db2 = Database::getConnection('slave', 'default');
- $this->assertIdentical($db1, $db2, 'Both targets refer to the same connection.');
+ $this->assertIdentical($db1, $db2, t('Both targets refer to the same connection.'));
}
/**
@@ -242,7 +242,7 @@ class DatabaseConnectionTestCase extends DatabaseTestCase {
$db2 = Database::getConnection('default', 'default');
// Opening a connection after closing it should yield an object different than the original.
- $this->assertNotIdentical($db1, $db2, 'Opening the default connection after it is closed returns a new object.');
+ $this->assertNotIdentical($db1, $db2, t('Opening the default connection after it is closed returns a new object.'));
}
/**
@@ -257,8 +257,8 @@ class DatabaseConnectionTestCase extends DatabaseTestCase {
// In the MySQL driver, the port can be different, so check individual
// options.
- $this->assertEqual($connection_info['default']['driver'], $connectionOptions['driver'], 'The default connection info driver matches the current connection options driver.');
- $this->assertEqual($connection_info['default']['database'], $connectionOptions['database'], 'The default connection info database matches the current connection options database.');
+ $this->assertEqual($connection_info['default']['driver'], $connectionOptions['driver'], t('The default connection info driver matches the current connection options driver.'));
+ $this->assertEqual($connection_info['default']['database'], $connectionOptions['database'], t('The default connection info database matches the current connection options database.'));
// Set up identical slave and confirm connection options are identical.
Database::addConnectionInfo('default', 'slave', $connection_info['default']);
@@ -267,7 +267,7 @@ class DatabaseConnectionTestCase extends DatabaseTestCase {
// Get a fresh copy of the default connection options.
$connectionOptions = $db->getConnectionOptions();
- $this->assertIdentical($connectionOptions, $connectionOptions2, 'The default and slave connection options are identical.');
+ $this->assertIdentical($connectionOptions, $connectionOptions2, t('The default and slave connection options are identical.'));
// Set up a new connection with different connection info.
$test = $connection_info['default'];
@@ -277,7 +277,7 @@ class DatabaseConnectionTestCase extends DatabaseTestCase {
// Get a fresh copy of the default connection options.
$connectionOptions = $db->getConnectionOptions();
- $this->assertNotEqual($connection_info['default']['database'], $connectionOptions['database'], 'The test connection info database does not match the current connection options database.');
+ $this->assertNotEqual($connection_info['default']['database'], $connectionOptions['database'], t('The test connection info database does not match the current connection options database.'));
}
}
@@ -302,14 +302,14 @@ class DatabaseFetchTestCase extends DatabaseTestCase {
function testQueryFetchDefault() {
$records = array();
$result = db_query('SELECT name FROM {test} WHERE age = :age', array(':age' => 25));
- $this->assertTrue($result instanceof DatabaseStatementInterface, 'Result set is a Drupal statement object.');
+ $this->assertTrue($result instanceof DatabaseStatementInterface, t('Result set is a Drupal statement object.'));
foreach ($result as $record) {
$records[] = $record;
- $this->assertTrue(is_object($record), 'Record is an object.');
- $this->assertIdentical($record->name, 'John', '25 year old is John.');
+ $this->assertTrue(is_object($record), t('Record is an object.'));
+ $this->assertIdentical($record->name, 'John', t('25 year old is John.'));
}
- $this->assertIdentical(count($records), 1, 'There is only one record.');
+ $this->assertIdentical(count($records), 1, t('There is only one record.'));
}
/**
@@ -320,11 +320,11 @@ class DatabaseFetchTestCase extends DatabaseTestCase {
$result = db_query('SELECT name FROM {test} WHERE age = :age', array(':age' => 25), array('fetch' => PDO::FETCH_OBJ));
foreach ($result as $record) {
$records[] = $record;
- $this->assertTrue(is_object($record), 'Record is an object.');
- $this->assertIdentical($record->name, 'John', '25 year old is John.');
+ $this->assertTrue(is_object($record), t('Record is an object.'));
+ $this->assertIdentical($record->name, 'John', t('25 year old is John.'));
}
- $this->assertIdentical(count($records), 1, 'There is only one record.');
+ $this->assertIdentical(count($records), 1, t('There is only one record.'));
}
/**
@@ -335,12 +335,12 @@ class DatabaseFetchTestCase extends DatabaseTestCase {
$result = db_query('SELECT name FROM {test} WHERE age = :age', array(':age' => 25), array('fetch' => PDO::FETCH_ASSOC));
foreach ($result as $record) {
$records[] = $record;
- if ($this->assertTrue(is_array($record), 'Record is an array.')) {
- $this->assertIdentical($record['name'], 'John', 'Record can be accessed associatively.');
+ if ($this->assertTrue(is_array($record), t('Record is an array.'))) {
+ $this->assertIdentical($record['name'], 'John', t('Record can be accessed associatively.'));
}
}
- $this->assertIdentical(count($records), 1, 'There is only one record.');
+ $this->assertIdentical(count($records), 1, t('There is only one record.'));
}
/**
@@ -353,12 +353,12 @@ class DatabaseFetchTestCase extends DatabaseTestCase {
$result = db_query('SELECT name FROM {test} WHERE age = :age', array(':age' => 25), array('fetch' => 'FakeRecord'));
foreach ($result as $record) {
$records[] = $record;
- if ($this->assertTrue($record instanceof FakeRecord, 'Record is an object of class FakeRecord.')) {
- $this->assertIdentical($record->name, 'John', '25 year old is John.');
+ if ($this->assertTrue($record instanceof FakeRecord, t('Record is an object of class FakeRecord.'))) {
+ $this->assertIdentical($record->name, 'John', t('25 year old is John.'));
}
}
- $this->assertIdentical(count($records), 1, 'There is only one record.');
+ $this->assertIdentical(count($records), 1, t('There is only one record.'));
}
}
@@ -387,8 +387,8 @@ class DatabaseFetch2TestCase extends DatabaseTestCase {
$result = db_query('SELECT name FROM {test} WHERE age = :age', array(':age' => 25), array('fetch' => PDO::FETCH_NUM));
foreach ($result as $record) {
$records[] = $record;
- if ($this->assertTrue(is_array($record), 'Record is an array.')) {
- $this->assertIdentical($record[0], 'John', 'Record can be accessed numerically.');
+ if ($this->assertTrue(is_array($record), t('Record is an array.'))) {
+ $this->assertIdentical($record[0], 'John', t('Record can be accessed numerically.'));
}
}
@@ -403,13 +403,13 @@ class DatabaseFetch2TestCase extends DatabaseTestCase {
$result = db_query('SELECT name FROM {test} WHERE age = :age', array(':age' => 25), array('fetch' => PDO::FETCH_BOTH));
foreach ($result as $record) {
$records[] = $record;
- if ($this->assertTrue(is_array($record), 'Record is an array.')) {
- $this->assertIdentical($record[0], 'John', 'Record can be accessed numerically.');
- $this->assertIdentical($record['name'], 'John', 'Record can be accessed associatively.');
+ if ($this->assertTrue(is_array($record), t('Record is an array.'))) {
+ $this->assertIdentical($record[0], 'John', t('Record can be accessed numerically.'));
+ $this->assertIdentical($record['name'], 'John', t('Record can be accessed associatively.'));
}
}
- $this->assertIdentical(count($records), 1, 'There is only one record.');
+ $this->assertIdentical(count($records), 1, t('There is only one record.'));
}
/**
@@ -419,12 +419,12 @@ class DatabaseFetch2TestCase extends DatabaseTestCase {
$records = array();
$result = db_query('SELECT name FROM {test} WHERE age > :age', array(':age' => 25));
$column = $result->fetchCol();
- $this->assertIdentical(count($column), 3, 'fetchCol() returns the right number of records.');
+ $this->assertIdentical(count($column), 3, t('fetchCol() returns the right number of records.'));
$result = db_query('SELECT name FROM {test} WHERE age > :age', array(':age' => 25));
$i = 0;
foreach ($result as $record) {
- $this->assertIdentical($record->name, $column[$i++], 'Column matches direct accesss.');
+ $this->assertIdentical($record->name, $column[$i++], t('Column matches direct accesss.'));
}
}
}
@@ -456,9 +456,9 @@ class DatabaseInsertTestCase extends DatabaseTestCase {
$query->execute();
$num_records_after = db_query('SELECT COUNT(*) FROM {test}')->fetchField();
- $this->assertIdentical($num_records_before + 1, (int) $num_records_after, 'Record inserts correctly.');
+ $this->assertIdentical($num_records_before + 1, (int) $num_records_after, t('Record inserts correctly.'));
$saved_age = db_query('SELECT age FROM {test} WHERE name = :name', array(':name' => 'Yoko'))->fetchField();
- $this->assertIdentical($saved_age, '29', 'Can retrieve after inserting.');
+ $this->assertIdentical($saved_age, '29', t('Can retrieve after inserting.'));
}
/**
@@ -485,13 +485,13 @@ class DatabaseInsertTestCase extends DatabaseTestCase {
$query->execute();
$num_records_after = (int) db_query('SELECT COUNT(*) FROM {test}')->fetchField();
- $this->assertIdentical($num_records_before + 3, $num_records_after, 'Record inserts correctly.');
+ $this->assertIdentical($num_records_before + 3, $num_records_after, t('Record inserts correctly.'));
$saved_age = db_query('SELECT age FROM {test} WHERE name = :name', array(':name' => 'Larry'))->fetchField();
- $this->assertIdentical($saved_age, '30', 'Can retrieve after inserting.');
+ $this->assertIdentical($saved_age, '30', t('Can retrieve after inserting.'));
$saved_age = db_query('SELECT age FROM {test} WHERE name = :name', array(':name' => 'Curly'))->fetchField();
- $this->assertIdentical($saved_age, '31', 'Can retrieve after inserting.');
+ $this->assertIdentical($saved_age, '31', t('Can retrieve after inserting.'));
$saved_age = db_query('SELECT age FROM {test} WHERE name = :name', array(':name' => 'Moe'))->fetchField();
- $this->assertIdentical($saved_age, '32', 'Can retrieve after inserting.');
+ $this->assertIdentical($saved_age, '32', t('Can retrieve after inserting.'));
}
/**
@@ -506,7 +506,7 @@ class DatabaseInsertTestCase extends DatabaseTestCase {
'name' => 'Larry',
'age' => '30',
));
- $query->execute(); // This should run the insert, but leave the fields intact.
+ $query->execute(); // This should run the insert, but leave the fields intact.
// We should be able to specify values in any order if named.
$query->values(array(
@@ -520,13 +520,13 @@ class DatabaseInsertTestCase extends DatabaseTestCase {
$query->execute();
$num_records_after = db_query('SELECT COUNT(*) FROM {test}')->fetchField();
- $this->assertIdentical((int) $num_records_before + 3, (int) $num_records_after, 'Record inserts correctly.');
+ $this->assertIdentical((int) $num_records_before + 3, (int) $num_records_after, t('Record inserts correctly.'));
$saved_age = db_query('SELECT age FROM {test} WHERE name = :name', array(':name' => 'Larry'))->fetchField();
- $this->assertIdentical($saved_age, '30', 'Can retrieve after inserting.');
+ $this->assertIdentical($saved_age, '30', t('Can retrieve after inserting.'));
$saved_age = db_query('SELECT age FROM {test} WHERE name = :name', array(':name' => 'Curly'))->fetchField();
- $this->assertIdentical($saved_age, '31', 'Can retrieve after inserting.');
+ $this->assertIdentical($saved_age, '31', t('Can retrieve after inserting.'));
$saved_age = db_query('SELECT age FROM {test} WHERE name = :name', array(':name' => 'Moe'))->fetchField();
- $this->assertIdentical($saved_age, '32', 'Can retrieve after inserting.');
+ $this->assertIdentical($saved_age, '32', t('Can retrieve after inserting.'));
}
/**
@@ -542,11 +542,11 @@ class DatabaseInsertTestCase extends DatabaseTestCase {
->values(array('Moe', '32'))
->execute();
$saved_age = db_query('SELECT age FROM {test} WHERE name = :name', array(':name' => 'Larry'))->fetchField();
- $this->assertIdentical($saved_age, '30', 'Can retrieve after inserting.');
+ $this->assertIdentical($saved_age, '30', t('Can retrieve after inserting.'));
$saved_age = db_query('SELECT age FROM {test} WHERE name = :name', array(':name' => 'Curly'))->fetchField();
- $this->assertIdentical($saved_age, '31', 'Can retrieve after inserting.');
+ $this->assertIdentical($saved_age, '31', t('Can retrieve after inserting.'));
$saved_age = db_query('SELECT age FROM {test} WHERE name = :name', array(':name' => 'Moe'))->fetchField();
- $this->assertIdentical($saved_age, '32', 'Can retrieve after inserting.');
+ $this->assertIdentical($saved_age, '32', t('Can retrieve after inserting.'));
}
/**
@@ -560,7 +560,7 @@ class DatabaseInsertTestCase extends DatabaseTestCase {
))
->execute();
- $this->assertIdentical($id, '5', 'Auto-increment ID returned successfully.');
+ $this->assertIdentical($id, '5', t('Auto-increment ID returned successfully.'));
}
/**
@@ -573,7 +573,7 @@ class DatabaseInsertTestCase extends DatabaseTestCase {
// re-ordered.
$query->addExpression('tp.age', 'age');
$query
- ->fields('tp', array('name', 'job'))
+ ->fields('tp', array('name','job'))
->condition('tp.name', 'Meredith');
// The resulting query should be equivalent to:
@@ -586,7 +586,7 @@ class DatabaseInsertTestCase extends DatabaseTestCase {
->execute();
$saved_age = db_query('SELECT age FROM {test} WHERE name = :name', array(':name' => 'Meredith'))->fetchField();
- $this->assertIdentical($saved_age, '30', 'Can retrieve after inserting.');
+ $this->assertIdentical($saved_age, '30', t('Can retrieve after inserting.'));
}
}
@@ -608,12 +608,12 @@ class DatabaseInsertLOBTestCase extends DatabaseTestCase {
*/
function testInsertOneBlob() {
$data = "This is\000a test.";
- $this->assertTrue(strlen($data) === 15, 'Test data contains a NULL.');
+ $this->assertTrue(strlen($data) === 15, t('Test data contains a NULL.'));
$id = db_insert('test_one_blob')
->fields(array('blob1' => $data))
->execute();
$r = db_query('SELECT * FROM {test_one_blob} WHERE id = :id', array(':id' => $id))->fetchAssoc();
- $this->assertTrue($r['blob1'] === $data, 'Can insert a blob: id ' . $id . ', ' . serialize($r) . '.');
+ $this->assertTrue($r['blob1'] === $data, t('Can insert a blob: id @id, @data.', array('@id' => $id, '@data' => serialize($r))));
}
/**
@@ -627,7 +627,7 @@ class DatabaseInsertLOBTestCase extends DatabaseTestCase {
))
->execute();
$r = db_query('SELECT * FROM {test_two_blobs} WHERE id = :id', array(':id' => $id))->fetchAssoc();
- $this->assertTrue($r['blob1'] === 'This is' && $r['blob2'] === 'a test', 'Can insert multiple blobs per row.');
+ $this->assertTrue($r['blob1'] === 'This is' && $r['blob2'] === 'a test', t('Can insert multiple blobs per row.'));
}
}
@@ -654,7 +654,7 @@ class DatabaseInsertDefaultsTestCase extends DatabaseTestCase {
$schema = drupal_get_schema('test');
$job = db_query('SELECT job FROM {test} WHERE id = :id', array(':id' => $id))->fetchField();
- $this->assertEqual($job, $schema['fields']['job']['default'], 'Default field value is set.');
+ $this->assertEqual($job, $schema['fields']['job']['default'], t('Default field value is set.'));
}
/**
@@ -666,14 +666,13 @@ class DatabaseInsertDefaultsTestCase extends DatabaseTestCase {
try {
$result = db_insert('test')->execute();
// This is only executed if no exception has been thrown.
- $this->fail('Expected exception NoFieldsException has not been thrown.');
- }
- catch (NoFieldsException $e) {
- $this->pass('Expected exception NoFieldsException has been thrown.');
+ $this->fail(t('Expected exception NoFieldsException has not been thrown.'));
+ } catch (NoFieldsException $e) {
+ $this->pass(t('Expected exception NoFieldsException has been thrown.'));
}
$num_records_after = (int) db_query('SELECT COUNT(*) FROM {test}')->fetchField();
- $this->assertIdentical($num_records_before, $num_records_after, 'Do nothing as no fields are specified.');
+ $this->assertIdentical($num_records_before, $num_records_after, t('Do nothing as no fields are specified.'));
}
/**
@@ -688,7 +687,7 @@ class DatabaseInsertDefaultsTestCase extends DatabaseTestCase {
$schema = drupal_get_schema('test');
$job = db_query('SELECT job FROM {test} WHERE id = :id', array(':id' => $id))->fetchField();
- $this->assertEqual($job, $schema['fields']['job']['default'], 'Default field value is set.');
+ $this->assertEqual($job, $schema['fields']['job']['default'], t('Default field value is set.'));
}
}
@@ -713,10 +712,10 @@ class DatabaseUpdateTestCase extends DatabaseTestCase {
->fields(array('name' => 'Tiffany'))
->condition('id', 1)
->execute();
- $this->assertIdentical($num_updated, 1, 'Updated 1 record.');
+ $this->assertIdentical($num_updated, 1, t('Updated 1 record.'));
$saved_name = db_query('SELECT name FROM {test} WHERE id = :id', array(':id' => 1))->fetchField();
- $this->assertIdentical($saved_name, 'Tiffany', 'Updated name successfully.');
+ $this->assertIdentical($saved_name, 'Tiffany', t('Updated name successfully.'));
}
/**
@@ -727,10 +726,10 @@ class DatabaseUpdateTestCase extends DatabaseTestCase {
->fields(array('job' => 'Musician'))
->condition('job', 'Singer')
->execute();
- $this->assertIdentical($num_updated, 2, 'Updated 2 records.');
+ $this->assertIdentical($num_updated, 2, t('Updated 2 records.'));
$num_matches = db_query('SELECT COUNT(*) FROM {test} WHERE job = :job', array(':job' => 'Musician'))->fetchField();
- $this->assertIdentical($num_matches, '2', 'Updated fields successfully.');
+ $this->assertIdentical($num_matches, '2', t('Updated fields successfully.'));
}
/**
@@ -741,10 +740,10 @@ class DatabaseUpdateTestCase extends DatabaseTestCase {
->fields(array('job' => 'Musician'))
->condition('age', 26, '>')
->execute();
- $this->assertIdentical($num_updated, 2, 'Updated 2 records.');
+ $this->assertIdentical($num_updated, 2, t('Updated 2 records.'));
$num_matches = db_query('SELECT COUNT(*) FROM {test} WHERE job = :job', array(':job' => 'Musician'))->fetchField();
- $this->assertIdentical($num_matches, '2', 'Updated fields successfully.');
+ $this->assertIdentical($num_matches, '2', t('Updated fields successfully.'));
}
/**
@@ -755,10 +754,10 @@ class DatabaseUpdateTestCase extends DatabaseTestCase {
->fields(array('job' => 'Musician'))
->where('age > :age', array(':age' => 26))
->execute();
- $this->assertIdentical($num_updated, 2, 'Updated 2 records.');
+ $this->assertIdentical($num_updated, 2, t('Updated 2 records.'));
$num_matches = db_query('SELECT COUNT(*) FROM {test} WHERE job = :job', array(':job' => 'Musician'))->fetchField();
- $this->assertIdentical($num_matches, '2', 'Updated fields successfully.');
+ $this->assertIdentical($num_matches, '2', t('Updated fields successfully.'));
}
/**
@@ -770,10 +769,10 @@ class DatabaseUpdateTestCase extends DatabaseTestCase {
->where('age > :age', array(':age' => 26))
->condition('name', 'Ringo');
$num_updated = $update->execute();
- $this->assertIdentical($num_updated, 1, 'Updated 1 record.');
+ $this->assertIdentical($num_updated, 1, t('Updated 1 record.'));
$num_matches = db_query('SELECT COUNT(*) FROM {test} WHERE job = :job', array(':job' => 'Musician'))->fetchField();
- $this->assertIdentical($num_matches, '1', 'Updated fields successfully.');
+ $this->assertIdentical($num_matches, '1', t('Updated fields successfully.'));
}
}
@@ -802,10 +801,10 @@ class DatabaseUpdateComplexTestCase extends DatabaseTestCase {
->condition('name', 'Paul')
);
$num_updated = $update->execute();
- $this->assertIdentical($num_updated, 2, 'Updated 2 records.');
+ $this->assertIdentical($num_updated, 2, t('Updated 2 records.'));
$num_matches = db_query('SELECT COUNT(*) FROM {test} WHERE job = :job', array(':job' => 'Musician'))->fetchField();
- $this->assertIdentical($num_matches, '2', 'Updated fields successfully.');
+ $this->assertIdentical($num_matches, '2', t('Updated fields successfully.'));
}
/**
@@ -816,10 +815,10 @@ class DatabaseUpdateComplexTestCase extends DatabaseTestCase {
->fields(array('job' => 'Musician'))
->condition('name', array('John', 'Paul'), 'IN')
->execute();
- $this->assertIdentical($num_updated, 2, 'Updated 2 records.');
+ $this->assertIdentical($num_updated, 2, t('Updated 2 records.'));
$num_matches = db_query('SELECT COUNT(*) FROM {test} WHERE job = :job', array(':job' => 'Musician'))->fetchField();
- $this->assertIdentical($num_matches, '2', 'Updated fields successfully.');
+ $this->assertIdentical($num_matches, '2', t('Updated fields successfully.'));
}
/**
@@ -832,10 +831,10 @@ class DatabaseUpdateComplexTestCase extends DatabaseTestCase {
->fields(array('job' => 'Musician'))
->condition('name', array('John', 'Paul', 'George'), 'NoT IN')
->execute();
- $this->assertIdentical($num_updated, 1, 'Updated 1 record.');
+ $this->assertIdentical($num_updated, 1, t('Updated 1 record.'));
$num_matches = db_query('SELECT COUNT(*) FROM {test} WHERE job = :job', array(':job' => 'Musician'))->fetchField();
- $this->assertIdentical($num_matches, '1', 'Updated fields successfully.');
+ $this->assertIdentical($num_matches, '1', t('Updated fields successfully.'));
}
/**
@@ -846,10 +845,10 @@ class DatabaseUpdateComplexTestCase extends DatabaseTestCase {
->fields(array('job' => 'Musician'))
->condition('age', array(25, 26), 'BETWEEN')
->execute();
- $this->assertIdentical($num_updated, 2, 'Updated 2 records.');
+ $this->assertIdentical($num_updated, 2, t('Updated 2 records.'));
$num_matches = db_query('SELECT COUNT(*) FROM {test} WHERE job = :job', array(':job' => 'Musician'))->fetchField();
- $this->assertIdentical($num_matches, '2', 'Updated fields successfully.');
+ $this->assertIdentical($num_matches, '2', t('Updated fields successfully.'));
}
/**
@@ -860,10 +859,10 @@ class DatabaseUpdateComplexTestCase extends DatabaseTestCase {
->fields(array('job' => 'Musician'))
->condition('name', '%ge%', 'LIKE')
->execute();
- $this->assertIdentical($num_updated, 1, 'Updated 1 record.');
+ $this->assertIdentical($num_updated, 1, t('Updated 1 record.'));
$num_matches = db_query('SELECT COUNT(*) FROM {test} WHERE job = :job', array(':job' => 'Musician'))->fetchField();
- $this->assertIdentical($num_matches, '1', 'Updated fields successfully.');
+ $this->assertIdentical($num_matches, '1', t('Updated fields successfully.'));
}
/**
@@ -877,15 +876,15 @@ class DatabaseUpdateComplexTestCase extends DatabaseTestCase {
->fields(array('job' => 'Musician'))
->expression('age', 'age + :age', array(':age' => 4))
->execute();
- $this->assertIdentical($num_updated, 1, 'Updated 1 record.');
+ $this->assertIdentical($num_updated, 1, t('Updated 1 record.'));
$num_matches = db_query('SELECT COUNT(*) FROM {test} WHERE job = :job', array(':job' => 'Musician'))->fetchField();
- $this->assertIdentical($num_matches, '1', 'Updated fields successfully.');
+ $this->assertIdentical($num_matches, '1', t('Updated fields successfully.'));
$person = db_query('SELECT * FROM {test} WHERE name = :name', array(':name' => 'Ringo'))->fetch();
- $this->assertEqual($person->name, 'Ringo', 'Name set correctly.');
- $this->assertEqual($person->age, $before_age + 4, 'Age set correctly.');
- $this->assertEqual($person->job, 'Musician', 'Job set correctly.');
+ $this->assertEqual($person->name, 'Ringo', t('Name set correctly.'));
+ $this->assertEqual($person->age, $before_age + 4, t('Age set correctly.'));
+ $this->assertEqual($person->job, 'Musician', t('Job set correctly.'));
$GLOBALS['larry_test'] = 0;
}
@@ -898,10 +897,10 @@ class DatabaseUpdateComplexTestCase extends DatabaseTestCase {
->condition('name', 'Ringo')
->expression('age', 'age + :age', array(':age' => 4))
->execute();
- $this->assertIdentical($num_updated, 1, 'Updated 1 record.');
+ $this->assertIdentical($num_updated, 1, t('Updated 1 record.'));
$after_age = db_query('SELECT age FROM {test} WHERE name = :name', array(':name' => 'Ringo'))->fetchField();
- $this->assertEqual($before_age + 4, $after_age, 'Age updated correctly');
+ $this->assertEqual($before_age + 4, $after_age, t('Age updated correctly'));
}
}
@@ -923,7 +922,7 @@ class DatabaseUpdateLOBTestCase extends DatabaseTestCase {
*/
function testUpdateOneBlob() {
$data = "This is\000a test.";
- $this->assertTrue(strlen($data) === 15, 'Test data contains a NULL.');
+ $this->assertTrue(strlen($data) === 15, t('Test data contains a NULL.'));
$id = db_insert('test_one_blob')
->fields(array('blob1' => $data))
->execute();
@@ -935,7 +934,7 @@ class DatabaseUpdateLOBTestCase extends DatabaseTestCase {
->execute();
$r = db_query('SELECT * FROM {test_one_blob} WHERE id = :id', array(':id' => $id))->fetchAssoc();
- $this->assertTrue($r['blob1'] === $data, 'Can update a blob: id ' . $id . ', ' . serialize($r) . '.');
+ $this->assertTrue($r['blob1'] === $data, t('Can update a blob: id @id, @data.', array('@id' => $id, '@data' => serialize($r))));
}
/**
@@ -955,7 +954,7 @@ class DatabaseUpdateLOBTestCase extends DatabaseTestCase {
->execute();
$r = db_query('SELECT * FROM {test_two_blobs} WHERE id = :id', array(':id' => $id))->fetchAssoc();
- $this->assertTrue($r['blob1'] === 'and so' && $r['blob2'] === 'is this', 'Can update multiple blobs per row.');
+ $this->assertTrue($r['blob1'] === 'and so' && $r['blob2'] === 'is this', t('Can update multiple blobs per row.'));
}
}
@@ -995,10 +994,10 @@ class DatabaseDeleteTruncateTestCase extends DatabaseTestCase {
->condition('pid', $subquery, 'IN');
$num_deleted = $delete->execute();
- $this->assertEqual($num_deleted, 1, "Deleted 1 record.");
+ $this->assertEqual($num_deleted, 1, t("Deleted 1 record."));
$num_records_after = db_query('SELECT COUNT(*) FROM {test_task}')->fetchField();
- $this->assertEqual($num_records_before, $num_records_after + $num_deleted, 'Deletion adds up.');
+ $this->assertEqual($num_records_before, $num_records_after + $num_deleted, t('Deletion adds up.'));
}
/**
@@ -1010,10 +1009,10 @@ class DatabaseDeleteTruncateTestCase extends DatabaseTestCase {
$num_deleted = db_delete('test')
->condition('id', 1)
->execute();
- $this->assertIdentical($num_deleted, 1, 'Deleted 1 record.');
+ $this->assertIdentical($num_deleted, 1, t('Deleted 1 record.'));
$num_records_after = db_query('SELECT COUNT(*) FROM {test}')->fetchField();
- $this->assertEqual($num_records_before, $num_records_after + $num_deleted, 'Deletion adds up.');
+ $this->assertEqual($num_records_before, $num_records_after + $num_deleted, t('Deletion adds up.'));
}
/**
@@ -1025,7 +1024,7 @@ class DatabaseDeleteTruncateTestCase extends DatabaseTestCase {
db_truncate('test')->execute();
$num_records_after = db_query("SELECT COUNT(*) FROM {test}")->fetchField();
- $this->assertEqual(0, $num_records_after, 'Truncate really deletes everything.');
+ $this->assertEqual(0, $num_records_after, t('Truncate really deletes everything.'));
}
}
@@ -1056,15 +1055,15 @@ class DatabaseMergeTestCase extends DatabaseTestCase {
))
->execute();
- $this->assertEqual($result, MergeQuery::STATUS_INSERT, 'Insert status returned.');
+ $this->assertEqual($result, MergeQuery::STATUS_INSERT, t('Insert status returned.'));
$num_records_after = db_query('SELECT COUNT(*) FROM {test_people}')->fetchField();
- $this->assertEqual($num_records_before + 1, $num_records_after, 'Merge inserted properly.');
+ $this->assertEqual($num_records_before + 1, $num_records_after, t('Merge inserted properly.'));
$person = db_query('SELECT * FROM {test_people} WHERE job = :job', array(':job' => 'Presenter'))->fetch();
- $this->assertEqual($person->name, 'Tiffany', 'Name set correctly.');
- $this->assertEqual($person->age, 31, 'Age set correctly.');
- $this->assertEqual($person->job, 'Presenter', 'Job set correctly.');
+ $this->assertEqual($person->name, 'Tiffany', t('Name set correctly.'));
+ $this->assertEqual($person->age, 31, t('Age set correctly.'));
+ $this->assertEqual($person->job, 'Presenter', t('Job set correctly.'));
}
/**
@@ -1081,15 +1080,15 @@ class DatabaseMergeTestCase extends DatabaseTestCase {
))
->execute();
- $this->assertEqual($result, MergeQuery::STATUS_UPDATE, 'Update status returned.');
+ $this->assertEqual($result, MergeQuery::STATUS_UPDATE, t('Update status returned.'));
$num_records_after = db_query('SELECT COUNT(*) FROM {test_people}')->fetchField();
- $this->assertEqual($num_records_before, $num_records_after, 'Merge updated properly.');
+ $this->assertEqual($num_records_before, $num_records_after, t('Merge updated properly.'));
$person = db_query('SELECT * FROM {test_people} WHERE job = :job', array(':job' => 'Speaker'))->fetch();
- $this->assertEqual($person->name, 'Tiffany', 'Name set correctly.');
- $this->assertEqual($person->age, 31, 'Age set correctly.');
- $this->assertEqual($person->job, 'Speaker', 'Job set correctly.');
+ $this->assertEqual($person->name, 'Tiffany', t('Name set correctly.'));
+ $this->assertEqual($person->age, 31, t('Age set correctly.'));
+ $this->assertEqual($person->job, 'Speaker', t('Job set correctly.'));
}
/**
@@ -1108,12 +1107,12 @@ class DatabaseMergeTestCase extends DatabaseTestCase {
->execute();
$num_records_after = db_query('SELECT COUNT(*) FROM {test_people}')->fetchField();
- $this->assertEqual($num_records_before, $num_records_after, 'Merge updated properly.');
+ $this->assertEqual($num_records_before, $num_records_after, t('Merge updated properly.'));
$person = db_query('SELECT * FROM {test_people} WHERE job = :job', array(':job' => 'Speaker'))->fetch();
- $this->assertEqual($person->name, 'Tiffany', 'Name set correctly.');
- $this->assertEqual($person->age, 30, 'Age skipped correctly.');
- $this->assertEqual($person->job, 'Speaker', 'Job set correctly.');
+ $this->assertEqual($person->name, 'Tiffany', t('Name set correctly.'));
+ $this->assertEqual($person->age, 30, t('Age skipped correctly.'));
+ $this->assertEqual($person->job, 'Speaker', t('Job set correctly.'));
}
/**
@@ -1132,12 +1131,12 @@ class DatabaseMergeTestCase extends DatabaseTestCase {
->execute();
$num_records_after = db_query('SELECT COUNT(*) FROM {test_people}')->fetchField();
- $this->assertEqual($num_records_before, $num_records_after, 'Merge updated properly.');
+ $this->assertEqual($num_records_before, $num_records_after, t('Merge updated properly.'));
$person = db_query('SELECT * FROM {test_people} WHERE job = :job', array(':job' => 'Speaker'))->fetch();
- $this->assertEqual($person->name, 'Joe', 'Name set correctly.');
- $this->assertEqual($person->age, 30, 'Age skipped correctly.');
- $this->assertEqual($person->job, 'Speaker', 'Job set correctly.');
+ $this->assertEqual($person->name, 'Joe', t('Name set correctly.'));
+ $this->assertEqual($person->age, 30, t('Age skipped correctly.'));
+ $this->assertEqual($person->job, 'Speaker', t('Job set correctly.'));
}
/**
@@ -1163,12 +1162,12 @@ class DatabaseMergeTestCase extends DatabaseTestCase {
->execute();
$num_records_after = db_query('SELECT COUNT(*) FROM {test_people}')->fetchField();
- $this->assertEqual($num_records_before, $num_records_after, 'Merge updated properly.');
+ $this->assertEqual($num_records_before, $num_records_after, t('Merge updated properly.'));
$person = db_query('SELECT * FROM {test_people} WHERE job = :job', array(':job' => 'Speaker'))->fetch();
- $this->assertEqual($person->name, 'Tiffany', 'Name set correctly.');
- $this->assertEqual($person->age, $age_before + 4, 'Age updated correctly.');
- $this->assertEqual($person->job, 'Speaker', 'Job set correctly.');
+ $this->assertEqual($person->name, 'Tiffany', t('Name set correctly.'));
+ $this->assertEqual($person->age, $age_before + 4, t('Age updated correctly.'));
+ $this->assertEqual($person->job, 'Speaker', t('Job set correctly.'));
}
/**
@@ -1182,12 +1181,12 @@ class DatabaseMergeTestCase extends DatabaseTestCase {
->execute();
$num_records_after = db_query('SELECT COUNT(*) FROM {test_people}')->fetchField();
- $this->assertEqual($num_records_before + 1, $num_records_after, 'Merge inserted properly.');
+ $this->assertEqual($num_records_before + 1, $num_records_after, t('Merge inserted properly.'));
$person = db_query('SELECT * FROM {test_people} WHERE job = :job', array(':job' => 'Presenter'))->fetch();
- $this->assertEqual($person->name, '', 'Name set correctly.');
- $this->assertEqual($person->age, 0, 'Age set correctly.');
- $this->assertEqual($person->job, 'Presenter', 'Job set correctly.');
+ $this->assertEqual($person->name, '', t('Name set correctly.'));
+ $this->assertEqual($person->age, 0, t('Age set correctly.'));
+ $this->assertEqual($person->job, 'Presenter', t('Job set correctly.'));
}
/**
@@ -1201,12 +1200,12 @@ class DatabaseMergeTestCase extends DatabaseTestCase {
->execute();
$num_records_after = db_query('SELECT COUNT(*) FROM {test_people}')->fetchField();
- $this->assertEqual($num_records_before, $num_records_after, 'Merge skipped properly.');
+ $this->assertEqual($num_records_before, $num_records_after, t('Merge skipped properly.'));
$person = db_query('SELECT * FROM {test_people} WHERE job = :job', array(':job' => 'Speaker'))->fetch();
- $this->assertEqual($person->name, 'Meredith', 'Name skipped correctly.');
- $this->assertEqual($person->age, 30, 'Age skipped correctly.');
- $this->assertEqual($person->job, 'Speaker', 'Job skipped correctly.');
+ $this->assertEqual($person->name, 'Meredith', t('Name skipped correctly.'));
+ $this->assertEqual($person->age, 30, t('Age skipped correctly.'));
+ $this->assertEqual($person->job, 'Speaker', t('Job skipped correctly.'));
db_merge('test_people')
->key(array('job' => 'Speaker'))
@@ -1215,12 +1214,12 @@ class DatabaseMergeTestCase extends DatabaseTestCase {
->execute();
$num_records_after = db_query('SELECT COUNT(*) FROM {test_people}')->fetchField();
- $this->assertEqual($num_records_before, $num_records_after, 'Merge skipped properly.');
+ $this->assertEqual($num_records_before, $num_records_after, t('Merge skipped properly.'));
$person = db_query('SELECT * FROM {test_people} WHERE job = :job', array(':job' => 'Speaker'))->fetch();
- $this->assertEqual($person->name, 'Meredith', 'Name skipped correctly.');
- $this->assertEqual($person->age, 30, 'Age skipped correctly.');
- $this->assertEqual($person->job, 'Speaker', 'Job skipped correctly.');
+ $this->assertEqual($person->name, 'Meredith', t('Name skipped correctly.'));
+ $this->assertEqual($person->age, 30, t('Age skipped correctly.'));
+ $this->assertEqual($person->job, 'Speaker', t('Job skipped correctly.'));
}
/**
@@ -1237,10 +1236,10 @@ class DatabaseMergeTestCase extends DatabaseTestCase {
->execute();
}
catch (InvalidMergeQueryException $e) {
- $this->pass('InvalidMergeQueryException thrown for invalid query.');
+ $this->pass(t('InvalidMergeQueryException thrown for invalid query.'));
return;
}
- $this->fail('No InvalidMergeQueryException thrown');
+ $this->fail(t('No InvalidMergeQueryException thrown'));
}
}
@@ -1271,7 +1270,7 @@ class DatabaseSelectTestCase extends DatabaseTestCase {
$num_records++;
}
- $this->assertEqual($num_records, 4, 'Returned the correct number of rows.');
+ $this->assertEqual($num_records, 4, t('Returned the correct number of rows.'));
}
/**
@@ -1288,11 +1287,11 @@ class DatabaseSelectTestCase extends DatabaseTestCase {
$num_records++;
}
- $query = (string) $query;
+ $query = (string)$query;
$expected = "/* Testing query comments */ SELECT test.name AS name, test.age AS age\nFROM \n{test} test";
- $this->assertEqual($num_records, 4, 'Returned the correct number of rows.');
- $this->assertEqual($query, $expected, 'The flattened query contains the comment string.');
+ $this->assertEqual($num_records, 4, t('Returned the correct number of rows.'));
+ $this->assertEqual($query, $expected, t('The flattened query contains the comment string.'));
}
/**
@@ -1306,13 +1305,13 @@ class DatabaseSelectTestCase extends DatabaseTestCase {
$result = $query->execute();
// Check that the aliases are being created the way we want.
- $this->assertEqual($name_field, 'name', 'Name field alias is correct.');
- $this->assertEqual($age_field, 'age', 'Age field alias is correct.');
+ $this->assertEqual($name_field, 'name', t('Name field alias is correct.'));
+ $this->assertEqual($age_field, 'age', t('Age field alias is correct.'));
// Ensure that we got the right record.
$record = $result->fetch();
- $this->assertEqual($record->$name_field, 'George', 'Fetched name is correct.');
- $this->assertEqual($record->$age_field, 27, 'Fetched age is correct.');
+ $this->assertEqual($record->$name_field, 'George', t('Fetched name is correct.'));
+ $this->assertEqual($record->$age_field, 27, t('Fetched age is correct.'));
}
/**
@@ -1326,13 +1325,13 @@ class DatabaseSelectTestCase extends DatabaseTestCase {
$result = $query->execute();
// Check that the aliases are being created the way we want.
- $this->assertEqual($name_field, 'name', 'Name field alias is correct.');
- $this->assertEqual($age_field, 'double_age', 'Age field alias is correct.');
+ $this->assertEqual($name_field, 'name', t('Name field alias is correct.'));
+ $this->assertEqual($age_field, 'double_age', t('Age field alias is correct.'));
// Ensure that we got the right record.
$record = $result->fetch();
- $this->assertEqual($record->$name_field, 'George', 'Fetched name is correct.');
- $this->assertEqual($record->$age_field, 27 * 2, 'Fetched age expression is correct.');
+ $this->assertEqual($record->$name_field, 'George', t('Fetched name is correct.'));
+ $this->assertEqual($record->$age_field, 27*2, t('Fetched age expression is correct.'));
}
/**
@@ -1347,14 +1346,14 @@ class DatabaseSelectTestCase extends DatabaseTestCase {
$result = $query->execute();
// Check that the aliases are being created the way we want.
- $this->assertEqual($age_double_field, 'expression', 'Double age field alias is correct.');
- $this->assertEqual($age_triple_field, 'expression_2', 'Triple age field alias is correct.');
+ $this->assertEqual($age_double_field, 'expression', t('Double age field alias is correct.'));
+ $this->assertEqual($age_triple_field, 'expression_2', t('Triple age field alias is correct.'));
// Ensure that we got the right record.
$record = $result->fetch();
- $this->assertEqual($record->$name_field, 'George', 'Fetched name is correct.');
- $this->assertEqual($record->$age_double_field, 27 * 2, 'Fetched double age expression is correct.');
- $this->assertEqual($record->$age_triple_field, 27 * 3, 'Fetched triple age expression is correct.');
+ $this->assertEqual($record->$name_field, 'George', t('Fetched name is correct.'));
+ $this->assertEqual($record->$age_double_field, 27*2, t('Fetched double age expression is correct.'));
+ $this->assertEqual($record->$age_triple_field, 27*3, t('Fetched triple age expression is correct.'));
}
/**
@@ -1367,17 +1366,17 @@ class DatabaseSelectTestCase extends DatabaseTestCase {
->execute()->fetchObject();
// Check that all fields we asked for are present.
- $this->assertNotNull($record->id, 'ID field is present.');
- $this->assertNotNull($record->name, 'Name field is present.');
- $this->assertNotNull($record->age, 'Age field is present.');
- $this->assertNotNull($record->job, 'Job field is present.');
+ $this->assertNotNull($record->id, t('ID field is present.'));
+ $this->assertNotNull($record->name, t('Name field is present.'));
+ $this->assertNotNull($record->age, t('Age field is present.'));
+ $this->assertNotNull($record->job, t('Job field is present.'));
// Ensure that we got the right record.
// Check that all fields we asked for are present.
- $this->assertEqual($record->id, 2, 'ID field has the correct value.');
- $this->assertEqual($record->name, 'George', 'Name field has the correct value.');
- $this->assertEqual($record->age, 27, 'Age field has the correct value.');
- $this->assertEqual($record->job, 'Singer', 'Job field has the correct value.');
+ $this->assertEqual($record->id, 2, t('ID field has the correct value.'));
+ $this->assertEqual($record->name, 'George', t('Name field has the correct value.'));
+ $this->assertEqual($record->age, 27, t('Age field has the correct value.'));
+ $this->assertEqual($record->job, 'Singer', t('Job field has the correct value.'));
}
/**
@@ -1390,17 +1389,17 @@ class DatabaseSelectTestCase extends DatabaseTestCase {
->execute()->fetchObject();
// Check that all fields we asked for are present.
- $this->assertNotNull($record->id, 'ID field is present.');
- $this->assertNotNull($record->name, 'Name field is present.');
- $this->assertNotNull($record->age, 'Age field is present.');
- $this->assertNotNull($record->job, 'Job field is present.');
+ $this->assertNotNull($record->id, t('ID field is present.'));
+ $this->assertNotNull($record->name, t('Name field is present.'));
+ $this->assertNotNull($record->age, t('Age field is present.'));
+ $this->assertNotNull($record->job, t('Job field is present.'));
// Ensure that we got the right record.
// Check that all fields we asked for are present.
- $this->assertEqual($record->id, 2, 'ID field has the correct value.');
- $this->assertEqual($record->name, 'George', 'Name field has the correct value.');
- $this->assertEqual($record->age, 27, 'Age field has the correct value.');
- $this->assertEqual($record->job, 'Singer', 'Job field has the correct value.');
+ $this->assertEqual($record->id, 2, t('ID field has the correct value.'));
+ $this->assertEqual($record->name, 'George', t('Name field has the correct value.'));
+ $this->assertEqual($record->age, 27, t('Age field has the correct value.'));
+ $this->assertEqual($record->job, 'Singer', t('Job field has the correct value.'));
}
/**
@@ -1414,8 +1413,8 @@ class DatabaseSelectTestCase extends DatabaseTestCase {
->isNull('age')
->execute()->fetchCol();
- $this->assertEqual(count($names), 1, 'Correct number of records found with NULL age.');
- $this->assertEqual($names[0], 'Fozzie', 'Correct record returned for NULL age.');
+ $this->assertEqual(count($names), 1, t('Correct number of records found with NULL age.'));
+ $this->assertEqual($names[0], 'Fozzie', t('Correct record returned for NULL age.'));
}
/**
@@ -1430,9 +1429,9 @@ class DatabaseSelectTestCase extends DatabaseTestCase {
->orderBy('name')
->execute()->fetchCol();
- $this->assertEqual(count($names), 2, 'Correct number of records found withNOT NULL age.');
- $this->assertEqual($names[0], 'Gonzo', 'Correct record returned for NOT NULL age.');
- $this->assertEqual($names[1], 'Kermit', 'Correct record returned for NOT NULL age.');
+ $this->assertEqual(count($names), 2, t('Correct number of records found withNOT NULL age.'));
+ $this->assertEqual($names[0], 'Gonzo', t('Correct record returned for NOT NULL age.'));
+ $this->assertEqual($names[1], 'Kermit', t('Correct record returned for NOT NULL age.'));
}
/**
@@ -1453,10 +1452,10 @@ class DatabaseSelectTestCase extends DatabaseTestCase {
$names = $query_1->execute()->fetchCol();
// Ensure we only get 2 records.
- $this->assertEqual(count($names), 2, 'UNION correctly discarded duplicates.');
+ $this->assertEqual(count($names), 2, t('UNION correctly discarded duplicates.'));
- $this->assertEqual($names[0], 'George', 'First query returned correct name.');
- $this->assertEqual($names[1], 'Ringo', 'Second query returned correct name.');
+ $this->assertEqual($names[0], 'George', t('First query returned correct name.'));
+ $this->assertEqual($names[1], 'Ringo', t('Second query returned correct name.'));
}
/**
@@ -1476,11 +1475,11 @@ class DatabaseSelectTestCase extends DatabaseTestCase {
$names = $query_1->execute()->fetchCol();
// Ensure we get all 3 records.
- $this->assertEqual(count($names), 3, 'UNION ALL correctly preserved duplicates.');
+ $this->assertEqual(count($names), 3, t('UNION ALL correctly preserved duplicates.'));
- $this->assertEqual($names[0], 'George', 'First query returned correct first name.');
- $this->assertEqual($names[1], 'Ringo', 'Second query returned correct second name.');
- $this->assertEqual($names[2], 'Ringo', 'Third query returned correct name.');
+ $this->assertEqual($names[0], 'George', t('First query returned correct first name.'));
+ $this->assertEqual($names[1], 'Ringo', t('Second query returned correct second name.'));
+ $this->assertEqual($names[2], 'Ringo', t('Third query returned correct name.'));
}
/**
@@ -1515,7 +1514,7 @@ class DatabaseSelectTestCase extends DatabaseTestCase {
->orderBy('id')
->execute()
->fetchCol();
- $this->assertEqual($ordered_ids, $expected_ids, 'A query without random ordering returns IDs in the correct order.');
+ $this->assertEqual($ordered_ids, $expected_ids, t('A query without random ordering returns IDs in the correct order.'));
// Now perform the same query, but instead choose a random ordering. We
// expect this to contain a differently ordered version of the original
@@ -1526,10 +1525,10 @@ class DatabaseSelectTestCase extends DatabaseTestCase {
->orderRandom()
->execute()
->fetchCol();
- $this->assertNotEqual($randomized_ids, $ordered_ids, 'A query with random ordering returns an unordered set of IDs.');
+ $this->assertNotEqual($randomized_ids, $ordered_ids, t('A query with random ordering returns an unordered set of IDs.'));
$sorted_ids = $randomized_ids;
sort($sorted_ids);
- $this->assertEqual($sorted_ids, $ordered_ids, 'After sorting the random list, the result matches the original query.');
+ $this->assertEqual($sorted_ids, $ordered_ids, t('After sorting the random list, the result matches the original query.'));
// Now perform the exact same query again, and make sure the order is
// different.
@@ -1539,10 +1538,10 @@ class DatabaseSelectTestCase extends DatabaseTestCase {
->orderRandom()
->execute()
->fetchCol();
- $this->assertNotEqual($randomized_ids_second_set, $randomized_ids, 'Performing the query with random ordering a second time returns IDs in a different order.');
+ $this->assertNotEqual($randomized_ids_second_set, $randomized_ids, t('Performing the query with random ordering a second time returns IDs in a different order.'));
$sorted_ids_second_set = $randomized_ids_second_set;
sort($sorted_ids_second_set);
- $this->assertEqual($sorted_ids_second_set, $sorted_ids, 'After sorting the second random list, the result matches the sorted version of the first random list.');
+ $this->assertEqual($sorted_ids_second_set, $sorted_ids, t('After sorting the second random list, the result matches the sorted version of the first random list.'));
}
/**
@@ -1594,7 +1593,7 @@ class DatabaseSelectSubqueryTestCase extends DatabaseTestCase {
// WHERE tt.task = 'code'
$people = $select->execute()->fetchCol();
- $this->assertEqual(count($people), 1, 'Returned the correct number of rows.');
+ $this->assertEqual(count($people), 1, t('Returned the correct number of rows.'));
}
/**
@@ -1620,7 +1619,7 @@ class DatabaseSelectSubqueryTestCase extends DatabaseTestCase {
// INNER JOIN test t ON t.id=tt.pid
$people = $select->execute()->fetchCol();
- $this->assertEqual(count($people), 1, 'Returned the correct number of rows.');
+ $this->assertEqual(count($people), 1, t('Returned the correct number of rows.'));
}
/**
@@ -1643,7 +1642,7 @@ class DatabaseSelectSubqueryTestCase extends DatabaseTestCase {
// FROM test tt2
// WHERE tt2.pid IN (SELECT tt.pid AS pid FROM test_task tt WHERE tt.priority=1)
$people = $select->execute()->fetchCol();
- $this->assertEqual(count($people), 5, 'Returned the correct number of rows.');
+ $this->assertEqual(count($people), 5, t('Returned the correct number of rows.'));
}
/**
@@ -1667,7 +1666,7 @@ class DatabaseSelectSubqueryTestCase extends DatabaseTestCase {
// INNER JOIN (SELECT tt.pid AS pid FROM test_task tt WHERE priority=1) tt ON t.id=tt.pid
$people = $select->execute()->fetchCol();
- $this->assertEqual(count($people), 2, 'Returned the correct number of rows.');
+ $this->assertEqual(count($people), 2, t('Returned the correct number of rows.'));
}
}
@@ -1698,11 +1697,11 @@ class DatabaseSelectOrderedTestCase extends DatabaseTestCase {
$last_age = 0;
foreach ($result as $record) {
$num_records++;
- $this->assertTrue($record->age >= $last_age, 'Results returned in correct order.');
+ $this->assertTrue($record->age >= $last_age, t('Results returned in correct order.'));
$last_age = $record->age;
}
- $this->assertEqual($num_records, 4, 'Returned the correct number of rows.');
+ $this->assertEqual($num_records, 4, t('Returned the correct number of rows.'));
}
/**
@@ -1729,11 +1728,11 @@ class DatabaseSelectOrderedTestCase extends DatabaseTestCase {
$num_records++;
foreach ($record as $kk => $col) {
if ($expected[$k][$kk] != $results[$k][$kk]) {
- $this->assertTrue(FALSE, 'Results returned in correct order.');
+ $this->assertTrue(FALSE, t('Results returned in correct order.'));
}
}
}
- $this->assertEqual($num_records, 4, 'Returned the correct number of rows.');
+ $this->assertEqual($num_records, 4, t('Returned the correct number of rows.'));
}
/**
@@ -1750,11 +1749,11 @@ class DatabaseSelectOrderedTestCase extends DatabaseTestCase {
$last_age = 100000000;
foreach ($result as $record) {
$num_records++;
- $this->assertTrue($record->age <= $last_age, 'Results returned in correct order.');
+ $this->assertTrue($record->age <= $last_age, t('Results returned in correct order.'));
$last_age = $record->age;
}
- $this->assertEqual($num_records, 4, 'Returned the correct number of rows.');
+ $this->assertEqual($num_records, 4, t('Returned the correct number of rows.'));
}
}
@@ -1788,12 +1787,12 @@ class DatabaseSelectComplexTestCase extends DatabaseTestCase {
$last_priority = 0;
foreach ($result as $record) {
$num_records++;
- $this->assertTrue($record->$priority_field >= $last_priority, 'Results returned in correct order.');
- $this->assertNotEqual($record->$name_field, 'Ringo', 'Taskless person not selected.');
+ $this->assertTrue($record->$priority_field >= $last_priority, t('Results returned in correct order.'));
+ $this->assertNotEqual($record->$name_field, 'Ringo', t('Taskless person not selected.'));
$last_priority = $record->$priority_field;
}
- $this->assertEqual($num_records, 7, 'Returned the correct number of rows.');
+ $this->assertEqual($num_records, 7, t('Returned the correct number of rows.'));
}
/**
@@ -1814,11 +1813,11 @@ class DatabaseSelectComplexTestCase extends DatabaseTestCase {
foreach ($result as $record) {
$num_records++;
- $this->assertTrue(strcmp($record->$name_field, $last_name) >= 0, 'Results returned in correct order.');
+ $this->assertTrue(strcmp($record->$name_field, $last_name) >= 0, t('Results returned in correct order.'));
$last_priority = $record->$name_field;
}
- $this->assertEqual($num_records, 8, 'Returned the correct number of rows.');
+ $this->assertEqual($num_records, 8, t('Returned the correct number of rows.'));
}
/**
@@ -1837,7 +1836,7 @@ class DatabaseSelectComplexTestCase extends DatabaseTestCase {
$records = array();
foreach ($result as $record) {
$num_records++;
- $this->assertTrue($record->$count_field >= $last_count, 'Results returned in correct order.');
+ $this->assertTrue($record->$count_field >= $last_count, t('Results returned in correct order.'));
$last_count = $record->$count_field;
$records[$record->$task_field] = $record->$count_field;
}
@@ -1851,10 +1850,10 @@ class DatabaseSelectComplexTestCase extends DatabaseTestCase {
);
foreach ($correct_results as $task => $count) {
- $this->assertEqual($records[$task], $count, "Correct number of '" . $task . "' records found.");
+ $this->assertEqual($records[$task], $count, t("Correct number of '@task' records found.", array('@task' => $task)));
}
- $this->assertEqual($num_records, 6, 'Returned the correct number of total rows.');
+ $this->assertEqual($num_records, 6, t('Returned the correct number of total rows.'));
}
/**
@@ -1874,8 +1873,8 @@ class DatabaseSelectComplexTestCase extends DatabaseTestCase {
$records = array();
foreach ($result as $record) {
$num_records++;
- $this->assertTrue($record->$count_field >= 2, 'Record has the minimum count.');
- $this->assertTrue($record->$count_field >= $last_count, 'Results returned in correct order.');
+ $this->assertTrue($record->$count_field >= 2, t('Record has the minimum count.'));
+ $this->assertTrue($record->$count_field >= $last_count, t('Results returned in correct order.'));
$last_count = $record->$count_field;
$records[$record->$task_field] = $record->$count_field;
}
@@ -1885,10 +1884,10 @@ class DatabaseSelectComplexTestCase extends DatabaseTestCase {
);
foreach ($correct_results as $task => $count) {
- $this->assertEqual($records[$task], $count, "Correct number of '" . $task . "' records found.");
+ $this->assertEqual($records[$task], $count, t("Correct number of '@task' records found.", array('@task' => $task)));
}
- $this->assertEqual($num_records, 1, 'Returned the correct number of total rows.');
+ $this->assertEqual($num_records, 1, t('Returned the correct number of total rows.'));
}
/**
@@ -1906,7 +1905,7 @@ class DatabaseSelectComplexTestCase extends DatabaseTestCase {
$num_records++;
}
- $this->assertEqual($num_records, 2, 'Returned the correct number of rows.');
+ $this->assertEqual($num_records, 2, t('Returned the correct number of rows.'));
}
/**
@@ -1923,7 +1922,7 @@ class DatabaseSelectComplexTestCase extends DatabaseTestCase {
$num_records++;
}
- $this->assertEqual($num_records, 6, 'Returned the correct number of rows.');
+ $this->assertEqual($num_records, 6, t('Returned the correct number of rows.'));
}
/**
@@ -1937,13 +1936,13 @@ class DatabaseSelectComplexTestCase extends DatabaseTestCase {
$count = $query->countQuery()->execute()->fetchField();
- $this->assertEqual($count, 4, 'Counted the correct number of records.');
+ $this->assertEqual($count, 4, t('Counted the correct number of records.'));
// Now make sure we didn't break the original query! We should still have
// all of the fields we asked for.
$record = $query->execute()->fetch();
- $this->assertEqual($record->$name_field, 'George', 'Correct data retrieved.');
- $this->assertEqual($record->$age_field, 27, 'Correct data retrieved.');
+ $this->assertEqual($record->$name_field, 'George', t('Correct data retrieved.'));
+ $this->assertEqual($record->$age_field, 27, t('Correct data retrieved.'));
}
/**
@@ -1958,20 +1957,20 @@ class DatabaseSelectComplexTestCase extends DatabaseTestCase {
// Check that the 'all_fields' statement is handled properly.
$tables = $query->getTables();
- $this->assertEqual($tables['test']['all_fields'], 1, 'Query correctly sets \'all_fields\' statement.');
+ $this->assertEqual($tables['test']['all_fields'], 1, t('Query correctly sets \'all_fields\' statement.'));
$tables = $count->getTables();
- $this->assertFalse(isset($tables['test']['all_fields']), 'Count query correctly unsets \'all_fields\' statement.');
+ $this->assertFalse(isset($tables['test']['all_fields']), t('Count query correctly unsets \'all_fields\' statement.'));
// Check that the ordering clause is handled properly.
$orderby = $query->getOrderBy();
- $this->assertEqual($orderby['name'], 'ASC', 'Query correctly sets ordering clause.');
+ $this->assertEqual($orderby['name'], 'ASC', t('Query correctly sets ordering clause.'));
$orderby = $count->getOrderBy();
- $this->assertFalse(isset($orderby['name']), 'Count query correctly unsets ordering caluse.');
+ $this->assertFalse(isset($orderby['name']), t('Count query correctly unsets ordering caluse.'));
// Make sure that the count query works.
$count = $count->execute()->fetchField();
- $this->assertEqual($count, 4, 'Counted the correct number of records.');
+ $this->assertEqual($count, 4, t('Counted the correct number of records.'));
}
/**
@@ -1984,7 +1983,7 @@ class DatabaseSelectComplexTestCase extends DatabaseTestCase {
$count = $query->countQuery()->execute()->fetchField();
- $this->assertEqual($count, 6, 'Counted the correct number of records.');
+ $this->assertEqual($count, 6, t('Counted the correct number of records.'));
}
/**
@@ -2001,7 +2000,7 @@ class DatabaseSelectComplexTestCase extends DatabaseTestCase {
$query->condition(db_or()->condition('age', 26)->condition('age', 27));
$job = $query->execute()->fetchField();
- $this->assertEqual($job, 'Songwriter', 'Correct data retrieved.');
+ $this->assertEqual($job, 'Songwriter', t('Correct data retrieved.'));
}
/**
@@ -2014,8 +2013,8 @@ class DatabaseSelectComplexTestCase extends DatabaseTestCase {
$query->addField($alias, 'job', 'otherjob');
$query->where("$alias.name <> test.name");
$crowded_job = $query->execute()->fetch();
- $this->assertEqual($crowded_job->job, $crowded_job->otherjob, 'Correctly joined same table twice.');
- $this->assertNotEqual($crowded_job->name, $crowded_job->othername, 'Correctly joined same table twice.');
+ $this->assertEqual($crowded_job->job, $crowded_job->otherjob, t('Correctly joined same table twice.'));
+ $this->assertNotEqual($crowded_job->name, $crowded_job->othername, t('Correctly joined same table twice.'));
}
}
@@ -2059,7 +2058,7 @@ class DatabaseSelectPagerDefaultTestCase extends DatabaseTestCase {
$correct_number = $count - ($limit * $page);
}
- $this->assertEqual(count($data->names), $correct_number, 'Correct number of records returned by pager: ' . $correct_number);
+ $this->assertEqual(count($data->names), $correct_number, t('Correct number of records returned by pager: @number', array('@number' => $correct_number)));
}
}
@@ -2093,7 +2092,7 @@ class DatabaseSelectPagerDefaultTestCase extends DatabaseTestCase {
$correct_number = $count - ($limit * $page);
}
- $this->assertEqual(count($data->names), $correct_number, 'Correct number of records returned by pager: ' . $correct_number);
+ $this->assertEqual(count($data->names), $correct_number, t('Correct number of records returned by pager: @number', array('@number' => $correct_number)));
}
}
@@ -2115,7 +2114,7 @@ class DatabaseSelectPagerDefaultTestCase extends DatabaseTestCase {
$ages = $outer_query
->execute()
->fetchCol();
- $this->assertEqual($ages, array(25, 26, 27, 28), 'Inner pager query returned the correct ages.');
+ $this->assertEqual($ages, array(25, 26, 27, 28), t('Inner pager query returned the correct ages.'));
}
/**
@@ -2135,7 +2134,7 @@ class DatabaseSelectPagerDefaultTestCase extends DatabaseTestCase {
$ages = $query
->execute()
->fetchCol();
- $this->assertEqual($ages, array('George', 'Ringo'), 'Pager query with having expression returned the correct ages.');
+ $this->assertEqual($ages, array('George', 'Ringo'), t('Pager query with having expression returned the correct ages.'));
}
}
@@ -2173,8 +2172,8 @@ class DatabaseSelectTableSortDefaultTestCase extends DatabaseTestCase {
$first = array_shift($data->tasks);
$last = array_pop($data->tasks);
- $this->assertEqual($first->task, $sort['first'], 'Items appear in the correct order.');
- $this->assertEqual($last->task, $sort['last'], 'Items appear in the correct order.');
+ $this->assertEqual($first->task, $sort['first'], t('Items appear in the correct order.'));
+ $this->assertEqual($last->task, $sort['last'], t('Items appear in the correct order.'));
}
}
@@ -2199,8 +2198,8 @@ class DatabaseSelectTableSortDefaultTestCase extends DatabaseTestCase {
$first = array_shift($data->tasks);
$last = array_pop($data->tasks);
- $this->assertEqual($first->task, $sort['first'], 'Items appear in the correct order sorting by ' . $sort['field'] . ' ' . $sort['sort'] . '.');
- $this->assertEqual($last->task, $sort['last'], 'Items appear in the correct order sorting by ' . $sort['field'] . ' ' . $sort['sort'] . '.');
+ $this->assertEqual($first->task, $sort['first'], t('Items appear in the correct order sorting by @field @sort.', array('@field' => $sort['field'], '@sort' => $sort['sort'])));
+ $this->assertEqual($last->task, $sort['last'], t('Items appear in the correct order sorting by @field @sort.', array('@field' => $sort['field'], '@sort' => $sort['sort'])));
}
}
}
@@ -2231,8 +2230,8 @@ class DatabaseTaggingTestCase extends DatabaseTestCase {
$query->addTag('test');
- $this->assertTrue($query->hasTag('test'), 'hasTag() returned true.');
- $this->assertFalse($query->hasTag('other'), 'hasTag() returned false.');
+ $this->assertTrue($query->hasTag('test'), t('hasTag() returned true.'));
+ $this->assertFalse($query->hasTag('other'), t('hasTag() returned false.'));
}
/**
@@ -2246,8 +2245,8 @@ class DatabaseTaggingTestCase extends DatabaseTestCase {
$query->addTag('test');
$query->addTag('other');
- $this->assertTrue($query->hasAllTags('test', 'other'), 'hasAllTags() returned true.');
- $this->assertFalse($query->hasAllTags('test', 'stuff'), 'hasAllTags() returned false.');
+ $this->assertTrue($query->hasAllTags('test', 'other'), t('hasAllTags() returned true.'));
+ $this->assertFalse($query->hasAllTags('test', 'stuff'), t('hasAllTags() returned false.'));
}
/**
@@ -2260,8 +2259,8 @@ class DatabaseTaggingTestCase extends DatabaseTestCase {
$query->addTag('test');
- $this->assertTrue($query->hasAnyTag('test', 'other'), 'hasAnyTag() returned true.');
- $this->assertFalse($query->hasAnyTag('other', 'stuff'), 'hasAnyTag() returned false.');
+ $this->assertTrue($query->hasAnyTag('test', 'other'), t('hasAnyTag() returned true.'));
+ $this->assertFalse($query->hasAnyTag('other', 'stuff'), t('hasAnyTag() returned false.'));
}
/**
@@ -2282,10 +2281,10 @@ class DatabaseTaggingTestCase extends DatabaseTestCase {
$query->addMetaData('test', $data);
$return = $query->getMetaData('test');
- $this->assertEqual($data, $return, 'Corect metadata returned.');
+ $this->assertEqual($data, $return, t('Corect metadata returned.'));
$return = $query->getMetaData('nothere');
- $this->assertNull($return, 'Non-existent key returned NULL.');
+ $this->assertNull($return, t('Non-existent key returned NULL.'));
}
}
@@ -2320,7 +2319,7 @@ class DatabaseAlterTestCase extends DatabaseTestCase {
$num_records++;
}
- $this->assertEqual($num_records, 2, 'Returned the correct number of rows.');
+ $this->assertEqual($num_records, 2, t('Returned the correct number of rows.'));
}
/**
@@ -2337,14 +2336,14 @@ class DatabaseAlterTestCase extends DatabaseTestCase {
$records = $result->fetchAll();
- $this->assertEqual(count($records), 2, 'Returned the correct number of rows.');
+ $this->assertEqual(count($records), 2, t('Returned the correct number of rows.'));
- $this->assertEqual($records[0]->name, 'George', 'Correct data retrieved.');
- $this->assertEqual($records[0]->$tid_field, 4, 'Correct data retrieved.');
- $this->assertEqual($records[0]->$task_field, 'sing', 'Correct data retrieved.');
- $this->assertEqual($records[1]->name, 'George', 'Correct data retrieved.');
- $this->assertEqual($records[1]->$tid_field, 5, 'Correct data retrieved.');
- $this->assertEqual($records[1]->$task_field, 'sleep', 'Correct data retrieved.');
+ $this->assertEqual($records[0]->name, 'George', t('Correct data retrieved.'));
+ $this->assertEqual($records[0]->$tid_field, 4, t('Correct data retrieved.'));
+ $this->assertEqual($records[0]->$task_field, 'sing', t('Correct data retrieved.'));
+ $this->assertEqual($records[1]->name, 'George', t('Correct data retrieved.'));
+ $this->assertEqual($records[1]->$tid_field, 5, t('Correct data retrieved.'));
+ $this->assertEqual($records[1]->$task_field, 'sleep', t('Correct data retrieved.'));
}
/**
@@ -2365,11 +2364,11 @@ class DatabaseAlterTestCase extends DatabaseTestCase {
$records = $result->fetchAll();
- $this->assertEqual(count($records), 1, 'Returned the correct number of rows.');
- $this->assertEqual($records[0]->$name_field, 'John', 'Correct data retrieved.');
- $this->assertEqual($records[0]->$tid_field, 2, 'Correct data retrieved.');
- $this->assertEqual($records[0]->$pid_field, 1, 'Correct data retrieved.');
- $this->assertEqual($records[0]->$task_field, 'sleep', 'Correct data retrieved.');
+ $this->assertEqual(count($records), 1, t('Returned the correct number of rows.'));
+ $this->assertEqual($records[0]->$name_field, 'John', t('Correct data retrieved.'));
+ $this->assertEqual($records[0]->$tid_field, 2, t('Correct data retrieved.'));
+ $this->assertEqual($records[0]->$pid_field, 1, t('Correct data retrieved.'));
+ $this->assertEqual($records[0]->$task_field, 'sleep', t('Correct data retrieved.'));
}
/**
@@ -2383,8 +2382,8 @@ class DatabaseAlterTestCase extends DatabaseTestCase {
$query->addTag('database_test_alter_change_fields');
$record = $query->execute()->fetch();
- $this->assertEqual($record->$name_field, 'George', 'Correct data retrieved.');
- $this->assertFalse(isset($record->$age_field), 'Age field not found, as intended.');
+ $this->assertEqual($record->$name_field, 'George', t('Correct data retrieved.'));
+ $this->assertFalse(isset($record->$age_field), t('Age field not found, as intended.'));
}
/**
@@ -2401,8 +2400,8 @@ class DatabaseAlterTestCase extends DatabaseTestCase {
// Ensure that we got the right record.
$record = $result->fetch();
- $this->assertEqual($record->$name_field, 'George', 'Fetched name is correct.');
- $this->assertEqual($record->$age_field, 27 * 3, 'Fetched age expression is correct.');
+ $this->assertEqual($record->$name_field, 'George', t('Fetched name is correct.'));
+ $this->assertEqual($record->$age_field, 27*3, t('Fetched age expression is correct.'));
}
/**
@@ -2417,7 +2416,7 @@ class DatabaseAlterTestCase extends DatabaseTestCase {
$num_records = count($query->execute()->fetchAll());
- $this->assertEqual($num_records, 4, 'Returned the correct number of rows.');
+ $this->assertEqual($num_records, 4, t('Returned the correct number of rows.'));
}
/**
@@ -2441,8 +2440,8 @@ class DatabaseAlterTestCase extends DatabaseTestCase {
$name_field = $query->addField('pq', 'name');
$record = $query->execute()->fetch();
- $this->assertEqual($record->$name_field, 'George', 'Fetched name is correct.');
- $this->assertEqual($record->$age_field, 27 * 3, 'Fetched age expression is correct.');
+ $this->assertEqual($record->$name_field, 'George', t('Fetched name is correct.'));
+ $this->assertEqual($record->$age_field, 27*3, t('Fetched age expression is correct.'));
}
}
@@ -2476,31 +2475,31 @@ class DatabaseRegressionTestCase extends DatabaseTestCase {
))->execute();
$from_database = db_query('SELECT name FROM {test} WHERE name = :name', array(':name' => $name))->fetchField();
- $this->assertIdentical($name, $from_database, "The database handles UTF-8 characters cleanly.");
+ $this->assertIdentical($name, $from_database, t("The database handles UTF-8 characters cleanly."));
}
/**
* Test the db_table_exists() function.
*/
function testDBTableExists() {
- $this->assertIdentical(TRUE, db_table_exists('node'), 'Returns true for existent table.');
- $this->assertIdentical(FALSE, db_table_exists('nosuchtable'), 'Returns false for nonexistent table.');
+ $this->assertIdentical(TRUE, db_table_exists('node'), t('Returns true for existent table.'));
+ $this->assertIdentical(FALSE, db_table_exists('nosuchtable'), t('Returns false for nonexistent table.'));
}
/**
* Test the db_field_exists() function.
*/
function testDBFieldExists() {
- $this->assertIdentical(TRUE, db_field_exists('node', 'nid'), 'Returns true for existent column.');
- $this->assertIdentical(FALSE, db_field_exists('node', 'nosuchcolumn'), 'Returns false for nonexistent column.');
+ $this->assertIdentical(TRUE, db_field_exists('node', 'nid'), t('Returns true for existent column.'));
+ $this->assertIdentical(FALSE, db_field_exists('node', 'nosuchcolumn'), t('Returns false for nonexistent column.'));
}
/**
* Test the db_index_exists() function.
*/
function testDBIndexExists() {
- $this->assertIdentical(TRUE, db_index_exists('node', 'node_created'), 'Returns true for existent index.');
- $this->assertIdentical(FALSE, db_index_exists('node', 'nosuchindex'), 'Returns false for nonexistent index.');
+ $this->assertIdentical(TRUE, db_index_exists('node', 'node_created'), t('Returns true for existent index.'));
+ $this->assertIdentical(FALSE, db_index_exists('node', 'nosuchindex'), t('Returns false for nonexistent index.'));
}
}
@@ -2528,10 +2527,10 @@ class DatabaseLoggingTestCase extends DatabaseTestCase {
$queries = Database::getLog('testing', 'default');
- $this->assertEqual(count($queries), 2, 'Correct number of queries recorded.');
+ $this->assertEqual(count($queries), 2, t('Correct number of queries recorded.'));
foreach ($queries as $query) {
- $this->assertEqual($query['caller']['function'], __FUNCTION__, 'Correct function in query log.');
+ $this->assertEqual($query['caller']['function'], __FUNCTION__, t('Correct function in query log.'));
}
}
@@ -2550,8 +2549,8 @@ class DatabaseLoggingTestCase extends DatabaseTestCase {
$queries1 = Database::getLog('testing1');
$queries2 = Database::getLog('testing2');
- $this->assertEqual(count($queries1), 2, 'Correct number of queries recorded for log 1.');
- $this->assertEqual(count($queries2), 1, 'Correct number of queries recorded for log 2.');
+ $this->assertEqual(count($queries1), 2, t('Correct number of queries recorded for log 1.'));
+ $this->assertEqual(count($queries2), 1, t('Correct number of queries recorded for log 2.'));
}
/**
@@ -2567,13 +2566,13 @@ class DatabaseLoggingTestCase extends DatabaseTestCase {
db_query('SELECT name FROM {test} WHERE age > :age', array(':age' => 25))->fetchCol();
- db_query('SELECT age FROM {test} WHERE name = :name', array(':name' => 'Ringo'), array('target' => 'slave')); //->fetchCol();
+ db_query('SELECT age FROM {test} WHERE name = :name', array(':name' => 'Ringo'), array('target' => 'slave'));//->fetchCol();
$queries1 = Database::getLog('testing1');
- $this->assertEqual(count($queries1), 2, 'Recorded queries from all targets.');
- $this->assertEqual($queries1[0]['target'], 'default', 'First query used default target.');
- $this->assertEqual($queries1[1]['target'], 'slave', 'Second query used slave target.');
+ $this->assertEqual(count($queries1), 2, t('Recorded queries from all targets.'));
+ $this->assertEqual($queries1[0]['target'], 'default', t('First query used default target.'));
+ $this->assertEqual($queries1[1]['target'], 'slave', t('Second query used slave target.'));
}
/**
@@ -2597,9 +2596,9 @@ class DatabaseLoggingTestCase extends DatabaseTestCase {
$queries1 = Database::getLog('testing1');
- $this->assertEqual(count($queries1), 2, 'Recorded queries from all targets.');
- $this->assertEqual($queries1[0]['target'], 'default', 'First query used default target.');
- $this->assertEqual($queries1[1]['target'], 'default', 'Second query used default target as fallback.');
+ $this->assertEqual(count($queries1), 2, t('Recorded queries from all targets.'));
+ $this->assertEqual($queries1[0]['target'], 'default', t('First query used default target.'));
+ $this->assertEqual($queries1[1]['target'], 'default', t('Second query used default target as fallback.'));
}
/**
@@ -2625,8 +2624,8 @@ class DatabaseLoggingTestCase extends DatabaseTestCase {
$queries1 = Database::getLog('testing1');
$queries2 = Database::getLog('testing1', 'test2');
- $this->assertEqual(count($queries1), 1, 'Correct number of queries recorded for first connection.');
- $this->assertEqual(count($queries2), 1, 'Correct number of queries recorded for second connection.');
+ $this->assertEqual(count($queries1), 1, t('Correct number of queries recorded for first connection.'));
+ $this->assertEqual(count($queries2), 1, t('Correct number of queries recorded for second connection.'));
}
}
@@ -2652,12 +2651,12 @@ class DatabaseRangeQueryTestCase extends DrupalWebTestCase {
function testRangeQuery() {
// Test if return correct number of rows.
$range_rows = db_query_range("SELECT name FROM {system} ORDER BY name", 2, 3)->fetchAll();
- $this->assertEqual(count($range_rows), 3, 'Range query work and return correct number of rows.');
+ $this->assertEqual(count($range_rows), 3, t('Range query work and return correct number of rows.'));
// Test if return target data.
$raw_rows = db_query('SELECT name FROM {system} ORDER BY name')->fetchAll();
$raw_rows = array_slice($raw_rows, 2, 3);
- $this->assertEqual($range_rows, $raw_rows, 'Range query work and return target data.');
+ $this->assertEqual($range_rows, $raw_rows, t('Range query work and return target data.'));
}
}
@@ -2691,19 +2690,19 @@ class DatabaseTemporaryQueryTestCase extends DrupalWebTestCase {
$this->drupalGet('database_test/db_query_temporary');
$data = json_decode($this->drupalGetContent());
if ($data) {
- $this->assertEqual($this->countTableRows("system"), $data->row_count, 'The temporary table contains the correct amount of rows.');
- $this->assertFalse(db_table_exists($data->table_name), 'The temporary table is, indeed, temporary.');
+ $this->assertEqual($this->countTableRows("system"), $data->row_count, t('The temporary table contains the correct amount of rows.'));
+ $this->assertFalse(db_table_exists($data->table_name), t('The temporary table is, indeed, temporary.'));
}
else {
- $this->fail("The creation of the temporary table failed.");
+ $this->fail(t("The creation of the temporary table failed."));
}
// Now try to run two db_query_temporary() in the same request.
$table_name_system = db_query_temporary('SELECT status FROM {system}', array());
$table_name_users = db_query_temporary('SELECT uid FROM {users}', array());
- $this->assertEqual($this->countTableRows($table_name_system), $this->countTableRows("system"), 'A temporary table was created successfully in this request.');
- $this->assertEqual($this->countTableRows($table_name_users), $this->countTableRows("users"), 'A second temporary table was created successfully in this request.');
+ $this->assertEqual($this->countTableRows($table_name_system), $this->countTableRows("system"), t('A temporary table was created successfully in this request.'));
+ $this->assertEqual($this->countTableRows($table_name_users), $this->countTableRows("users"), t('A second temporary table was created successfully in this request.'));
}
}
@@ -2738,7 +2737,7 @@ class DatabaseBasicSyntaxTestCase extends DatabaseTestCase {
':a4' => ' a ',
':a5' => 'test.',
));
- $this->assertIdentical($result->fetchField(), 'This is a test.', 'Basic CONCAT works.');
+ $this->assertIdentical($result->fetchField(), 'This is a test.', t('Basic CONCAT works.'));
}
/**
@@ -2751,7 +2750,7 @@ class DatabaseBasicSyntaxTestCase extends DatabaseTestCase {
':a3' => '.',
':age' => 25,
));
- $this->assertIdentical($result->fetchField(), 'The age of John is 25.', 'Field CONCAT works.');
+ $this->assertIdentical($result->fetchField(), 'The age of John is 25.', t('Field CONCAT works.'));
}
/**
@@ -2770,14 +2769,14 @@ class DatabaseBasicSyntaxTestCase extends DatabaseTestCase {
->countQuery()
->execute()
->fetchField();
- $this->assertIdentical($num_matches, '2', 'Found 2 records.');
+ $this->assertIdentical($num_matches, '2', t('Found 2 records.'));
// Match only "Ring_" using a LIKE expression with no wildcards.
$num_matches = db_select('test', 't')
->condition('name', db_like('Ring_'), 'LIKE')
->countQuery()
->execute()
->fetchField();
- $this->assertIdentical($num_matches, '1', 'Found 1 record.');
+ $this->assertIdentical($num_matches, '1', t('Found 1 record.'));
}
/**
@@ -2801,14 +2800,14 @@ class DatabaseBasicSyntaxTestCase extends DatabaseTestCase {
->countQuery()
->execute()
->fetchField();
- $this->assertIdentical($num_matches, '2', 'Found 2 records.');
+ $this->assertIdentical($num_matches, '2', t('Found 2 records.'));
// Match only the former using a LIKE expression with no wildcards.
$num_matches = db_select('test', 't')
->condition('name', db_like('abc%\_'), 'LIKE')
->countQuery()
->execute()
->fetchField();
- $this->assertIdentical($num_matches, '1', 'Found 1 record.');
+ $this->assertIdentical($num_matches, '1', t('Found 1 record.'));
}
}
@@ -2851,7 +2850,7 @@ class DatabaseInvalidDataTestCase extends DatabaseTestCase {
'job' => 'Singer',
))
->execute();
- $this->fail('Insert succeedded when it should not have.');
+ $this->fail(t('Insert succeedded when it should not have.'));
}
catch (Exception $e) {
// Check if the first record was inserted.
@@ -2863,14 +2862,14 @@ class DatabaseInvalidDataTestCase extends DatabaseTestCase {
// Database engines that don't support transactions can leave partial
// inserts in place when an error occurs. This is the case for MySQL
// when running on a MyISAM table.
- $this->pass("The whole transaction has not been rolled-back when a duplicate key insert occurs, this is expected because the database doesn't support transactions");
+ $this->pass(t("The whole transaction has not been rolled-back when a duplicate key insert occurs, this is expected because the database doesn't support transactions"));
}
else {
- $this->fail('The whole transaction is rolled back when a duplicate key insert occurs.');
+ $this->fail(t('The whole transaction is rolled back when a duplicate key insert occurs.'));
}
}
else {
- $this->pass('The whole transaction is rolled back when a duplicate key insert occurs.');
+ $this->pass(t('The whole transaction is rolled back when a duplicate key insert occurs.'));
}
// Ensure the other values were not inserted.
@@ -2879,7 +2878,7 @@ class DatabaseInvalidDataTestCase extends DatabaseTestCase {
->condition('age', array(17, 75), 'IN')
->execute()->fetchObject();
- $this->assertFalse($record, 'The rest of the insert aborted as expected.');
+ $this->assertFalse($record, t('The rest of the insert aborted as expected.'));
}
}
@@ -2907,7 +2906,7 @@ class DatabaseQueryTestCase extends DatabaseTestCase {
function testArraySubstitution() {
$names = db_query('SELECT name FROM {test} WHERE age IN (:ages) ORDER BY age', array(':ages' => array(25, 26, 27)))->fetchAll();
- $this->assertEqual(count($names), 3, 'Correct number of names returned');
+ $this->assertEqual(count($names), 3, t('Correct number of names returned'));
}
}
@@ -2973,19 +2972,19 @@ class DatabaseTransactionTestCase extends DatabaseTestCase {
))
->execute();
- $this->assertTrue($connection->inTransaction(), 'In transaction before calling nested transaction.');
+ $this->assertTrue($connection->inTransaction(), t('In transaction before calling nested transaction.'));
// We're already in a transaction, but we call ->transactionInnerLayer
// to nest another transaction inside the current one.
$this->transactionInnerLayer($suffix, $rollback);
- $this->assertTrue($connection->inTransaction(), 'In transaction after calling nested transaction.');
+ $this->assertTrue($connection->inTransaction(), t('In transaction after calling nested transaction.'));
if ($rollback) {
// Roll back the transaction, if requested.
// This rollback should propagate to the last savepoint.
$txn->rollback();
- $this->assertTrue(($connection->transactionDepth() == $depth), 'Transaction has rolled back to the last savepoint after calling rollback().');
+ $this->assertTrue(($connection->transactionDepth() == $depth), t('Transaction has rolled back to the last savepoint after calling rollback().'));
}
}
@@ -3001,7 +3000,7 @@ class DatabaseTransactionTestCase extends DatabaseTestCase {
protected function transactionInnerLayer($suffix, $rollback = FALSE) {
$connection = Database::getConnection();
- $this->assertTrue($connection->inTransaction(), 'In transaction in nested transaction.');
+ $this->assertTrue($connection->inTransaction(), t('In transaction in nested transaction.'));
$depth = $connection->transactionDepth();
// Start a transaction. If we're being called from ->transactionOuterLayer,
@@ -3011,7 +3010,7 @@ class DatabaseTransactionTestCase extends DatabaseTestCase {
$txn = db_transaction();
$depth2 = $connection->transactionDepth();
- $this->assertTrue($depth < $depth2, 'Transaction depth is has increased with new transaction.');
+ $this->assertTrue($depth < $depth2, t('Transaction depth is has increased with new transaction.'));
// Insert a single row into the testing table.
db_insert('test')
@@ -3021,13 +3020,13 @@ class DatabaseTransactionTestCase extends DatabaseTestCase {
))
->execute();
- $this->assertTrue($connection->inTransaction(), 'In transaction inside nested transaction.');
+ $this->assertTrue($connection->inTransaction(), t('In transaction inside nested transaction.'));
if ($rollback) {
// Roll back the transaction, if requested.
// This rollback should propagate to the last savepoint.
$txn->rollback();
- $this->assertTrue(($connection->transactionDepth() == $depth), 'Transaction has rolled back to the last savepoint after calling rollback().');
+ $this->assertTrue(($connection->transactionDepth() == $depth), t('Transaction has rolled back to the last savepoint after calling rollback().'));
}
}
@@ -3048,9 +3047,9 @@ class DatabaseTransactionTestCase extends DatabaseTestCase {
// Neither of the rows we inserted in the two transaction layers
// should be present in the tables post-rollback.
$saved_age = db_query('SELECT age FROM {test} WHERE name = :name', array(':name' => 'DavidB'))->fetchField();
- $this->assertNotIdentical($saved_age, '24', 'Cannot retrieve DavidB row after commit.');
+ $this->assertNotIdentical($saved_age, '24', t('Cannot retrieve DavidB row after commit.'));
$saved_age = db_query('SELECT age FROM {test} WHERE name = :name', array(':name' => 'DanielB'))->fetchField();
- $this->assertNotIdentical($saved_age, '19', 'Cannot retrieve DanielB row after commit.');
+ $this->assertNotIdentical($saved_age, '19', t('Cannot retrieve DanielB row after commit.'));
}
catch (Exception $e) {
$this->fail($e->getMessage());
@@ -3074,9 +3073,9 @@ class DatabaseTransactionTestCase extends DatabaseTestCase {
// Because our current database claims to not support transactions,
// the inserted rows should be present despite the attempt to roll back.
$saved_age = db_query('SELECT age FROM {test} WHERE name = :name', array(':name' => 'DavidB'))->fetchField();
- $this->assertIdentical($saved_age, '24', 'DavidB not rolled back, since transactions are not supported.');
+ $this->assertIdentical($saved_age, '24', t('DavidB not rolled back, since transactions are not supported.'));
$saved_age = db_query('SELECT age FROM {test} WHERE name = :name', array(':name' => 'DanielB'))->fetchField();
- $this->assertIdentical($saved_age, '19', 'DanielB not rolled back, since transactions are not supported.');
+ $this->assertIdentical($saved_age, '19', t('DanielB not rolled back, since transactions are not supported.'));
}
catch (Exception $e) {
$this->fail($e->getMessage());
@@ -3096,9 +3095,9 @@ class DatabaseTransactionTestCase extends DatabaseTestCase {
// Because we committed, both of the inserted rows should be present.
$saved_age = db_query('SELECT age FROM {test} WHERE name = :name', array(':name' => 'DavidA'))->fetchField();
- $this->assertIdentical($saved_age, '24', 'Can retrieve DavidA row after commit.');
+ $this->assertIdentical($saved_age, '24', t('Can retrieve DavidA row after commit.'));
$saved_age = db_query('SELECT age FROM {test} WHERE name = :name', array(':name' => 'DanielA'))->fetchField();
- $this->assertIdentical($saved_age, '19', 'Can retrieve DanielA row after commit.');
+ $this->assertIdentical($saved_age, '19', t('Can retrieve DanielA row after commit.'));
}
catch (Exception $e) {
$this->fail($e->getMessage());
@@ -3128,9 +3127,9 @@ class DatabaseNextIdCase extends DrupalWebTestCase {
// We can test for exact increase in here because we know there is no
// other process operating on these tables -- normally we could only
// expect $second > $first.
- $this->assertEqual($first + 1, $second, 'The second call from a sequence provides a number increased by one.');
+ $this->assertEqual($first + 1, $second, t('The second call from a sequence provides a number increased by one.'));
$result = db_next_id(1000);
- $this->assertEqual($result, 1001, 'Sequence provides a larger number than the existing ID.');
+ $this->assertEqual($result, 1001, t('Sequence provides a larger number than the existing ID.'));
}
}
@@ -3152,8 +3151,8 @@ class DatabaseEmptyStatementTestCase extends DrupalWebTestCase {
function testEmpty() {
$result = new DatabaseStatementEmpty();
- $this->assertTrue($result instanceof DatabaseStatementInterface, 'Class implements expected interface');
- $this->assertNull($result->fetchObject(), 'Null result returned.');
+ $this->assertTrue($result instanceof DatabaseStatementInterface, t('Class implements expected interface'));
+ $this->assertNull($result->fetchObject(), t('Null result returned.'));
}
/**
@@ -3163,11 +3162,11 @@ class DatabaseEmptyStatementTestCase extends DrupalWebTestCase {
$result = new DatabaseStatementEmpty();
foreach ($result as $record) {
- $this->fail('Iterating empty result set should not iterate.');
+ $this->fail(t('Iterating empty result set should not iterate.'));
return;
}
- $this->pass('Iterating empty result set skipped iteration.');
+ $this->pass(t('Iterating empty result set skipped iteration.'));
}
/**
@@ -3176,6 +3175,6 @@ class DatabaseEmptyStatementTestCase extends DrupalWebTestCase {
function testEmptyFetchAll() {
$result = new DatabaseStatementEmpty();
- $this->assertEqual($result->fetchAll(), array(), 'Empty array returned from empty result set.');
+ $this->assertEqual($result->fetchAll(), array(), t('Empty array returned from empty result set.'));
}
}
diff --git a/modules/simpletest/tests/entity_query.test b/modules/simpletest/tests/entity_query.test
index 5a04076f1..0b3db8b59 100644
--- a/modules/simpletest/tests/entity_query.test
+++ b/modules/simpletest/tests/entity_query.test
@@ -172,7 +172,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
array('test_entity_bundle_key', 4),
array('test_entity_bundle_key', 5),
array('test_entity_bundle_key', 6),
- ), 'Test entity entity_type condition.');
+ ), t('Test entity entity_type condition.'));
// Test entity_id condition.
$query = new EntityFieldQuery();
@@ -181,7 +181,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
->entityCondition('entity_id', '3');
$this->assertEntityFieldQuery($query, array(
array('test_entity_bundle_key', 3),
- ), 'Test entity entity_id condition.');
+ ), t('Test entity entity_id condition.'));
$query = new EntityFieldQuery();
$query
@@ -189,7 +189,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
->propertyCondition('ftid', '3');
$this->assertEntityFieldQuery($query, array(
array('test_entity_bundle_key', 3),
- ), 'Test entity entity_id condition and entity_id property condition.');
+ ), t('Test entity entity_id condition and entity_id property condition.'));
// Test bundle condition.
$query = new EntityFieldQuery();
@@ -201,7 +201,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
array('test_entity_bundle_key', 2),
array('test_entity_bundle_key', 3),
array('test_entity_bundle_key', 4),
- ), 'Test entity bundle condition: bundle1.');
+ ), t('Test entity bundle condition: bundle1.'));
$query = new EntityFieldQuery();
$query
@@ -210,7 +210,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
$this->assertEntityFieldQuery($query, array(
array('test_entity_bundle_key', 5),
array('test_entity_bundle_key', 6),
- ), 'Test entity bundle condition: bundle2.');
+ ), t('Test entity bundle condition: bundle2.'));
$query = new EntityFieldQuery();
$query
@@ -219,7 +219,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
$this->assertEntityFieldQuery($query, array(
array('test_entity_bundle_key', 5),
array('test_entity_bundle_key', 6),
- ), 'Test entity bundle condition and bundle property condition.');
+ ), t('Test entity bundle condition and bundle property condition.'));
// Test revision_id condition.
$query = new EntityFieldQuery();
@@ -228,7 +228,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
->entityCondition('revision_id', '3');
$this->assertEntityFieldQuery($query, array(
array('test_entity', 3),
- ), 'Test entity revision_id condition.');
+ ), t('Test entity revision_id condition.'));
$query = new EntityFieldQuery();
$query
@@ -236,7 +236,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
->propertyCondition('ftvid', '3');
$this->assertEntityFieldQuery($query, array(
array('test_entity', 3),
- ), 'Test entity revision_id condition and revision_id property condition.');
+ ), t('Test entity revision_id condition and revision_id property condition.'));
$query = new EntityFieldQuery();
$query
@@ -246,7 +246,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
$this->assertEntityFieldQuery($query, array(
array('test_entity', 100),
array('test_entity', 101),
- ), 'Test revision age.');
+ ), t('Test revision age.'));
// Test that fields attached to the non-revision supporting entity
// 'test_entity_bundle_key' are reachable in FIELD_LOAD_REVISION.
@@ -263,7 +263,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
array('test_entity', 2),
array('test_entity', 3),
array('test_entity', 4),
- ), 'Test that fields are reachable from FIELD_LOAD_REVISION even for non-revision entities.');
+ ), t('Test that fields are reachable from FIELD_LOAD_REVISION even for non-revision entities.'));
// Test entity sort by entity_id.
$query = new EntityFieldQuery();
@@ -277,7 +277,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
array('test_entity_bundle_key', 4),
array('test_entity_bundle_key', 5),
array('test_entity_bundle_key', 6),
- ), 'Test sort entity entity_id in ascending order.', TRUE);
+ ), t('Test sort entity entity_id in ascending order.'), TRUE);
$query = new EntityFieldQuery();
$query
@@ -290,7 +290,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
array('test_entity_bundle_key', 3),
array('test_entity_bundle_key', 2),
array('test_entity_bundle_key', 1),
- ), 'Test sort entity entity_id in descending order.', TRUE);
+ ), t('Test sort entity entity_id in descending order.'), TRUE);
// Test property sort by entity id.
$query = new EntityFieldQuery();
@@ -304,7 +304,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
array('test_entity_bundle_key', 4),
array('test_entity_bundle_key', 5),
array('test_entity_bundle_key', 6),
- ), 'Test sort entity entity_id property in ascending order.', TRUE);
+ ), t('Test sort entity entity_id property in ascending order.'), TRUE);
$query = new EntityFieldQuery();
$query
@@ -317,7 +317,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
array('test_entity_bundle_key', 3),
array('test_entity_bundle_key', 2),
array('test_entity_bundle_key', 1),
- ), 'Test sort entity entity_id property in descending order.', TRUE);
+ ), t('Test sort entity entity_id property in descending order.'), TRUE);
// Test entity sort by bundle.
$query = new EntityFieldQuery();
@@ -332,7 +332,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
array('test_entity_bundle_key', 4),
array('test_entity_bundle_key', 5),
array('test_entity_bundle_key', 6),
- ), 'Test sort entity bundle in ascending order.', TRUE);
+ ), t('Test sort entity bundle in ascending order.'), TRUE);
$query = new EntityFieldQuery();
$query
@@ -346,7 +346,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
array('test_entity_bundle_key', 3),
array('test_entity_bundle_key', 2),
array('test_entity_bundle_key', 1),
- ), 'Test sort entity bundle in descending order.', TRUE);
+ ), t('Test sort entity bundle in descending order.'), TRUE);
// Test entity sort by revision_id.
$query = new EntityFieldQuery();
@@ -358,7 +358,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
array('test_entity', 2),
array('test_entity', 3),
array('test_entity', 4),
- ), 'Test sort entity revision_id in ascending order.', TRUE);
+ ), t('Test sort entity revision_id in ascending order.'), TRUE);
$query = new EntityFieldQuery();
$query
@@ -369,7 +369,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
array('test_entity', 3),
array('test_entity', 2),
array('test_entity', 1),
- ), 'Test sort entity revision_id in descending order.', TRUE);
+ ), t('Test sort entity revision_id in descending order.'), TRUE);
// Test property sort by revision_id.
$query = new EntityFieldQuery();
@@ -381,7 +381,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
array('test_entity', 2),
array('test_entity', 3),
array('test_entity', 4),
- ), 'Test sort entity revision_id property in ascending order.', TRUE);
+ ), t('Test sort entity revision_id property in ascending order.'), TRUE);
$query = new EntityFieldQuery();
$query
@@ -392,7 +392,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
array('test_entity', 3),
array('test_entity', 2),
array('test_entity', 1),
- ), 'Test sort entity revision_id property in descending order.', TRUE);
+ ), t('Test sort entity revision_id property in descending order.'), TRUE);
$query = new EntityFieldQuery();
$query
@@ -403,7 +403,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
array('test_entity_bundle_key', 2),
array('test_entity_bundle_key', 3),
array('test_entity_bundle_key', 4),
- ), 'Test sort field in ascending order without field condition.', TRUE);
+ ), t('Test sort field in ascending order without field condition.'), TRUE);
$query = new EntityFieldQuery();
$query
@@ -414,7 +414,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
array('test_entity_bundle_key', 3),
array('test_entity_bundle_key', 2),
array('test_entity_bundle_key', 1),
- ), 'Test sort field in descending order without field condition.', TRUE);
+ ), t('Test sort field in descending order without field condition.'), TRUE);
$query = new EntityFieldQuery();
$query
@@ -426,7 +426,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
array('test_entity_bundle_key', 2),
array('test_entity_bundle_key', 3),
array('test_entity_bundle_key', 4),
- ), 'Test sort field in ascending order.', TRUE);
+ ), t('Test sort field in ascending order.'), TRUE);
$query = new EntityFieldQuery();
$query
@@ -438,7 +438,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
array('test_entity_bundle_key', 3),
array('test_entity_bundle_key', 2),
array('test_entity_bundle_key', 1),
- ), 'Test sort field in descending order.', TRUE);
+ ), t('Test sort field in descending order.'), TRUE);
// Test "in" operation with entity entity_type condition and entity_id
// property condition.
@@ -450,7 +450,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
array('test_entity_bundle_key', 1),
array('test_entity_bundle_key', 3),
array('test_entity_bundle_key', 4),
- ), 'Test "in" operation with entity entity_type condition and entity_id property condition.');
+ ), t('Test "in" operation with entity entity_type condition and entity_id property condition.'));
// Test "in" operation with entity entity_type condition and entity_id
// property condition. Sort in descending order by entity_id.
@@ -463,7 +463,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
array('test_entity_bundle_key', 4),
array('test_entity_bundle_key', 3),
array('test_entity_bundle_key', 1),
- ), 'Test "in" operation with entity entity_type condition and entity_id property condition. Sort entity_id in descending order.', TRUE);
+ ), t('Test "in" operation with entity entity_type condition and entity_id property condition. Sort entity_id in descending order.'), TRUE);
// Test query count
$query = new EntityFieldQuery();
@@ -471,7 +471,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
->entityCondition('entity_type', 'test_entity_bundle_key')
->count()
->execute();
- $this->assertEqual($query_count, 6, 'Test query count on entity condition.');
+ $this->assertEqual($query_count, 6, t('Test query count on entity condition.'));
$query = new EntityFieldQuery();
$query_count = $query
@@ -479,7 +479,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
->propertyCondition('ftid', '1')
->count()
->execute();
- $this->assertEqual($query_count, 1, 'Test query count on entity and property condition.');
+ $this->assertEqual($query_count, 1, t('Test query count on entity and property condition.'));
$query = new EntityFieldQuery();
$query_count = $query
@@ -487,7 +487,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
->propertyCondition('ftid', '4', '>')
->count()
->execute();
- $this->assertEqual($query_count, 2, 'Test query count on entity and property condition with operator.');
+ $this->assertEqual($query_count, 2, t('Test query count on entity and property condition with operator.'));
$query = new EntityFieldQuery();
$query_count = $query
@@ -495,7 +495,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
->fieldCondition($this->fields[0], 'value', 3, '=')
->count()
->execute();
- $this->assertEqual($query_count, 1, 'Test query count on field condition.');
+ $this->assertEqual($query_count, 1, t('Test query count on field condition.'));
// First, test without options.
$query = new EntityFieldQuery();
@@ -504,14 +504,14 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
->propertyCondition('ftid', 1, 'CONTAINS');
$this->assertEntityFieldQuery($query, array(
array('test_entity_bundle_key', 1),
- ), 'Test the "contains" operation on a property.');
+ ), t('Test the "contains" operation on a property.'));
$query = new EntityFieldQuery();
$query->fieldCondition($this->fields[0], 'value', 3, 'CONTAINS');
$this->assertEntityFieldQuery($query, array(
array('test_entity_bundle_key', 3),
array('test_entity', 3),
- ), 'Test the "contains" operation on a field.');
+ ), t('Test the "contains" operation on a field.'));
$query = new EntityFieldQuery();
$query
@@ -519,14 +519,14 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
->propertyCondition('ftid', 1, '=');
$this->assertEntityFieldQuery($query, array(
array('test_entity_bundle_key', 1),
- ), 'Test the "equal to" operation on a property.');
+ ), t('Test the "equal to" operation on a property.'));
$query = new EntityFieldQuery();
$query->fieldCondition($this->fields[0], 'value', 3, '=');
$this->assertEntityFieldQuery($query, array(
array('test_entity_bundle_key', 3),
array('test_entity', 3),
- ), 'Test the "equal to" operation on a field.');
+ ), t('Test the "equal to" operation on a field.'));
$query = new EntityFieldQuery();
$query
@@ -538,7 +538,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
array('test_entity_bundle_key', 4),
array('test_entity_bundle_key', 5),
array('test_entity_bundle_key', 6),
- ), 'Test the "not equal to" operation on a property.');
+ ), t('Test the "not equal to" operation on a property.'));
$query = new EntityFieldQuery();
$query->fieldCondition($this->fields[0], 'value', 3, '!=');
@@ -549,7 +549,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
array('test_entity', 1),
array('test_entity', 2),
array('test_entity', 4),
- ), 'Test the "not equal to" operation on a field.');
+ ), t('Test the "not equal to" operation on a field.'));
$query = new EntityFieldQuery();
$query
@@ -557,14 +557,14 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
->propertyCondition('ftid', 2, '<');
$this->assertEntityFieldQuery($query, array(
array('test_entity_bundle_key', 1),
- ), 'Test the "less than" operation on a property.');
+ ), t('Test the "less than" operation on a property.'));
$query = new EntityFieldQuery();
$query->fieldCondition($this->fields[0], 'value', 2, '<');
$this->assertEntityFieldQuery($query, array(
array('test_entity_bundle_key', 1),
array('test_entity', 1),
- ), 'Test the "less than" operation on a field.');
+ ), t('Test the "less than" operation on a field.'));
$query = new EntityFieldQuery();
$query
@@ -573,7 +573,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
$this->assertEntityFieldQuery($query, array(
array('test_entity_bundle_key', 1),
array('test_entity_bundle_key', 2),
- ), 'Test the "less than or equal to" operation on a property.');
+ ), t('Test the "less than or equal to" operation on a property.'));
$query = new EntityFieldQuery();
$query->fieldCondition($this->fields[0], 'value', 2, '<=');
@@ -582,7 +582,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
array('test_entity_bundle_key', 2),
array('test_entity', 1),
array('test_entity', 2),
- ), 'Test the "less than or equal to" operation on a field.');
+ ), t('Test the "less than or equal to" operation on a field.'));
$query = new EntityFieldQuery();
$query
@@ -591,7 +591,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
$this->assertEntityFieldQuery($query, array(
array('test_entity_bundle_key', 5),
array('test_entity_bundle_key', 6),
- ), 'Test the "greater than" operation on a property.');
+ ), t('Test the "greater than" operation on a property.'));
$query = new EntityFieldQuery();
$query->fieldCondition($this->fields[0], 'value', 2, '>');
@@ -600,7 +600,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
array('test_entity_bundle_key', 4),
array('test_entity', 3),
array('test_entity', 4),
- ), 'Test the "greater than" operation on a field.');
+ ), t('Test the "greater than" operation on a field.'));
$query = new EntityFieldQuery();
$query
@@ -610,7 +610,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
array('test_entity_bundle_key', 4),
array('test_entity_bundle_key', 5),
array('test_entity_bundle_key', 6),
- ), 'Test the "greater than or equal to" operation on a property.');
+ ), t('Test the "greater than or equal to" operation on a property.'));
$query = new EntityFieldQuery();
$query->fieldCondition($this->fields[0], 'value', 3, '>=');
@@ -619,7 +619,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
array('test_entity_bundle_key', 4),
array('test_entity', 3),
array('test_entity', 4),
- ), 'Test the "greater than or equal to" operation on a field.');
+ ), t('Test the "greater than or equal to" operation on a field.'));
$query = new EntityFieldQuery();
$query
@@ -630,7 +630,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
array('test_entity_bundle_key', 2),
array('test_entity_bundle_key', 5),
array('test_entity_bundle_key', 6),
- ), 'Test the "not in" operation on a property.');
+ ), t('Test the "not in" operation on a property.'));
$query = new EntityFieldQuery();
$query->fieldCondition($this->fields[0], 'value', array(3, 4, 100, 101), 'NOT IN');
@@ -639,7 +639,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
array('test_entity_bundle_key', 2),
array('test_entity', 1),
array('test_entity', 2),
- ), 'Test the "not in" operation on a field.');
+ ), t('Test the "not in" operation on a field.'));
$query = new EntityFieldQuery();
$query
@@ -648,7 +648,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
$this->assertEntityFieldQuery($query, array(
array('test_entity_bundle_key', 3),
array('test_entity_bundle_key', 4),
- ), 'Test the "in" operation on a property.');
+ ), t('Test the "in" operation on a property.'));
$query = new EntityFieldQuery();
$query->fieldCondition($this->fields[0], 'value', array(2, 3), 'IN');
@@ -657,7 +657,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
array('test_entity_bundle_key', 3),
array('test_entity', 2),
array('test_entity', 3),
- ), 'Test the "in" operation on a field.');
+ ), t('Test the "in" operation on a field.'));
$query = new EntityFieldQuery();
$query
@@ -667,7 +667,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
array('test_entity_bundle_key', 1),
array('test_entity_bundle_key', 2),
array('test_entity_bundle_key', 3),
- ), 'Test the "between" operation on a property.');
+ ), t('Test the "between" operation on a property.'));
$query = new EntityFieldQuery();
$query->fieldCondition($this->fields[0], 'value', array(1, 3), 'BETWEEN');
@@ -678,7 +678,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
array('test_entity', 1),
array('test_entity', 2),
array('test_entity', 3),
- ), 'Test the "between" operation on a field.');
+ ), t('Test the "between" operation on a field.'));
$query = new EntityFieldQuery();
$query
@@ -691,20 +691,20 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
array('test_entity_bundle_key', 4),
array('test_entity_bundle_key', 5),
array('test_entity_bundle_key', 6),
- ), 'Test the "starts_with" operation on a property.');
+ ), t('Test the "starts_with" operation on a property.'));
$query = new EntityFieldQuery();
$query->fieldCondition($this->fields[1], 'shape', 'squ', 'STARTS_WITH');
$this->assertEntityFieldQuery($query, array(
array('test_entity_bundle', 5),
- ), 'Test the "starts_with" operation on a field.');
+ ), t('Test the "starts_with" operation on a field.'));
$query = new EntityFieldQuery();
$query->fieldCondition($this->fields[0], 'value', 3);
$this->assertEntityFieldQuery($query, array(
array('test_entity_bundle_key', 3),
array('test_entity', 3),
- ), 'Test omission of an operator with a single item.');
+ ), t('Test omission of an operator with a single item.'));
$query = new EntityFieldQuery();
$query->fieldCondition($this->fields[0], 'value', array(2, 3));
@@ -713,7 +713,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
array('test_entity_bundle_key', 3),
array('test_entity', 2),
array('test_entity', 3),
- ), 'Test omission of an operator with multiple items.');
+ ), t('Test omission of an operator with multiple items.'));
$query = new EntityFieldQuery();
$query
@@ -723,7 +723,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
$this->assertEntityFieldQuery($query, array(
array('test_entity_bundle_key', 2),
array('test_entity_bundle_key', 3),
- ), 'Test entity, property and field conditions.');
+ ), t('Test entity, property and field conditions.'));
$query = new EntityFieldQuery();
$query
@@ -733,7 +733,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
->fieldCondition($this->fields[0], 'value', 4);
$this->assertEntityFieldQuery($query, array(
array('test_entity_bundle_key', 4),
- ), 'Test entity condition with "starts_with" operation, and property and field conditions.');
+ ), t('Test entity condition with "starts_with" operation, and property and field conditions.'));
$query = new EntityFieldQuery();
$query
@@ -743,7 +743,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
$this->assertEntityFieldQuery($query, array(
array('test_entity_bundle_key', 1),
array('test_entity_bundle_key', 2),
- ), 'Test limit on a property.', TRUE);
+ ), t('Test limit on a property.'), TRUE);
$query = new EntityFieldQuery();
$query
@@ -754,7 +754,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
$this->assertEntityFieldQuery($query, array(
array('test_entity_bundle_key', 1),
array('test_entity_bundle_key', 2),
- ), 'Test limit on a field.', TRUE);
+ ), t('Test limit on a field.'), TRUE);
$query = new EntityFieldQuery();
$query
@@ -764,7 +764,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
$this->assertEntityFieldQuery($query, array(
array('test_entity_bundle_key', 5),
array('test_entity_bundle_key', 6),
- ), 'Test offset on a property.', TRUE);
+ ), t('Test offset on a property.'), TRUE);
$query = new EntityFieldQuery();
$query
@@ -775,7 +775,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
$this->assertEntityFieldQuery($query, array(
array('test_entity_bundle_key', 3),
array('test_entity_bundle_key', 4),
- ), 'Test offset on a field.', TRUE);
+ ), t('Test offset on a field.'), TRUE);
for ($i = 6; $i < 10; $i++) {
$entity = new stdClass();
@@ -794,7 +794,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
array('test_entity', 4),
array('test_entity_bundle', 8),
array('test_entity_bundle', 9),
- ), 'Select a field across multiple entities.');
+ ), t('Select a field across multiple entities.'));
$query = new EntityFieldQuery();
$query
@@ -802,13 +802,13 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
->fieldCondition($this->fields[1], 'color', 'blue');
$this->assertEntityFieldQuery($query, array(
array('test_entity_bundle', 5),
- ), 'Test without a delta group.');
+ ), t('Test without a delta group.'));
$query = new EntityFieldQuery();
$query
->fieldCondition($this->fields[1], 'shape', 'square', '=', 'group')
->fieldCondition($this->fields[1], 'color', 'blue', '=', 'group');
- $this->assertEntityFieldQuery($query, array(), 'Test with a delta group.');
+ $this->assertEntityFieldQuery($query, array(), t('Test with a delta group.'));
// Test query on a deleted field.
field_attach_delete_bundle('test_entity_bundle_key', 'bundle1');
@@ -817,12 +817,12 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
$query->fieldCondition($this->fields[0], 'value', '3');
$this->assertEntityFieldQuery($query, array(
array('test_entity_bundle', 8),
- ), 'Test query on a field after deleting field from some entities.');
+ ), t('Test query on a field after deleting field from some entities.'));
field_attach_delete_bundle('test_entity_bundle', 'test_entity_bundle');
$query = new EntityFieldQuery();
$query->fieldCondition($this->fields[0], 'value', '3');
- $this->assertEntityFieldQuery($query, array(), 'Test query on a field after deleting field from all entities.');
+ $this->assertEntityFieldQuery($query, array(), t('Test query on a field after deleting field from all entities.'));
$query = new EntityFieldQuery();
$query
@@ -832,7 +832,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
array('test_entity_bundle_key', 3),
array('test_entity_bundle', 8),
array('test_entity', 3),
- ), 'Test query on a deleted field with deleted option set to TRUE.');
+ ), t('Test query on a deleted field with deleted option set to TRUE.'));
$pass = FALSE;
$query = new EntityFieldQuery();
@@ -842,7 +842,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
catch (EntityFieldQueryException $exception) {
$pass = ($exception->getMessage() == t('For this query an entity type must be specified.'));
}
- $this->assertTrue($pass, "Can't query the universe.");
+ $this->assertTrue($pass, t("Can't query the universe."));
}
/**
@@ -852,19 +852,19 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
// Entity-only query.
$query = new EntityFieldQuery();
$query->entityCondition('entity_type', 'test_entity_bundle_key');
- $this->assertIdentical($query->queryCallback(), array($query, 'propertyQuery'), 'Entity-only queries are handled by the propertyQuery handler.');
+ $this->assertIdentical($query->queryCallback(), array($query, 'propertyQuery'), t('Entity-only queries are handled by the propertyQuery handler.'));
// Field-only query.
$query = new EntityFieldQuery();
$query->fieldCondition($this->fields[0], 'value', '3');
- $this->assertIdentical($query->queryCallback(), 'field_sql_storage_field_storage_query', 'Pure field queries are handled by the Field storage handler.');
+ $this->assertIdentical($query->queryCallback(), 'field_sql_storage_field_storage_query', t('Pure field queries are handled by the Field storage handler.'));
// Mixed entity and field query.
$query = new EntityFieldQuery();
$query
->entityCondition('entity_type', 'test_entity_bundle_key')
->fieldCondition($this->fields[0], 'value', '3');
- $this->assertIdentical($query->queryCallback(), 'field_sql_storage_field_storage_query', 'Mixed queries are handled by the Field storage handler.');
+ $this->assertIdentical($query->queryCallback(), 'field_sql_storage_field_storage_query', t('Mixed queries are handled by the Field storage handler.'));
// Overriding with $query->executeCallback.
$query = new EntityFieldQuery();
@@ -872,7 +872,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
$query->executeCallback = 'field_test_dummy_field_storage_query';
$this->assertEntityFieldQuery($query, array(
array('user', 1),
- ), 'executeCallback can override the query handler.');
+ ), t('executeCallback can override the query handler.'));
// Overriding with $query->executeCallback via hook_entity_query_alter().
$query = new EntityFieldQuery();
@@ -881,7 +881,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
$query->alterMyExecuteCallbackPlease = TRUE;
$this->assertEntityFieldQuery($query, array(
array('user', 1),
- ), 'executeCallback can override the query handler when set in a hook_entity_query_alter().');
+ ), t('executeCallback can override the query handler when set in a hook_entity_query_alter().'));
// Mixed-storage queries.
$query = new EntityFieldQuery();
@@ -896,7 +896,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
catch (EntityFieldQueryException $exception) {
$pass = ($exception->getMessage() == t("Can't handle more than one field storage engine"));
}
- $this->assertTrue($pass, 'Cannot query across field storage engines.');
+ $this->assertTrue($pass, t('Cannot query across field storage engines.'));
}
/**
diff --git a/modules/simpletest/tests/error.test b/modules/simpletest/tests/error.test
index cd648e12b..fe4ee4526 100644
--- a/modules/simpletest/tests/error.test
+++ b/modules/simpletest/tests/error.test
@@ -46,7 +46,7 @@ class DrupalErrorHandlerUnitTest extends DrupalWebTestCase {
// Set error reporting to collect notices.
variable_set('error_level', ERROR_REPORTING_DISPLAY_ALL);
$this->drupalGet('error-test/generate-warnings');
- $this->assertResponse(200, 'Received expected HTTP status code.');
+ $this->assertResponse(200, t('Received expected HTTP status code.'));
$this->assertErrorMessage($error_notice);
$this->assertErrorMessage($error_warning);
$this->assertErrorMessage($error_user_notice);
@@ -54,7 +54,7 @@ class DrupalErrorHandlerUnitTest extends DrupalWebTestCase {
// Set error reporting to not collect notices.
variable_set('error_level', ERROR_REPORTING_DISPLAY_SOME);
$this->drupalGet('error-test/generate-warnings');
- $this->assertResponse(200, 'Received expected HTTP status code.');
+ $this->assertResponse(200, t('Received expected HTTP status code.'));
$this->assertNoErrorMessage($error_notice);
$this->assertErrorMessage($error_warning);
$this->assertErrorMessage($error_user_notice);
@@ -62,7 +62,7 @@ class DrupalErrorHandlerUnitTest extends DrupalWebTestCase {
// Set error reporting to not show any errors.
variable_set('error_level', ERROR_REPORTING_HIDE);
$this->drupalGet('error-test/generate-warnings');
- $this->assertResponse(200, 'Received expected HTTP status code.');
+ $this->assertResponse(200, t('Received expected HTTP status code.'));
$this->assertNoErrorMessage($error_notice);
$this->assertNoErrorMessage($error_warning);
$this->assertNoErrorMessage($error_user_notice);
@@ -88,17 +88,17 @@ class DrupalErrorHandlerUnitTest extends DrupalWebTestCase {
);
$this->drupalGet('error-test/trigger-exception');
- $this->assertTrue(strpos($this->drupalGetHeader(':status'), '500 Service unavailable (with message)'), 'Received expected HTTP status line.');
+ $this->assertTrue(strpos($this->drupalGetHeader(':status'), '500 Service unavailable (with message)'), t('Received expected HTTP status line.'));
$this->assertErrorMessage($error_exception);
$this->drupalGet('error-test/trigger-pdo-exception');
- $this->assertTrue(strpos($this->drupalGetHeader(':status'), '500 Service unavailable (with message)'), 'Received expected HTTP status line.');
+ $this->assertTrue(strpos($this->drupalGetHeader(':status'), '500 Service unavailable (with message)'), t('Received expected HTTP status line.'));
// We cannot use assertErrorMessage() since the extact error reported
// varies from database to database. Check that the SQL string is displayed.
- $this->assertText($error_pdo_exception['%type'], 'Found ' . $error_pdo_exception['%type'] . ' in error page.');
- $this->assertText($error_pdo_exception['%message'], 'Found ' . $error_pdo_exception['%message'] . ' in error page.');
+ $this->assertText($error_pdo_exception['%type'], t('Found %type in error page.', $error_pdo_exception));
+ $this->assertText($error_pdo_exception['%message'], t('Found %message in error page.', $error_pdo_exception));
$error_details = t('in %function (line %line of %file)', $error_pdo_exception);
- $this->assertRaw($error_details, "Found '" . $error_details . "' in error page.");
+ $this->assertRaw($error_details, t("Found '!message' in error page.", array('!message' => $error_details)));
}
/**
@@ -106,7 +106,7 @@ class DrupalErrorHandlerUnitTest extends DrupalWebTestCase {
*/
function assertErrorMessage(array $error) {
$message = t('%type: %message in %function (line %line of %file).', $error);
- $this->assertRaw($message, 'Error ' . $message . ' found.');
+ $this->assertRaw($message, t('Error !message found.', array('!message' => $message)));
}
/**
@@ -114,7 +114,7 @@ class DrupalErrorHandlerUnitTest extends DrupalWebTestCase {
*/
function assertNoErrorMessage(array $error) {
$message = t('%type: %message in %function (line %line of %file).', $error);
- $this->assertNoRaw($message, 'Error ' . $message . ' not found.');
+ $this->assertNoRaw($message, t('Error !message not found.', array('!message' => $message)));
}
}
diff --git a/modules/simpletest/tests/file.test b/modules/simpletest/tests/file.test
index 268cd24d8..4cfdad807 100644
--- a/modules/simpletest/tests/file.test
+++ b/modules/simpletest/tests/file.test
@@ -58,13 +58,13 @@ class FileTestCase extends DrupalWebTestCase {
* File object to compare.
*/
function assertFileUnchanged($before, $after) {
- $this->assertEqual($before->fid, $after->fid, 'File id is the same: ' . $before->fid . ' == ' . $after->fid . '.', 'File unchanged');
- $this->assertEqual($before->uid, $after->uid, 'File owner is the same: ' . $before->uid . ' == ' . $after->uid . '.', 'File unchanged');
- $this->assertEqual($before->filename, $after->filename, 'File name is the same: ' . $before->filename . ' == ' . $after->filename . '.', 'File unchanged');
- $this->assertEqual($before->uri, $after->uri, 'File path is the same: ' . $before->uri . ' == ' . $after->uri . '.', 'File unchanged');
- $this->assertEqual($before->filemime, $after->filemime, 'File MIME type is the same: ' . $before->filemime . ' == ' . $after->filemime . '.', 'File unchanged');
- $this->assertEqual($before->filesize, $after->filesize, 'File size is the same: ' . $before->filesize . ' == ' . $after->filesize . '.', 'File unchanged');
- $this->assertEqual($before->status, $after->status, 'File status is the same: ' . $before->status . ' == ' . $after->status . '.', 'File unchanged');
+ $this->assertEqual($before->fid, $after->fid, t('File id is the same: %file1 == %file2.', array('%file1' => $before->fid, '%file2' => $after->fid)), 'File unchanged');
+ $this->assertEqual($before->uid, $after->uid, t('File owner is the same: %file1 == %file2.', array('%file1' => $before->uid, '%file2' => $after->uid)), 'File unchanged');
+ $this->assertEqual($before->filename, $after->filename, t('File name is the same: %file1 == %file2.', array('%file1' => $before->filename, '%file2' => $after->filename)), 'File unchanged');
+ $this->assertEqual($before->uri, $after->uri, t('File path is the same: %file1 == %file2.', array('%file1' => $before->uri, '%file2' => $after->uri)), 'File unchanged');
+ $this->assertEqual($before->filemime, $after->filemime, t('File MIME type is the same: %file1 == %file2.', array('%file1' => $before->filemime, '%file2' => $after->filemime)), 'File unchanged');
+ $this->assertEqual($before->filesize, $after->filesize, t('File size is the same: %file1 == %file2.', array('%file1' => $before->filesize, '%file2' => $after->filesize)), 'File unchanged');
+ $this->assertEqual($before->status, $after->status, t('File status is the same: %file1 == %file2.', array('%file1' => $before->status, '%file2' => $after->status)), 'File unchanged');
}
/**
@@ -76,8 +76,8 @@ class FileTestCase extends DrupalWebTestCase {
* File object to compare.
*/
function assertDifferentFile($file1, $file2) {
- $this->assertNotEqual($file1->fid, $file2->fid, 'Files have different ids: ' . $file1->fid . ' != ' . $file2->fid . '.', 'Different file');
- $this->assertNotEqual($file1->uri, $file2->uri, 'Files have different paths: ' . $file1->uri . ' != ' . $file2->uri . '.', 'Different file');
+ $this->assertNotEqual($file1->fid, $file2->fid, t('Files have different ids: %file1 != %file2.', array('%file1' => $file1->fid, '%file2' => $file2->fid)), 'Different file');
+ $this->assertNotEqual($file1->uri, $file2->uri, t('Files have different paths: %file1 != %file2.', array('%file1' => $file1->uri, '%file2' => $file2->uri)), 'Different file');
}
/**
@@ -89,8 +89,8 @@ class FileTestCase extends DrupalWebTestCase {
* File object to compare.
*/
function assertSameFile($file1, $file2) {
- $this->assertEqual($file1->fid, $file2->fid, 'Files have the same ids: ' . $file1->fid . ' == %file2.', 'Same file');
- $this->assertEqual($file1->uri, $file2->uri, 'Files have the same path: ' . $file1->uri . ' == ' . $file2->uri . '.', 'Same file');
+ $this->assertEqual($file1->fid, $file2->fid, t('Files have the same ids: %file1 == %file2.', array('%file1' => $file1->fid, '%file2-fid' => $file2->fid)), 'Same file');
+ $this->assertEqual($file1->uri, $file2->uri, t('Files have the same path: %file1 == %file2.', array('%file1' => $file1->uri, '%file2' => $file2->uri)), 'Same file');
}
/**
@@ -151,7 +151,7 @@ class FileTestCase extends DrupalWebTestCase {
if (is_null($path)) {
$path = file_directory_path() . '/' . $this->randomName();
}
- $this->assertTrue(drupal_mkdir($path) && is_dir($path), 'Directory was created successfully.');
+ $this->assertTrue(drupal_mkdir($path) && is_dir($path), t('Directory was created successfully.'));
return $path;
}
@@ -182,7 +182,7 @@ class FileTestCase extends DrupalWebTestCase {
}
file_put_contents($filepath, $contents);
- $this->assertTrue(is_file($filepath), 'The test file exists on the disk.', 'Create test file');
+ $this->assertTrue(is_file($filepath), t('The test file exists on the disk.'), 'Create test file');
$file = new stdClass();
$file->uri = $filepath;
@@ -194,7 +194,7 @@ class FileTestCase extends DrupalWebTestCase {
$file->status = 0;
// Write the record directly rather than calling file_save() so we don't
// invoke the hooks.
- $this->assertNotIdentical(drupal_write_record('file_managed', $file), FALSE, 'The file was added to the database.', 'Create test file');
+ $this->assertNotIdentical(drupal_write_record('file_managed', $file), FALSE, t('The file was added to the database.'), 'Create test file');
return $file;
}
@@ -227,19 +227,19 @@ class FileHookTestCase extends FileTestCase {
// Determine if there were any expected that were not called.
$uncalled = array_diff($expected, $actual);
if (count($uncalled)) {
- $this->assertTrue(FALSE, 'Expected hooks ' . implode(', ', $expected) . ' to be called but ' . implode(', ', $uncalled) . ' was not called.');
+ $this->assertTrue(FALSE, t('Expected hooks %expected to be called but %uncalled was not called.', array('%expected' => implode(', ', $expected), '%uncalled' => implode(', ', $uncalled))));
}
else {
- $this->assertTrue(TRUE, 'All the expected hooks were called: ' . implode(', ', $expected));
+ $this->assertTrue(TRUE, t('All the expected hooks were called: %expected', array('%expected' => implode(', ', $expected))));
}
// Determine if there were any unexpected calls.
$unexpected = array_diff($actual, $expected);
if (count($unexpected)) {
- $this->assertTrue(FALSE, 'Unexpected hooks were called: ' . implode(', ', $unexpected) . '.');
+ $this->assertTrue(FALSE, t('Unexpected hooks were called: %unexpected.', array('%unexpected' => implode(', ', $unexpected))));
}
else {
- $this->assertTrue(TRUE, 'No unexpected hooks were called.');
+ $this->assertTrue(TRUE, t('No unexpected hooks were called.'));
}
}
@@ -358,24 +358,24 @@ class FileValidatorTest extends DrupalWebTestCase {
$file = new stdClass();
$file->filename = 'asdf.txt';
$errors = file_validate_extensions($file, 'asdf txt pork');
- $this->assertEqual(count($errors), 0, 'Valid extension accepted.', 'File');
+ $this->assertEqual(count($errors), 0, t('Valid extension accepted.'), 'File');
$file->filename = 'asdf.txt';
$errors = file_validate_extensions($file, 'exe png');
- $this->assertEqual(count($errors), 1, 'Invalid extension blocked.', 'File');
+ $this->assertEqual(count($errors), 1, t('Invalid extension blocked.'), 'File');
}
/**
* This ensures a specific file is actually an image.
*/
function testFileValidateIsImage() {
- $this->assertTrue(file_exists($this->image->uri), 'The image being tested exists.', 'File');
+ $this->assertTrue(file_exists($this->image->uri), t('The image being tested exists.'), 'File');
$errors = file_validate_is_image($this->image);
- $this->assertEqual(count($errors), 0, 'No error reported for our image file.', 'File');
+ $this->assertEqual(count($errors), 0, t('No error reported for our image file.'), 'File');
- $this->assertTrue(file_exists($this->non_image->uri), 'The non-image being tested exists.', 'File');
+ $this->assertTrue(file_exists($this->non_image->uri), t('The non-image being tested exists.'), 'File');
$errors = file_validate_is_image($this->non_image);
- $this->assertEqual(count($errors), 1, 'An error reported for our non-image file.', 'File');
+ $this->assertEqual(count($errors), 1, t('An error reported for our non-image file.'), 'File');
}
/**
@@ -385,19 +385,19 @@ class FileValidatorTest extends DrupalWebTestCase {
function testFileValidateImageResolution() {
// Non-images.
$errors = file_validate_image_resolution($this->non_image);
- $this->assertEqual(count($errors), 0, "Shouldn't get any errors for a non-image file.", 'File');
+ $this->assertEqual(count($errors), 0, t("Shouldn't get any errors for a non-image file."), 'File');
$errors = file_validate_image_resolution($this->non_image, '50x50', '100x100');
- $this->assertEqual(count($errors), 0, "Don't check the resolution on non files.", 'File');
+ $this->assertEqual(count($errors), 0, t("Don't check the resolution on non files."), 'File');
// Minimum size.
$errors = file_validate_image_resolution($this->image);
- $this->assertEqual(count($errors), 0, 'No errors for an image when there is no minimum or maximum resolution.', 'File');
+ $this->assertEqual(count($errors), 0, t('No errors for an image when there is no minimum or maximum resolution.'), 'File');
$errors = file_validate_image_resolution($this->image, 0, '200x1');
- $this->assertEqual(count($errors), 1, "Got an error for an image that wasn't wide enough.", 'File');
+ $this->assertEqual(count($errors), 1, t("Got an error for an image that wasn't wide enough."), 'File');
$errors = file_validate_image_resolution($this->image, 0, '1x200');
- $this->assertEqual(count($errors), 1, "Got an error for an image that wasn't tall enough.", 'File');
+ $this->assertEqual(count($errors), 1, t("Got an error for an image that wasn't tall enough."), 'File');
$errors = file_validate_image_resolution($this->image, 0, '200x200');
- $this->assertEqual(count($errors), 1, 'Small images report an error.', 'File');
+ $this->assertEqual(count($errors), 1, t('Small images report an error.'), 'File');
// Maximum size.
if (image_get_toolkit()) {
@@ -407,18 +407,18 @@ class FileValidatorTest extends DrupalWebTestCase {
$this->image->uri = $temp_dir . '/druplicon.png';
$errors = file_validate_image_resolution($this->image, '10x5');
- $this->assertEqual(count($errors), 0, 'No errors should be reported when an oversized image can be scaled down.', 'File');
+ $this->assertEqual(count($errors), 0, t('No errors should be reported when an oversized image can be scaled down.'), 'File');
$info = image_get_info($this->image->uri);
- $this->assertTrue($info['width'] <= 10, 'Image scaled to correct width.', 'File');
- $this->assertTrue($info['height'] <= 5, 'Image scaled to correct height.', 'File');
+ $this->assertTrue($info['width'] <= 10, t('Image scaled to correct width.'), 'File');
+ $this->assertTrue($info['height'] <= 5, t('Image scaled to correct height.'), 'File');
unlink(drupal_realpath($temp_dir . '/druplicon.png'));
}
else {
// TODO: should check that the error is returned if no toolkit is available.
$errors = file_validate_image_resolution($this->image, '5x10');
- $this->assertEqual(count($errors), 1, "Oversize images that can't be scaled get an error.", 'File');
+ $this->assertEqual(count($errors), 1, t("Oversize images that can't be scaled get an error."), 'File');
}
}
@@ -433,17 +433,17 @@ class FileValidatorTest extends DrupalWebTestCase {
$file->filename = str_repeat('x', 240);
$this->assertEqual(strlen($file->filename), 240);
$errors = file_validate_name_length($file);
- $this->assertEqual(count($errors), 0, 'No errors reported for 240 length filename.', 'File');
+ $this->assertEqual(count($errors), 0, t('No errors reported for 240 length filename.'), 'File');
// Add a filename with a length too long and test it.
$file->filename = str_repeat('x', 241);
$errors = file_validate_name_length($file);
- $this->assertEqual(count($errors), 1, 'An error reported for 241 length filename.', 'File');
+ $this->assertEqual(count($errors), 1, t('An error reported for 241 length filename.'), 'File');
// Add a filename with an empty string and test it.
$file->filename = '';
$errors = file_validate_name_length($file);
- $this->assertEqual(count($errors), 1, 'An error reported for 0 length filename.', 'File');
+ $this->assertEqual(count($errors), 1, t('An error reported for 0 length filename.'), 'File');
}
@@ -461,7 +461,7 @@ class FileValidatorTest extends DrupalWebTestCase {
$file = new stdClass();
$file->filesize = 999999;
$errors = file_validate_size($file, 1, 1);
- $this->assertEqual(count($errors), 0, 'No size limits enforced on uid=1.', 'File');
+ $this->assertEqual(count($errors), 0, t('No size limits enforced on uid=1.'), 'File');
// Run these tests as a regular user.
$user = $this->drupalCreateUser();
@@ -470,13 +470,13 @@ class FileValidatorTest extends DrupalWebTestCase {
$file = new stdClass();
$file->filesize = 1000;
$errors = file_validate_size($file, 0, 0);
- $this->assertEqual(count($errors), 0, 'No limits means no errors.', 'File');
+ $this->assertEqual(count($errors), 0, t('No limits means no errors.'), 'File');
$errors = file_validate_size($file, 1, 0);
- $this->assertEqual(count($errors), 1, 'Error for the file being over the limit.', 'File');
+ $this->assertEqual(count($errors), 1, t('Error for the file being over the limit.'), 'File');
$errors = file_validate_size($file, 0, 1);
- $this->assertEqual(count($errors), 1, 'Error for the user being over their limit.', 'File');
+ $this->assertEqual(count($errors), 1, t('Error for the user being over their limit.'), 'File');
$errors = file_validate_size($file, 1, 1);
- $this->assertEqual(count($errors), 2, 'Errors for both the file and their limit.', 'File');
+ $this->assertEqual(count($errors), 2, t('Errors for both the file and their limit.'), 'File');
$user = $original_user;
drupal_save_session(TRUE);
@@ -505,16 +505,16 @@ class FileUnmanagedSaveDataTest extends FileTestCase {
// No filename.
$filepath = file_unmanaged_save_data($contents);
- $this->assertTrue($filepath, 'Unnamed file saved correctly.');
- $this->assertEqual(file_directory_path('public'), file_directory_path(file_stream_wrapper_valid_scheme($filepath)), "File was placed in Drupal's files directory.");
- $this->assertEqual($contents, file_get_contents(drupal_realpath($filepath)), 'Contents of the file are correct.');
+ $this->assertTrue($filepath, t('Unnamed file saved correctly.'));
+ $this->assertEqual(file_directory_path('public'), file_directory_path(file_stream_wrapper_valid_scheme($filepath)), t("File was placed in Drupal's files directory."));
+ $this->assertEqual($contents, file_get_contents(drupal_realpath($filepath)), t('Contents of the file are correct.'));
// Provide a filename.
$filepath = file_unmanaged_save_data($contents, 'public://asdf.txt', FILE_EXISTS_REPLACE);
- $this->assertTrue($filepath, 'Unnamed file saved correctly.');
- $this->assertEqual(file_directory_path('public'), file_directory_path(file_uri_scheme($filepath)), "File was placed in Drupal's files directory.");
- $this->assertEqual('asdf.txt', basename($filepath), 'File was named correctly.');
- $this->assertEqual($contents, file_get_contents(drupal_realpath($filepath)), 'Contents of the file are correct.');
+ $this->assertTrue($filepath, t('Unnamed file saved correctly.'));
+ $this->assertEqual(file_directory_path('public'), file_directory_path(file_uri_scheme($filepath)), t("File was placed in Drupal's files directory."));
+ $this->assertEqual('asdf.txt', basename($filepath), t('File was named correctly.'));
+ $this->assertEqual($contents, file_get_contents(drupal_realpath($filepath)), t('Contents of the file are correct.'));
$this->assertFilePermissions($filepath, variable_get('file_chmod_file', 0664));
}
}
@@ -553,10 +553,10 @@ class FileSaveUploadTest extends FileHookTestCase {
$this->image = current($this->drupalGetTestFiles('image'));
list(, $this->image_extension) = explode('.', $this->image->filename);
- $this->assertTrue(is_file($this->image->uri), "The image file we're going to upload exists.");
+ $this->assertTrue(is_file($this->image->uri), t("The image file we're going to upload exists."));
$this->phpfile = current($this->drupalGetTestFiles('php'));
- $this->assertTrue(is_file($this->phpfile->uri), "The PHP file we're going to upload exists.");
+ $this->assertTrue(is_file($this->phpfile->uri), t("The PHP file we're going to upload exists."));
$this->maxFidBefore = db_query('SELECT MAX(fid) AS fid FROM {file_managed}')->fetchField();
@@ -566,8 +566,8 @@ class FileSaveUploadTest extends FileHookTestCase {
'files[file_test_upload]' => drupal_realpath($this->image->uri),
);
$this->drupalPost('file-test/upload', $edit, t('Submit'));
- $this->assertResponse(200, 'Received a 200 response for posted test file.');
- $this->assertRaw(t('You WIN!'), 'Found the success message.');
+ $this->assertResponse(200, t('Received a 200 response for posted test file.'));
+ $this->assertRaw(t('You WIN!'), t('Found the success message.'));
// Check that the correct hooks were called then clean out the hook
// counters.
@@ -580,9 +580,9 @@ class FileSaveUploadTest extends FileHookTestCase {
*/
function testNormal() {
$max_fid_after = db_query('SELECT MAX(fid) AS fid FROM {file_managed}')->fetchField();
- $this->assertTrue($max_fid_after > $this->maxFidBefore, 'A new file was created.');
+ $this->assertTrue($max_fid_after > $this->maxFidBefore, t('A new file was created.'));
$file1 = file_load($max_fid_after);
- $this->assertTrue($file1, 'Loaded the file.');
+ $this->assertTrue($file1, t('Loaded the file.'));
// MIME type of the uploaded image may be either image/jpeg or image/png.
$this->assertEqual(substr($file1->filemime, 0, 5), 'image', 'A MIME type was set.');
@@ -594,7 +594,7 @@ class FileSaveUploadTest extends FileHookTestCase {
$image2 = current($this->drupalGetTestFiles('image'));
$edit = array('files[file_test_upload]' => drupal_realpath($image2->uri));
$this->drupalPost('file-test/upload', $edit, t('Submit'));
- $this->assertResponse(200, 'Received a 200 response for posted test file.');
+ $this->assertResponse(200, t('Received a 200 response for posted test file.'));
$this->assertRaw(t('You WIN!'));
$max_fid_after = db_query('SELECT MAX(fid) AS fid FROM {file_managed}')->fetchField();
@@ -608,8 +608,8 @@ class FileSaveUploadTest extends FileHookTestCase {
// Load both files using file_load_multiple().
$files = file_load_multiple(array($file1->fid, $file2->fid));
- $this->assertTrue(isset($files[$file1->fid]), 'File was loaded successfully');
- $this->assertTrue(isset($files[$file2->fid]), 'File was loaded successfully');
+ $this->assertTrue(isset($files[$file1->fid]), t('File was loaded successfully'));
+ $this->assertTrue(isset($files[$file2->fid]), t('File was loaded successfully'));
// Upload a third file to a subdirectory.
$image3 = current($this->drupalGetTestFiles('image'));
@@ -620,12 +620,12 @@ class FileSaveUploadTest extends FileHookTestCase {
'file_subdir' => $dir,
);
$this->drupalPost('file-test/upload', $edit, t('Submit'));
- $this->assertResponse(200, 'Received a 200 response for posted test file.');
+ $this->assertResponse(200, t('Received a 200 response for posted test file.'));
$this->assertRaw(t('You WIN!'));
$this->assertTrue(is_file('temporary://' . $dir . '/' . trim(basename($image3_realpath))));
// Check that file_load_multiple() with no arguments returns FALSE.
- $this->assertFalse(file_load_multiple(), 'No files were loaded.');
+ $this->assertFalse(file_load_multiple(), t('No files were loaded.'));
}
/**
@@ -644,10 +644,10 @@ class FileSaveUploadTest extends FileHookTestCase {
);
$this->drupalPost('file-test/upload', $edit, t('Submit'));
- $this->assertResponse(200, 'Received a 200 response for posted test file.');
+ $this->assertResponse(200, t('Received a 200 response for posted test file.'));
$message = t('Only files with the following extensions are allowed: ') . '<em class="placeholder">' . $extensions . '</em>';
- $this->assertRaw($message, 'Can\'t upload a disallowed extension');
- $this->assertRaw(t('Epic upload FAIL!'), 'Found the failure message.');
+ $this->assertRaw($message, t('Can\'t upload a disallowed extension'));
+ $this->assertRaw(t('Epic upload FAIL!'), t('Found the failure message.'));
// Check that the correct hooks were called.
$this->assertFileHooksCalled(array('validate'));
@@ -664,9 +664,9 @@ class FileSaveUploadTest extends FileHookTestCase {
);
$this->drupalPost('file-test/upload', $edit, t('Submit'));
- $this->assertResponse(200, 'Received a 200 response for posted test file.');
- $this->assertNoRaw(t('Only files with the following extensions are allowed:'), 'Can upload an allowed extension.');
- $this->assertRaw(t('You WIN!'), 'Found the success message.');
+ $this->assertResponse(200, t('Received a 200 response for posted test file.'));
+ $this->assertNoRaw(t('Only files with the following extensions are allowed:'), t('Can upload an allowed extension.'));
+ $this->assertRaw(t('You WIN!'), t('Found the success message.'));
// Check that the correct hooks were called.
$this->assertFileHooksCalled(array('validate', 'load', 'update'));
@@ -681,9 +681,9 @@ class FileSaveUploadTest extends FileHookTestCase {
'allow_all_extensions' => TRUE,
);
$this->drupalPost('file-test/upload', $edit, t('Submit'));
- $this->assertResponse(200, 'Received a 200 response for posted test file.');
- $this->assertNoRaw(t('Only files with the following extensions are allowed:'), 'Can upload any extension.');
- $this->assertRaw(t('You WIN!'), 'Found the success message.');
+ $this->assertResponse(200, t('Received a 200 response for posted test file.'));
+ $this->assertNoRaw(t('Only files with the following extensions are allowed:'), t('Can upload any extension.'));
+ $this->assertRaw(t('You WIN!'), t('Found the success message.'));
// Check that the correct hooks were called.
$this->assertFileHooksCalled(array('validate', 'load', 'update'));
@@ -703,11 +703,11 @@ class FileSaveUploadTest extends FileHookTestCase {
);
$this->drupalPost('file-test/upload', $edit, t('Submit'));
- $this->assertResponse(200, 'Received a 200 response for posted test file.');
+ $this->assertResponse(200, t('Received a 200 response for posted test file.'));
$message = t('For security reasons, your upload has been renamed to ') . '<em class="placeholder">' . $this->phpfile->filename . '.txt' . '</em>';
- $this->assertRaw($message, 'Dangerous file was renamed.');
- $this->assertRaw(t('File MIME type is text/plain.'), 'Dangerous file\'s MIME type was changed.');
- $this->assertRaw(t('You WIN!'), 'Found the success message.');
+ $this->assertRaw($message, t('Dangerous file was renamed.'));
+ $this->assertRaw(t('File MIME type is text/plain.'), t('Dangerous file\'s MIME type was changed.'));
+ $this->assertRaw(t('You WIN!'), t('Found the success message.'));
// Check that the correct hooks were called.
$this->assertFileHooksCalled(array('validate', 'insert'));
@@ -719,10 +719,10 @@ class FileSaveUploadTest extends FileHookTestCase {
file_test_reset();
$this->drupalPost('file-test/upload', $edit, t('Submit'));
- $this->assertResponse(200, 'Received a 200 response for posted test file.');
- $this->assertNoRaw(t('For security reasons, your upload has been renamed'), 'Found no security message.');
- $this->assertRaw(t('File name is !filename', array('!filename' => $this->phpfile->filename)), 'Dangerous file was not renamed when insecure uploads is TRUE.');
- $this->assertRaw(t('You WIN!'), 'Found the success message.');
+ $this->assertResponse(200, t('Received a 200 response for posted test file.'));
+ $this->assertNoRaw(t('For security reasons, your upload has been renamed'), t('Found no security message.'));
+ $this->assertRaw(t('File name is !filename', array('!filename' => $this->phpfile->filename)), t('Dangerous file was not renamed when insecure uploads is TRUE.'));
+ $this->assertRaw(t('You WIN!'), t('Found the success message.'));
// Check that the correct hooks were called.
$this->assertFileHooksCalled(array('validate', 'insert'));
@@ -753,10 +753,10 @@ class FileSaveUploadTest extends FileHookTestCase {
$munged_filename .= '_.' . $this->image_extension;
$this->drupalPost('file-test/upload', $edit, t('Submit'));
- $this->assertResponse(200, 'Received a 200 response for posted test file.');
- $this->assertRaw(t('For security reasons, your upload has been renamed'), 'Found security message.');
- $this->assertRaw(t('File name is !filename', array('!filename' => $munged_filename)), 'File was successfully munged.');
- $this->assertRaw(t('You WIN!'), 'Found the success message.');
+ $this->assertResponse(200, t('Received a 200 response for posted test file.'));
+ $this->assertRaw(t('For security reasons, your upload has been renamed'), t('Found security message.'));
+ $this->assertRaw(t('File name is !filename', array('!filename' => $munged_filename)), t('File was successfully munged.'));
+ $this->assertRaw(t('You WIN!'), t('Found the success message.'));
// Check that the correct hooks were called.
$this->assertFileHooksCalled(array('validate', 'insert'));
@@ -771,10 +771,10 @@ class FileSaveUploadTest extends FileHookTestCase {
);
$this->drupalPost('file-test/upload', $edit, t('Submit'));
- $this->assertResponse(200, 'Received a 200 response for posted test file.');
- $this->assertNoRaw(t('For security reasons, your upload has been renamed'), 'Found no security message.');
- $this->assertRaw(t('File name is !filename', array('!filename' => $this->image->filename)), 'File was not munged when allowing any extension.');
- $this->assertRaw(t('You WIN!'), 'Found the success message.');
+ $this->assertResponse(200, t('Received a 200 response for posted test file.'));
+ $this->assertNoRaw(t('For security reasons, your upload has been renamed'), t('Found no security message.'));
+ $this->assertRaw(t('File name is !filename', array('!filename' => $this->image->filename)), t('File was not munged when allowing any extension.'));
+ $this->assertRaw(t('You WIN!'), t('Found the success message.'));
// Check that the correct hooks were called.
$this->assertFileHooksCalled(array('validate', 'insert'));
@@ -789,8 +789,8 @@ class FileSaveUploadTest extends FileHookTestCase {
'files[file_test_upload]' => drupal_realpath($this->image->uri)
);
$this->drupalPost('file-test/upload', $edit, t('Submit'));
- $this->assertResponse(200, 'Received a 200 response for posted test file.');
- $this->assertRaw(t('You WIN!'), 'Found the success message.');
+ $this->assertResponse(200, t('Received a 200 response for posted test file.'));
+ $this->assertRaw(t('You WIN!'), t('Found the success message.'));
// Check that the correct hooks were called.
$this->assertFileHooksCalled(array('validate', 'insert'));
@@ -805,8 +805,8 @@ class FileSaveUploadTest extends FileHookTestCase {
'files[file_test_upload]' => drupal_realpath($this->image->uri)
);
$this->drupalPost('file-test/upload', $edit, t('Submit'));
- $this->assertResponse(200, 'Received a 200 response for posted test file.');
- $this->assertRaw(t('You WIN!'), 'Found the success message.');
+ $this->assertResponse(200, t('Received a 200 response for posted test file.'));
+ $this->assertRaw(t('You WIN!'), t('Found the success message.'));
// Check that the correct hooks were called.
$this->assertFileHooksCalled(array('validate', 'load', 'update'));
@@ -821,8 +821,8 @@ class FileSaveUploadTest extends FileHookTestCase {
'files[file_test_upload]' => drupal_realpath($this->image->uri)
);
$this->drupalPost('file-test/upload', $edit, t('Submit'));
- $this->assertResponse(200, 'Received a 200 response for posted test file.');
- $this->assertRaw(t('Epic upload FAIL!'), 'Found the failure message.');
+ $this->assertResponse(200, t('Received a 200 response for posted test file.'));
+ $this->assertRaw(t('Epic upload FAIL!'), t('Found the failure message.'));
// Check that the no hooks were called while failing.
$this->assertFileHooksCalled(array());
@@ -833,7 +833,7 @@ class FileSaveUploadTest extends FileHookTestCase {
*/
function testNoUpload() {
$this->drupalPost('file-test/upload', array(), t('Submit'));
- $this->assertNoRaw(t('Epic upload FAIL!'), 'Failure message not found.');
+ $this->assertNoRaw(t('Epic upload FAIL!'), t('Failure message not found.'));
}
}
@@ -855,23 +855,23 @@ class FileDirectoryTest extends FileTestCase {
function testFileCheckDirectory() {
// A directory to operate on.
$directory = file_directory_path() . '/' . $this->randomName() . '/' . $this->randomName();
- $this->assertFalse(is_dir($directory), 'Directory does not exist prior to testing.');
+ $this->assertFalse(is_dir($directory), t('Directory does not exist prior to testing.'));
// Non-existent directory.
- $this->assertFalse(file_prepare_directory($directory, 0), 'Error reported for non-existing directory.', 'File');
+ $this->assertFalse(file_prepare_directory($directory, 0), t('Error reported for non-existing directory.'), 'File');
// Make a directory.
- $this->assertTrue(file_prepare_directory($directory, FILE_CREATE_DIRECTORY), 'No error reported when creating a new directory.', 'File');
+ $this->assertTrue(file_prepare_directory($directory, FILE_CREATE_DIRECTORY), t('No error reported when creating a new directory.'), 'File');
// Make sure directory actually exists.
- $this->assertTrue(is_dir($directory), 'Directory actually exists.', 'File');
+ $this->assertTrue(is_dir($directory), t('Directory actually exists.'), 'File');
// Make directory read only.
@chmod($directory, 0444);
- $this->assertFalse(file_prepare_directory($directory, 0), 'Error reported for a non-writeable directory.', 'File');
+ $this->assertFalse(file_prepare_directory($directory, 0), t('Error reported for a non-writeable directory.'), 'File');
// Test directory permission modification.
- $this->assertTrue(file_prepare_directory($directory, FILE_MODIFY_PERMISSIONS), 'No error reported when making directory writeable.', 'File');
+ $this->assertTrue(file_prepare_directory($directory, FILE_MODIFY_PERMISSIONS), t('No error reported when making directory writeable.'), 'File');
// Test directory permission modification actually set correct permissions.
$this->assertDirectoryPermissions($directory, variable_get('file_chmod_directory', 0775));
@@ -879,12 +879,12 @@ class FileDirectoryTest extends FileTestCase {
// Remove .htaccess file to then test that it gets re-created.
$directory = file_directory_path();
@unlink($directory . '/.htaccess');
- $this->assertFalse(is_file($directory . '/.htaccess'), 'Successfully removed the .htaccess file in the files directory.', 'File');
+ $this->assertFalse(is_file($directory . '/.htaccess'), t('Successfully removed the .htaccess file in the files directory.'), 'File');
file_ensure_htaccess();
- $this->assertTrue(is_file($directory . '/.htaccess'), 'Successfully re-created the .htaccess file in the files directory.', 'File');
+ $this->assertTrue(is_file($directory . '/.htaccess'), t('Successfully re-created the .htaccess file in the files directory.'), 'File');
// Verify contents of .htaccess file.
$file = file_get_contents(file_directory_path() . '/.htaccess');
- $this->assertEqual($file, "SetHandler Drupal_Security_Do_Not_Remove_See_SA_2006_006\nOptions None\nOptions +FollowSymLinks", 'The .htaccess file contains the proper content.', 'File');
+ $this->assertEqual($file, "SetHandler Drupal_Security_Do_Not_Remove_See_SA_2006_006\nOptions None\nOptions +FollowSymLinks", t('The .htaccess file contains the proper content.'), 'File');
}
/**
@@ -893,7 +893,7 @@ class FileDirectoryTest extends FileTestCase {
function testFileDirectoryPath() {
// Directory path.
$path = variable_get('file_public_path', '');
- $this->assertEqual($path, file_directory_path('public'), 'Properly returns the stored file directory path.', 'File');
+ $this->assertEqual($path, file_directory_path('public'), t('Properly returns the stored file directory path.'), 'File');
}
/**
@@ -903,7 +903,7 @@ class FileDirectoryTest extends FileTestCase {
// Temporary directory handling.
variable_set('file_directory_temp', NULL);
$temp = file_directory_temp();
- $this->assertTrue(!is_null($temp), 'Properly set and retrieved temp directory ' . $temp . '.', 'File');
+ $this->assertTrue(!is_null($temp), t('Properly set and retrieved temp directory %directory.', array('%directory' => $temp)), 'File');
}
/**
@@ -917,14 +917,14 @@ class FileDirectoryTest extends FileTestCase {
$directory = 'misc';
$original = $directory . '/' . $basename;
$path = file_create_filename($basename, $directory);
- $this->assertEqual($path, $original, 'New filepath ' . $path . ' equals ' . $original . '.', 'File');
+ $this->assertEqual($path, $original, t('New filepath %new equals %original.', array('%new' => $path, '%original' => $original)), 'File');
// Then we test against a file that already exists within that directory.
$basename = 'druplicon.png';
$original = $directory . '/' . $basename;
$expected = $directory . '/druplicon_0.png';
$path = file_create_filename($basename, $directory);
- $this->assertEqual($path, $expected, 'Creating a new filepath from ' . $original . ' equals ' . $path . '.', 'File');
+ $this->assertEqual($path, $expected, t('Creating a new filepath from %original equals %new.', array('%new' => $path, '%original' => $original)), 'File');
// @TODO: Finally we copy a file into a directory several times, to ensure a properly iterating filename suffix.
}
@@ -945,19 +945,19 @@ class FileDirectoryTest extends FileTestCase {
// First test for non-existent file.
$destination = 'misc/xyz.txt';
$path = file_destination($destination, FILE_EXISTS_REPLACE);
- $this->assertEqual($path, $destination, 'Non-existing filepath destination is correct with FILE_EXISTS_REPLACE.', 'File');
+ $this->assertEqual($path, $destination, t('Non-existing filepath destination is correct with FILE_EXISTS_REPLACE.'), 'File');
$path = file_destination($destination, FILE_EXISTS_RENAME);
- $this->assertEqual($path, $destination, 'Non-existing filepath destination is correct with FILE_EXISTS_RENAME.', 'File');
+ $this->assertEqual($path, $destination, t('Non-existing filepath destination is correct with FILE_EXISTS_RENAME.'), 'File');
$path = file_destination($destination, FILE_EXISTS_ERROR);
- $this->assertEqual($path, $destination, 'Non-existing filepath destination is correct with FILE_EXISTS_ERROR.', 'File');
+ $this->assertEqual($path, $destination, t('Non-existing filepath destination is correct with FILE_EXISTS_ERROR.'), 'File');
$destination = 'misc/druplicon.png';
$path = file_destination($destination, FILE_EXISTS_REPLACE);
- $this->assertEqual($path, $destination, 'Existing filepath destination remains the same with FILE_EXISTS_REPLACE.', 'File');
+ $this->assertEqual($path, $destination, t('Existing filepath destination remains the same with FILE_EXISTS_REPLACE.'), 'File');
$path = file_destination($destination, FILE_EXISTS_RENAME);
- $this->assertNotEqual($path, $destination, 'A new filepath destination is created when filepath destination already exists with FILE_EXISTS_RENAME.', 'File');
+ $this->assertNotEqual($path, $destination, t('A new filepath destination is created when filepath destination already exists with FILE_EXISTS_RENAME.'), 'File');
$path = file_destination($destination, FILE_EXISTS_ERROR);
- $this->assertEqual($path, FALSE, 'An error is returned when filepath destination already exists with FILE_EXISTS_ERROR.', 'File');
+ $this->assertEqual($path, FALSE, t('An error is returned when filepath destination already exists with FILE_EXISTS_ERROR.'), 'File');
}
}
@@ -987,21 +987,21 @@ class FileScanDirectoryTest extends FileTestCase {
// passed to the callback.
$all_files = file_scan_directory($this->path, '/^javascript-/');
ksort($all_files);
- $this->assertEqual(2, count($all_files), 'Found two, expected javascript files.');
+ $this->assertEqual(2, count($all_files), t('Found two, expected javascript files.'));
// Check the first file.
$file = reset($all_files);
- $this->assertEqual(key($all_files), $file->uri, 'Correct array key was used for the first returned file.');
- $this->assertEqual($file->uri, $this->path . '/javascript-1.txt', 'First file name was set correctly.');
- $this->assertEqual($file->filename, 'javascript-1.txt', 'First basename was set correctly');
- $this->assertEqual($file->name, 'javascript-1', 'First name was set correctly.');
+ $this->assertEqual(key($all_files), $file->uri, t('Correct array key was used for the first returned file.'));
+ $this->assertEqual($file->uri, $this->path . '/javascript-1.txt', t('First file name was set correctly.'));
+ $this->assertEqual($file->filename, 'javascript-1.txt', t('First basename was set correctly'));
+ $this->assertEqual($file->name, 'javascript-1', t('First name was set correctly.'));
// Check the second file.
$file = next($all_files);
- $this->assertEqual(key($all_files), $file->uri, 'Correct array key was used for the second returned file.');
- $this->assertEqual($file->uri, $this->path . '/javascript-2.script', 'Second file name was set correctly.');
- $this->assertEqual($file->filename, 'javascript-2.script', 'Second basename was set correctly');
- $this->assertEqual($file->name, 'javascript-2', 'Second name was set correctly.');
+ $this->assertEqual(key($all_files), $file->uri, t('Correct array key was used for the second returned file.'));
+ $this->assertEqual($file->uri, $this->path . '/javascript-2.script', t('Second file name was set correctly.'));
+ $this->assertEqual($file->filename, 'javascript-2.script', t('Second basename was set correctly'));
+ $this->assertEqual($file->name, 'javascript-2', t('Second name was set correctly.'));
}
/**
@@ -1010,18 +1010,18 @@ class FileScanDirectoryTest extends FileTestCase {
function testOptionCallback() {
// When nothing is matched nothing should be passed to the callback.
$all_files = file_scan_directory($this->path, '/^NONEXISTINGFILENAME/', array('callback' => 'file_test_file_scan_callback'));
- $this->assertEqual(0, count($all_files), 'No files were found.');
+ $this->assertEqual(0, count($all_files), t('No files were found.'));
$results = file_test_file_scan_callback();
file_test_file_scan_callback_reset();
- $this->assertEqual(0, count($results), 'No files were passed to the callback.');
+ $this->assertEqual(0, count($results), t('No files were passed to the callback.'));
// Grab a listing of all the JavaSscript files and check that they're
// passed to the callback.
$all_files = file_scan_directory($this->path, '/^javascript-/', array('callback' => 'file_test_file_scan_callback'));
- $this->assertEqual(2, count($all_files), 'Found two, expected javascript files.');
+ $this->assertEqual(2, count($all_files), t('Found two, expected javascript files.'));
$results = file_test_file_scan_callback();
file_test_file_scan_callback_reset();
- $this->assertEqual(2, count($results), 'Files were passed to the callback.');
+ $this->assertEqual(2, count($results), t('Files were passed to the callback.'));
}
/**
@@ -1030,11 +1030,11 @@ class FileScanDirectoryTest extends FileTestCase {
function testOptionNoMask() {
// Grab a listing of all the JavaSscript files.
$all_files = file_scan_directory($this->path, '/^javascript-/');
- $this->assertEqual(2, count($all_files), 'Found two, expected javascript files.');
+ $this->assertEqual(2, count($all_files), t('Found two, expected javascript files.'));
// Now use the nomast parameter to filter out the .script file.
$filtered_files = file_scan_directory($this->path, '/^javascript-/', array('nomask' => '/.script$/'));
- $this->assertEqual(1, count($filtered_files), 'Filtered correctly.');
+ $this->assertEqual(1, count($filtered_files), t('Filtered correctly.'));
}
/**
@@ -1045,25 +1045,25 @@ class FileScanDirectoryTest extends FileTestCase {
$expected = array($this->path . '/javascript-1.txt', $this->path . '/javascript-2.script');
$actual = array_keys(file_scan_directory($this->path, '/^javascript-/', array('key' => 'filepath')));
sort($actual);
- $this->assertEqual($expected, $actual, 'Returned the correct values for the filename key.');
+ $this->assertEqual($expected, $actual, t('Returned the correct values for the filename key.'));
// "basename", for the basename of the file.
$expected = array('javascript-1.txt', 'javascript-2.script');
$actual = array_keys(file_scan_directory($this->path, '/^javascript-/', array('key' => 'filename')));
sort($actual);
- $this->assertEqual($expected, $actual, 'Returned the correct values for the basename key.');
+ $this->assertEqual($expected, $actual, t('Returned the correct values for the basename key.'));
// "name" for the name of the file without an extension.
$expected = array('javascript-1', 'javascript-2');
$actual = array_keys(file_scan_directory($this->path, '/^javascript-/', array('key' => 'name')));
sort($actual);
- $this->assertEqual($expected, $actual, 'Returned the correct values for the name key.');
+ $this->assertEqual($expected, $actual, t('Returned the correct values for the name key.'));
// Invalid option that should default back to "filename".
$expected = array($this->path . '/javascript-1.txt', $this->path . '/javascript-2.script');
$actual = array_keys(file_scan_directory($this->path, '/^javascript-/', array('key' => 'INVALID')));
sort($actual);
- $this->assertEqual($expected, $actual, 'An invalid key defaulted back to the default.');
+ $this->assertEqual($expected, $actual, t('An invalid key defaulted back to the default.'));
}
/**
@@ -1071,10 +1071,10 @@ class FileScanDirectoryTest extends FileTestCase {
*/
function testOptionRecurse() {
$files = file_scan_directory(drupal_get_path('module', 'simpletest'), '/^javascript-/', array('recurse' => FALSE));
- $this->assertTrue(empty($files), "Without recursion couldn't find javascript files.");
+ $this->assertTrue(empty($files), t("Without recursion couldn't find javascript files."));
$files = file_scan_directory(drupal_get_path('module', 'simpletest'), '/^javascript-/', array('recurse' => TRUE));
- $this->assertEqual(2, count($files), 'With recursion we found the expected javascript files.');
+ $this->assertEqual(2, count($files), t('With recursion we found the expected javascript files.'));
}
@@ -1084,10 +1084,10 @@ class FileScanDirectoryTest extends FileTestCase {
*/
function testOptionMinDepth() {
$files = file_scan_directory($this->path, '/^javascript-/', array('min_depth' => 0));
- $this->assertEqual(2, count($files), 'No minimum-depth gets files in current directory.');
+ $this->assertEqual(2, count($files), t('No minimum-depth gets files in current directory.'));
$files = file_scan_directory($this->path, '/^javascript-/', array('min_depth' => 1));
- $this->assertTrue(empty($files), "Minimum-depth of 1 successfully excludes files from current directory.");
+ $this->assertTrue(empty($files), t("Minimum-depth of 1 successfully excludes files from current directory."));
}
}
@@ -1112,8 +1112,8 @@ class FileUnmanagedDeleteTest extends FileTestCase {
$file = $this->createFile();
// Delete a regular file
- $this->assertTrue(file_unmanaged_delete($file->uri), 'Deleted worked.');
- $this->assertFalse(file_exists($file->uri), 'Test file has actually been deleted.');
+ $this->assertTrue(file_unmanaged_delete($file->uri), t('Deleted worked.'));
+ $this->assertFalse(file_exists($file->uri), t('Test file has actually been deleted.'));
}
/**
@@ -1121,7 +1121,7 @@ class FileUnmanagedDeleteTest extends FileTestCase {
*/
function testMissing() {
// Try to delete a non-existing file
- $this->assertTrue(file_unmanaged_delete(file_directory_path() . '/' . $this->randomName()), 'Returns true when deleting a non-existent file.');
+ $this->assertTrue(file_unmanaged_delete(file_directory_path() . '/' . $this->randomName()), t('Returns true when deleting a non-existent file.'));
}
/**
@@ -1132,8 +1132,8 @@ class FileUnmanagedDeleteTest extends FileTestCase {
$directory = $this->createDirectory();
// Try to delete a directory
- $this->assertFalse(file_unmanaged_delete($directory), 'Could not delete the delete directory.');
- $this->assertTrue(file_exists($directory), 'Directory has not been deleted.');
+ $this->assertFalse(file_unmanaged_delete($directory), t('Could not delete the delete directory.'));
+ $this->assertTrue(file_exists($directory), t('Directory has not been deleted.'));
}
}
@@ -1159,8 +1159,8 @@ class FileUnmanagedDeleteRecursiveTest extends FileTestCase {
file_put_contents($filepath, '');
// Delete the file.
- $this->assertTrue(file_unmanaged_delete_recursive($filepath), 'Function reported success.');
- $this->assertFalse(file_exists($filepath), 'Test file has been deleted.');
+ $this->assertTrue(file_unmanaged_delete_recursive($filepath), t('Function reported success.'));
+ $this->assertFalse(file_exists($filepath), t('Test file has been deleted.'));
}
/**
@@ -1171,8 +1171,8 @@ class FileUnmanagedDeleteRecursiveTest extends FileTestCase {
$directory = $this->createDirectory();
// Delete the directory.
- $this->assertTrue(file_unmanaged_delete_recursive($directory), 'Function reported success.');
- $this->assertFalse(file_exists($directory), 'Directory has been deleted.');
+ $this->assertTrue(file_unmanaged_delete_recursive($directory), t('Function reported success.'));
+ $this->assertFalse(file_exists($directory), t('Directory has been deleted.'));
}
/**
@@ -1187,10 +1187,10 @@ class FileUnmanagedDeleteRecursiveTest extends FileTestCase {
file_put_contents($filepathB, '');
// Delete the directory.
- $this->assertTrue(file_unmanaged_delete_recursive($directory), 'Function reported success.');
- $this->assertFalse(file_exists($filepathA), 'Test file A has been deleted.');
- $this->assertFalse(file_exists($filepathB), 'Test file B has been deleted.');
- $this->assertFalse(file_exists($directory), 'Directory has been deleted.');
+ $this->assertTrue(file_unmanaged_delete_recursive($directory), t('Function reported success.'));
+ $this->assertFalse(file_exists($filepathA), t('Test file A has been deleted.'));
+ $this->assertFalse(file_exists($filepathB), t('Test file B has been deleted.'));
+ $this->assertFalse(file_exists($directory), t('Directory has been deleted.'));
}
/**
@@ -1206,11 +1206,11 @@ class FileUnmanagedDeleteRecursiveTest extends FileTestCase {
file_put_contents($filepathB, '');
// Delete the directory.
- $this->assertTrue(file_unmanaged_delete_recursive($directory), 'Function reported success.');
- $this->assertFalse(file_exists($filepathA), 'Test file A has been deleted.');
- $this->assertFalse(file_exists($filepathB), 'Test file B has been deleted.');
- $this->assertFalse(file_exists($subdirectory), 'Subdirectory has been deleted.');
- $this->assertFalse(file_exists($directory), 'Directory has been deleted.');
+ $this->assertTrue(file_unmanaged_delete_recursive($directory), t('Function reported success.'));
+ $this->assertFalse(file_exists($filepathA), t('Test file A has been deleted.'));
+ $this->assertFalse(file_exists($filepathB), t('Test file B has been deleted.'));
+ $this->assertFalse(file_exists($subdirectory), t('Subdirectory has been deleted.'));
+ $this->assertFalse(file_exists($directory), t('Directory has been deleted.'));
}
}
@@ -1237,21 +1237,21 @@ class FileUnmanagedMoveTest extends FileTestCase {
// Moving to a new name.
$desired_filepath = 'public://' . $this->randomName();
$new_filepath = file_unmanaged_move($file->uri, $desired_filepath, FILE_EXISTS_ERROR);
- $this->assertTrue($new_filepath, 'Move was successful.');
- $this->assertEqual($new_filepath, $desired_filepath, 'Returned expected filepath.');
- $this->assertTrue(file_exists($new_filepath), 'File exists at the new location.');
- $this->assertFalse(file_exists($file->uri), 'No file remains at the old location.');
+ $this->assertTrue($new_filepath, t('Move was successful.'));
+ $this->assertEqual($new_filepath, $desired_filepath, t('Returned expected filepath.'));
+ $this->assertTrue(file_exists($new_filepath), t('File exists at the new location.'));
+ $this->assertFalse(file_exists($file->uri), t('No file remains at the old location.'));
$this->assertFilePermissions($new_filepath, variable_get('file_chmod_file', 0664));
// Moving with rename.
$desired_filepath = 'public://' . $this->randomName();
- $this->assertTrue(file_exists($new_filepath), 'File exists before moving.');
- $this->assertTrue(file_put_contents($desired_filepath, ' '), 'Created a file so a rename will have to happen.');
+ $this->assertTrue(file_exists($new_filepath), t('File exists before moving.'));
+ $this->assertTrue(file_put_contents($desired_filepath, ' '), t('Created a file so a rename will have to happen.'));
$newer_filepath = file_unmanaged_move($new_filepath, $desired_filepath, FILE_EXISTS_RENAME);
- $this->assertTrue($newer_filepath, 'Move was successful.');
- $this->assertNotEqual($newer_filepath, $desired_filepath, 'Returned expected filepath.');
- $this->assertTrue(file_exists($newer_filepath), 'File exists at the new location.');
- $this->assertFalse(file_exists($new_filepath), 'No file remains at the old location.');
+ $this->assertTrue($newer_filepath, t('Move was successful.'));
+ $this->assertNotEqual($newer_filepath, $desired_filepath, t('Returned expected filepath.'));
+ $this->assertTrue(file_exists($newer_filepath), t('File exists at the new location.'));
+ $this->assertFalse(file_exists($new_filepath), t('No file remains at the old location.'));
$this->assertFilePermissions($newer_filepath, variable_get('file_chmod_file', 0664));
// TODO: test moving to a directory (rather than full directory/file path)
@@ -1264,7 +1264,7 @@ class FileUnmanagedMoveTest extends FileTestCase {
function testMissing() {
// Move non-existent file.
$new_filepath = file_unmanaged_move($this->randomName(), $this->randomName());
- $this->assertFalse($new_filepath, 'Moving a missing file fails.');
+ $this->assertFalse($new_filepath, t('Moving a missing file fails.'));
}
/**
@@ -1276,14 +1276,14 @@ class FileUnmanagedMoveTest extends FileTestCase {
// Move the file onto itself without renaming shouldn't make changes.
$new_filepath = file_unmanaged_move($file->uri, $file->uri, FILE_EXISTS_REPLACE);
- $this->assertFalse($new_filepath, 'Moving onto itself without renaming fails.');
- $this->assertTrue(file_exists($file->uri), 'File exists after moving onto itself.');
+ $this->assertFalse($new_filepath, t('Moving onto itself without renaming fails.'));
+ $this->assertTrue(file_exists($file->uri), t('File exists after moving onto itself.'));
// Move the file onto itself with renaming will result in a new filename.
$new_filepath = file_unmanaged_move($file->uri, $file->uri, FILE_EXISTS_RENAME);
- $this->assertTrue($new_filepath, 'Moving onto itself with renaming works.');
- $this->assertFalse(file_exists($file->uri), 'Original file has been removed.');
- $this->assertTrue(file_exists($new_filepath), 'File exists after moving onto itself.');
+ $this->assertTrue($new_filepath, t('Moving onto itself with renaming works.'));
+ $this->assertFalse(file_exists($file->uri), t('Original file has been removed.'));
+ $this->assertTrue(file_exists($new_filepath), t('File exists after moving onto itself.'));
}
}
@@ -1310,20 +1310,20 @@ class FileUnmanagedCopyTest extends FileTestCase {
// Copying to a new name.
$desired_filepath = 'public://' . $this->randomName();
$new_filepath = file_unmanaged_copy($file->uri, $desired_filepath, FILE_EXISTS_ERROR);
- $this->assertTrue($new_filepath, 'Copy was successful.');
- $this->assertEqual($new_filepath, $desired_filepath, 'Returned expected filepath.');
- $this->assertTrue(file_exists($file->uri), 'Original file remains.');
- $this->assertTrue(file_exists($new_filepath), 'New file exists.');
+ $this->assertTrue($new_filepath, t('Copy was successful.'));
+ $this->assertEqual($new_filepath, $desired_filepath, t('Returned expected filepath.'));
+ $this->assertTrue(file_exists($file->uri), t('Original file remains.'));
+ $this->assertTrue(file_exists($new_filepath), t('New file exists.'));
$this->assertFilePermissions($new_filepath, variable_get('file_chmod_file', 0664));
// Copying with rename.
$desired_filepath = 'public://' . $this->randomName();
- $this->assertTrue(file_put_contents($desired_filepath, ' '), 'Created a file so a rename will have to happen.');
+ $this->assertTrue(file_put_contents($desired_filepath, ' '), t('Created a file so a rename will have to happen.'));
$newer_filepath = file_unmanaged_copy($file->uri, $desired_filepath, FILE_EXISTS_RENAME);
- $this->assertTrue($newer_filepath, 'Copy was successful.');
- $this->assertNotEqual($newer_filepath, $desired_filepath, 'Returned expected filepath.');
- $this->assertTrue(file_exists($file->uri), 'Original file remains.');
- $this->assertTrue(file_exists($newer_filepath), 'New file exists.');
+ $this->assertTrue($newer_filepath, t('Copy was successful.'));
+ $this->assertNotEqual($newer_filepath, $desired_filepath, t('Returned expected filepath.'));
+ $this->assertTrue(file_exists($file->uri), t('Original file remains.'));
+ $this->assertTrue(file_exists($newer_filepath), t('New file exists.'));
$this->assertFilePermissions($newer_filepath, variable_get('file_chmod_file', 0664));
// TODO: test copying to a directory (rather than full directory/file path)
@@ -1336,9 +1336,9 @@ class FileUnmanagedCopyTest extends FileTestCase {
function testNonExistent() {
// Copy non-existent file
$desired_filepath = $this->randomName();
- $this->assertFalse(file_exists($desired_filepath), "Randomly named file doesn't exists.");
+ $this->assertFalse(file_exists($desired_filepath), t("Randomly named file doesn't exists."));
$new_filepath = file_unmanaged_copy($desired_filepath, $this->randomName());
- $this->assertFalse($new_filepath, 'Copying a missing file fails.');
+ $this->assertFalse($new_filepath, t('Copying a missing file fails.'));
}
/**
@@ -1350,28 +1350,28 @@ class FileUnmanagedCopyTest extends FileTestCase {
// Copy the file onto itself with renaming works.
$new_filepath = file_unmanaged_copy($file->uri, $file->uri, FILE_EXISTS_RENAME);
- $this->assertTrue($new_filepath, 'Copying onto itself with renaming works.');
- $this->assertNotEqual($new_filepath, $file->uri, 'Copied file has a new name.');
- $this->assertTrue(file_exists($file->uri), 'Original file exists after copying onto itself.');
- $this->assertTrue(file_exists($new_filepath), 'Copied file exists after copying onto itself.');
+ $this->assertTrue($new_filepath, t('Copying onto itself with renaming works.'));
+ $this->assertNotEqual($new_filepath, $file->uri, t('Copied file has a new name.'));
+ $this->assertTrue(file_exists($file->uri), t('Original file exists after copying onto itself.'));
+ $this->assertTrue(file_exists($new_filepath), t('Copied file exists after copying onto itself.'));
$this->assertFilePermissions($new_filepath, variable_get('file_chmod_file', 0664));
// Copy the file onto itself without renaming fails.
$new_filepath = file_unmanaged_copy($file->uri, $file->uri, FILE_EXISTS_ERROR);
- $this->assertFalse($new_filepath, 'Copying onto itself without renaming fails.');
- $this->assertTrue(file_exists($file->uri), 'File exists after copying onto itself.');
+ $this->assertFalse($new_filepath, t('Copying onto itself without renaming fails.'));
+ $this->assertTrue(file_exists($file->uri), t('File exists after copying onto itself.'));
// Copy the file into same directory without renaming fails.
$new_filepath = file_unmanaged_copy($file->uri, drupal_dirname($file->uri), FILE_EXISTS_ERROR);
- $this->assertFalse($new_filepath, 'Copying onto itself fails.');
- $this->assertTrue(file_exists($file->uri), 'File exists after copying onto itself.');
+ $this->assertFalse($new_filepath, t('Copying onto itself fails.'));
+ $this->assertTrue(file_exists($file->uri), t('File exists after copying onto itself.'));
// Copy the file into same directory with renaming works.
$new_filepath = file_unmanaged_copy($file->uri, drupal_dirname($file->uri), FILE_EXISTS_RENAME);
- $this->assertTrue($new_filepath, 'Copying into same directory works.');
- $this->assertNotEqual($new_filepath, $file->uri, 'Copied file has a new name.');
- $this->assertTrue(file_exists($file->uri), 'Original file exists after copying onto itself.');
- $this->assertTrue(file_exists($new_filepath), 'Copied file exists after copying onto itself.');
+ $this->assertTrue($new_filepath, t('Copying into same directory works.'));
+ $this->assertNotEqual($new_filepath, $file->uri, t('Copied file has a new name.'));
+ $this->assertTrue(file_exists($file->uri), t('Original file exists after copying onto itself.'));
+ $this->assertTrue(file_exists($new_filepath), t('Copied file exists after copying onto itself.'));
$this->assertFilePermissions($new_filepath, variable_get('file_chmod_file', 0664));
}
}
@@ -1395,11 +1395,11 @@ class FileDeleteTest extends FileHookTestCase {
$file = $this->createFile();
// Check that deletion removes the file and database record.
- $this->assertTrue(is_file($file->uri), "File exists.");
- $this->assertIdentical(file_delete($file), TRUE, "Delete worked.");
+ $this->assertTrue(is_file($file->uri), t("File exists."));
+ $this->assertIdentical(file_delete($file), TRUE, t("Delete worked."));
$this->assertFileHooksCalled(array('references', 'delete'));
- $this->assertFalse(file_exists($file->uri), "Test file has actually been deleted.");
- $this->assertFalse(file_load($file->fid), 'File was removed from the database.');
+ $this->assertFalse(file_exists($file->uri), t("Test file has actually been deleted."));
+ $this->assertFalse(file_load($file->fid), t('File was removed from the database.'));
// TODO: implement hook_file_references() in file_test.module and report a
// file in use and test the $force parameter.
@@ -1432,20 +1432,20 @@ class FileMoveTest extends FileHookTestCase {
$result = file_move(clone $source, $desired_filepath, FILE_EXISTS_ERROR);
// Check the return status and that the contents changed.
- $this->assertTrue($result, 'File moved sucessfully.');
+ $this->assertTrue($result, t('File moved sucessfully.'));
$this->assertFalse(file_exists($source->uri));
- $this->assertEqual($contents, file_get_contents($result->uri), 'Contents of file correctly written.');
+ $this->assertEqual($contents, file_get_contents($result->uri), t('Contents of file correctly written.'));
// Check that the correct hooks were called.
$this->assertFileHooksCalled(array('move', 'update'));
// Make sure we got the same file back.
- $this->assertEqual($source->fid, $result->fid, "Source file id's' " . $source->fid . " is unchanged after move.");
+ $this->assertEqual($source->fid, $result->fid, t("Source file id's' %fid is unchanged after move.", array('%fid' => $source->fid)));
// Reload the file from the database and check that the changes were
// actually saved.
$loaded_file = file_load($result->fid, TRUE);
- $this->assertTrue($loaded_file, 'File can be loaded from the database.');
+ $this->assertTrue($loaded_file, t('File can be loaded from the database.'));
$this->assertFileUnchanged($result, $loaded_file);
}
@@ -1464,9 +1464,9 @@ class FileMoveTest extends FileHookTestCase {
$result = file_move(clone $source, $target->uri, FILE_EXISTS_RENAME);
// Check the return status and that the contents changed.
- $this->assertTrue($result, 'File moved sucessfully.');
+ $this->assertTrue($result, t('File moved sucessfully.'));
$this->assertFalse(file_exists($source->uri));
- $this->assertEqual($contents, file_get_contents($result->uri), 'Contents of file correctly written.');
+ $this->assertEqual($contents, file_get_contents($result->uri), t('Contents of file correctly written.'));
// Check that the correct hooks were called.
$this->assertFileHooksCalled(array('move', 'update'));
@@ -1480,8 +1480,8 @@ class FileMoveTest extends FileHookTestCase {
// Compare the source and results.
$loaded_source = file_load($source->fid, TRUE);
- $this->assertEqual($loaded_source->fid, $result->fid, "Returned file's id matches the source.");
- $this->assertNotEqual($loaded_source->uri, $source->uri, "Returned file path has changed from the original.");
+ $this->assertEqual($loaded_source->fid, $result->fid, t("Returned file's id matches the source."));
+ $this->assertNotEqual($loaded_source->uri, $source->uri, t("Returned file path has changed from the original."));
}
/**
@@ -1499,9 +1499,9 @@ class FileMoveTest extends FileHookTestCase {
$result = file_move(clone $source, $target->uri, FILE_EXISTS_REPLACE);
// Look at the results.
- $this->assertEqual($contents, file_get_contents($result->uri), 'Contents of file were overwritten.');
+ $this->assertEqual($contents, file_get_contents($result->uri), t('Contents of file were overwritten.'));
$this->assertFalse(file_exists($source->uri));
- $this->assertTrue($result, 'File moved sucessfully.');
+ $this->assertTrue($result, t('File moved sucessfully.'));
// Check that the correct hooks were called.
$this->assertFileHooksCalled(array('move', 'update', 'delete', 'references', 'load'));
@@ -1527,8 +1527,8 @@ class FileMoveTest extends FileHookTestCase {
// Copy the file over itself. Clone the object so we don't have to worry
// about the function changing our reference copy.
$result = file_move(clone $source, $source->uri, FILE_EXISTS_REPLACE);
- $this->assertFalse($result, 'File move failed.');
- $this->assertEqual($contents, file_get_contents($source->uri), 'Contents of file were not altered.');
+ $this->assertFalse($result, t('File move failed.'));
+ $this->assertEqual($contents, file_get_contents($source->uri), t('Contents of file were not altered.'));
// Check that no hooks were called while failing.
$this->assertFileHooksCalled(array());
@@ -1553,9 +1553,9 @@ class FileMoveTest extends FileHookTestCase {
$result = file_move(clone $source, $target->uri, FILE_EXISTS_ERROR);
// Check the return status and that the contents did not change.
- $this->assertFalse($result, 'File move failed.');
+ $this->assertFalse($result, t('File move failed.'));
$this->assertTrue(file_exists($source->uri));
- $this->assertEqual($contents, file_get_contents($target->uri), 'Contents of file were not altered.');
+ $this->assertEqual($contents, file_get_contents($target->uri), t('Contents of file were not altered.'));
// Check that no hooks were called while failing.
$this->assertFileHooksCalled(array());
@@ -1593,16 +1593,16 @@ class FileCopyTest extends FileHookTestCase {
$result = file_copy(clone $source, $desired_uri, FILE_EXISTS_ERROR);
// Check the return status and that the contents changed.
- $this->assertTrue($result, 'File copied sucessfully.');
- $this->assertEqual($contents, file_get_contents($result->uri), 'Contents of file were copied correctly.');
+ $this->assertTrue($result, t('File copied sucessfully.'));
+ $this->assertEqual($contents, file_get_contents($result->uri), t('Contents of file were copied correctly.'));
// Check that the correct hooks were called.
$this->assertFileHooksCalled(array('copy', 'insert'));
$this->assertDifferentFile($source, $result);
- $this->assertEqual($result->uri, $desired_uri, 'The copied file object has the desired filepath.');
- $this->assertTrue(file_exists($source->uri), 'The original file still exists.');
- $this->assertTrue(file_exists($result->uri), 'The copied file exists.');
+ $this->assertEqual($result->uri, $desired_uri, t('The copied file object has the desired filepath.'));
+ $this->assertTrue(file_exists($source->uri), t('The original file still exists.'));
+ $this->assertTrue(file_exists($result->uri), t('The copied file exists.'));
// Reload the file from the database and check that the changes were
// actually saved.
@@ -1624,9 +1624,9 @@ class FileCopyTest extends FileHookTestCase {
$result = file_copy(clone $source, $target->uri, FILE_EXISTS_RENAME);
// Check the return status and that the contents changed.
- $this->assertTrue($result, 'File copied sucessfully.');
- $this->assertEqual($contents, file_get_contents($result->uri), 'Contents of file were copied correctly.');
- $this->assertNotEqual($result->uri, $source->uri, 'Returned file path has changed from the original.');
+ $this->assertTrue($result, t('File copied sucessfully.'));
+ $this->assertEqual($contents, file_get_contents($result->uri), t('Contents of file were copied correctly.'));
+ $this->assertNotEqual($result->uri, $source->uri, t('Returned file path has changed from the original.'));
// Check that the correct hooks were called.
$this->assertFileHooksCalled(array('copy', 'insert'));
@@ -1664,8 +1664,8 @@ class FileCopyTest extends FileHookTestCase {
$result = file_copy(clone $source, $target->uri, FILE_EXISTS_REPLACE);
// Check the return status and that the contents changed.
- $this->assertTrue($result, 'File copied sucessfully.');
- $this->assertEqual($contents, file_get_contents($result->uri), 'Contents of file were overwritten.');
+ $this->assertTrue($result, t('File copied sucessfully.'));
+ $this->assertEqual($contents, file_get_contents($result->uri), t('Contents of file were overwritten.'));
$this->assertDifferentFile($source, $result);
// Check that the correct hooks were called.
@@ -1702,8 +1702,8 @@ class FileCopyTest extends FileHookTestCase {
$result = file_copy(clone $source, $target->uri, FILE_EXISTS_ERROR);
// Check the return status and that the contents were not changed.
- $this->assertFalse($result, 'File copy failed.');
- $this->assertEqual($contents, file_get_contents($target->uri), 'Contents of file were not altered.');
+ $this->assertFalse($result, t('File copy failed.'));
+ $this->assertEqual($contents, file_get_contents($target->uri), t('Contents of file were not altered.'));
// Check that the correct hooks were called.
$this->assertFileHooksCalled(array());
@@ -1730,7 +1730,7 @@ class FileLoadTest extends FileHookTestCase {
* Try to load a non-existent file by fid.
*/
function testLoadMissingFid() {
- $this->assertFalse(file_load(-1), "Try to load an invalid fid fails.");
+ $this->assertFalse(file_load(-1), t("Try to load an invalid fid fails."));
$this->assertFileHooksCalled(array());
}
@@ -1739,7 +1739,7 @@ class FileLoadTest extends FileHookTestCase {
*/
function testLoadMissingFilepath() {
$files = file_load_multiple(array(), array('uri' => 'foobar://misc/druplicon.png'));
- $this->assertFalse(reset($files), "Try to load a file that doesn't exist in the database fails.");
+ $this->assertFalse(reset($files), t("Try to load a file that doesn't exist in the database fails."));
$this->assertFileHooksCalled(array());
}
@@ -1748,7 +1748,7 @@ class FileLoadTest extends FileHookTestCase {
*/
function testLoadInvalidStatus() {
$files = file_load_multiple(array(), array('status' => -99));
- $this->assertFalse(reset($files), "Trying to load a file with an invalid status fails.");
+ $this->assertFalse(reset($files), t("Trying to load a file with an invalid status fails."));
$this->assertFileHooksCalled(array());
}
@@ -1761,13 +1761,13 @@ class FileLoadTest extends FileHookTestCase {
$by_fid_file = file_load($file->fid);
$this->assertFileHookCalled('load');
- $this->assertTrue(is_object($by_fid_file), 'file_load() returned an object.');
- $this->assertEqual($by_fid_file->fid, $file->fid, "Loading by fid got the same fid.", 'File');
- $this->assertEqual($by_fid_file->uri, $file->uri, "Loading by fid got the correct filepath.", 'File');
- $this->assertEqual($by_fid_file->filename, $file->filename, "Loading by fid got the correct filename.", 'File');
- $this->assertEqual($by_fid_file->filemime, $file->filemime, "Loading by fid got the correct MIME type.", 'File');
- $this->assertEqual($by_fid_file->status, $file->status, "Loading by fid got the correct status.", 'File');
- $this->assertTrue($by_fid_file->file_test['loaded'], 'file_test_file_load() was able to modify the file during load.');
+ $this->assertTrue(is_object($by_fid_file), t('file_load() returned an object.'));
+ $this->assertEqual($by_fid_file->fid, $file->fid, t("Loading by fid got the same fid."), 'File');
+ $this->assertEqual($by_fid_file->uri, $file->uri, t("Loading by fid got the correct filepath."), 'File');
+ $this->assertEqual($by_fid_file->filename, $file->filename, t("Loading by fid got the correct filename."), 'File');
+ $this->assertEqual($by_fid_file->filemime, $file->filemime, t("Loading by fid got the correct MIME type."), 'File');
+ $this->assertEqual($by_fid_file->status, $file->status, t("Loading by fid got the correct status."), 'File');
+ $this->assertTrue($by_fid_file->file_test['loaded'], t('file_test_file_load() was able to modify the file during load.'));
}
/**
@@ -1781,19 +1781,19 @@ class FileLoadTest extends FileHookTestCase {
file_test_reset();
$by_path_files = file_load_multiple(array(), array('uri' => $file->uri));
$this->assertFileHookCalled('load');
- $this->assertEqual(1, count($by_path_files), 'file_load_multiple() returned an array of the correct size.');
+ $this->assertEqual(1, count($by_path_files), t('file_load_multiple() returned an array of the correct size.'));
$by_path_file = reset($by_path_files);
- $this->assertTrue($by_path_file->file_test['loaded'], 'file_test_file_load() was able to modify the file during load.');
- $this->assertEqual($by_path_file->fid, $file->fid, "Loading by filepath got the correct fid.", 'File');
+ $this->assertTrue($by_path_file->file_test['loaded'], t('file_test_file_load() was able to modify the file during load.'));
+ $this->assertEqual($by_path_file->fid, $file->fid, t("Loading by filepath got the correct fid."), 'File');
// Load by fid.
file_test_reset();
$by_fid_files = file_load_multiple(array($file->fid), array());
$this->assertFileHookCalled('load');
- $this->assertEqual(1, count($by_fid_files), 'file_load_multiple() returned an array of the correct size.');
+ $this->assertEqual(1, count($by_fid_files), t('file_load_multiple() returned an array of the correct size.'));
$by_fid_file = reset($by_fid_files);
- $this->assertTrue($by_fid_file->file_test['loaded'], 'file_test_file_load() was able to modify the file during load.');
- $this->assertEqual($by_fid_file->uri, $file->uri, "Loading by fid got the correct filepath.", 'File');
+ $this->assertTrue($by_fid_file->file_test['loaded'], t('file_test_file_load() was able to modify the file during load.'));
+ $this->assertEqual($by_fid_file->uri, $file->uri, t("Loading by fid got the correct filepath."), 'File');
}
}
@@ -1828,13 +1828,13 @@ class FileSaveTest extends FileHookTestCase {
// Check that the correct hooks were called.
$this->assertFileHooksCalled(array('insert'));
- $this->assertNotNull($saved_file, "Saving the file should give us back a file object.", 'File');
- $this->assertTrue($saved_file->fid > 0, "A new file ID is set when saving a new file to the database.", 'File');
+ $this->assertNotNull($saved_file, t("Saving the file should give us back a file object."), 'File');
+ $this->assertTrue($saved_file->fid > 0, t("A new file ID is set when saving a new file to the database."), 'File');
$loaded_file = db_query('SELECT * FROM {file_managed} f WHERE f.fid = :fid', array(':fid' => $saved_file->fid))->fetch(PDO::FETCH_OBJ);
- $this->assertNotNull($loaded_file, "Record exists in the database.");
- $this->assertEqual($loaded_file->status, $file->status, "Status was saved correctly.");
- $this->assertEqual($saved_file->filesize, filesize($file->uri), "File size was set correctly.", 'File');
- $this->assertTrue($saved_file->timestamp > 1, "File size was set correctly.", 'File');
+ $this->assertNotNull($loaded_file, t("Record exists in the database."));
+ $this->assertEqual($loaded_file->status, $file->status, t("Status was saved correctly."));
+ $this->assertEqual($saved_file->filesize, filesize($file->uri), t("File size was set correctly."), 'File');
+ $this->assertTrue($saved_file->timestamp > 1, t("File size was set correctly."), 'File');
// Resave the file, updating the existing record.
@@ -1845,11 +1845,11 @@ class FileSaveTest extends FileHookTestCase {
// Check that the correct hooks were called.
$this->assertFileHooksCalled(array('update'));
- $this->assertEqual($resaved_file->fid, $saved_file->fid, "The file ID of an existing file is not changed when updating the database.", 'File');
- $this->assertTrue($resaved_file->timestamp >= $saved_file->timestamp, "Timestamp didn't go backwards.", 'File');
+ $this->assertEqual($resaved_file->fid, $saved_file->fid, t("The file ID of an existing file is not changed when updating the database."), 'File');
+ $this->assertTrue($resaved_file->timestamp >= $saved_file->timestamp, t("Timestamp didn't go backwards."), 'File');
$loaded_file = db_query('SELECT * FROM {file_managed} f WHERE f.fid = :fid', array(':fid' => $saved_file->fid))->fetch(PDO::FETCH_OBJ);
- $this->assertNotNull($loaded_file, "Record still exists in the database.", 'File');
- $this->assertEqual($loaded_file->status, $saved_file->status, "Status was saved correctly.");
+ $this->assertNotNull($loaded_file, t("Record still exists in the database."), 'File');
+ $this->assertEqual($loaded_file->status, $saved_file->status, t("Status was saved correctly."));
}
}
@@ -1873,7 +1873,7 @@ class FileValidateTest extends FileHookTestCase {
$file = $this->createFile();
// Empty validators.
- $this->assertEqual(file_validate($file, array()), array(), 'Validating an empty array works succesfully.');
+ $this->assertEqual(file_validate($file, array()), array(), t('Validating an empty array works succesfully.'));
$this->assertFileHooksCalled(array('validate'));
// Use the file_test.module's test validator to ensure that passing tests
@@ -1881,14 +1881,14 @@ class FileValidateTest extends FileHookTestCase {
file_test_reset();
file_test_set_return('validate', array());
$passing = array('file_test_validator' => array(array()));
- $this->assertEqual(file_validate($file, $passing), array(), 'Validating passes.');
+ $this->assertEqual(file_validate($file, $passing), array(), t('Validating passes.'));
$this->assertFileHooksCalled(array('validate'));
// Now test for failures in validators passed in and by hook_validate.
file_test_reset();
file_test_set_return('validate', array('Epic fail'));
$failing = array('file_test_validator' => array(array('Failed', 'Badly')));
- $this->assertEqual(file_validate($file, $failing), array('Failed', 'Badly', 'Epic fail'), 'Validating returns errors.');
+ $this->assertEqual(file_validate($file, $failing), array('Failed', 'Badly', 'Epic fail'), t('Validating returns errors.'));
$this->assertFileHooksCalled(array('validate'));
}
}
@@ -1912,13 +1912,13 @@ class FileSaveDataTest extends FileHookTestCase {
$contents = $this->randomName(8);
$result = file_save_data($contents);
- $this->assertTrue($result, 'Unnamed file saved correctly.');
+ $this->assertTrue($result, t('Unnamed file saved correctly.'));
- $this->assertEqual(file_directory_path('public'), file_directory_path(file_stream_wrapper_valid_scheme($result->uri)), "File was placed in Drupal's files directory.");
- $this->assertEqual($result->filename, basename($result->uri), "Filename was set to the file's basename.");
- $this->assertEqual($contents, file_get_contents($result->uri), 'Contents of the file are correct.');
- $this->assertEqual($result->filemime, 'application/octet-stream', 'A MIME type was set.');
- $this->assertEqual($result->status, FILE_STATUS_PERMANENT, "The file's status was set to permanent.");
+ $this->assertEqual(file_directory_path('public'), file_directory_path(file_stream_wrapper_valid_scheme($result->uri)), t("File was placed in Drupal's files directory."));
+ $this->assertEqual($result->filename, basename($result->uri), t("Filename was set to the file's basename."));
+ $this->assertEqual($contents, file_get_contents($result->uri), t('Contents of the file are correct.'));
+ $this->assertEqual($result->filemime, 'application/octet-stream', t('A MIME type was set.'));
+ $this->assertEqual($result->status, FILE_STATUS_PERMANENT, t("The file's status was set to permanent."));
// Check that the correct hooks were called.
$this->assertFileHooksCalled(array('insert'));
@@ -1934,13 +1934,13 @@ class FileSaveDataTest extends FileHookTestCase {
$contents = $this->randomName(8);
$result = file_save_data($contents, 'public://' . 'asdf.txt');
- $this->assertTrue($result, 'Unnamed file saved correctly.');
+ $this->assertTrue($result, t('Unnamed file saved correctly.'));
- $this->assertEqual(file_directory_path('public'), file_directory_path(file_stream_wrapper_valid_scheme($result->uri)), "File was placed in Drupal's files directory.");
- $this->assertEqual('asdf.txt', basename($result->uri), 'File was named correctly.');
- $this->assertEqual($contents, file_get_contents($result->uri), 'Contents of the file are correct.');
- $this->assertEqual($result->filemime, 'text/plain', 'A MIME type was set.');
- $this->assertEqual($result->status, FILE_STATUS_PERMANENT, "The file's status was set to permanent.");
+ $this->assertEqual(file_directory_path('public'), file_directory_path(file_stream_wrapper_valid_scheme($result->uri)), t("File was placed in Drupal's files directory."));
+ $this->assertEqual('asdf.txt', basename($result->uri), t('File was named correctly.'));
+ $this->assertEqual($contents, file_get_contents($result->uri), t('Contents of the file are correct.'));
+ $this->assertEqual($result->filemime, 'text/plain', t('A MIME type was set.'));
+ $this->assertEqual($result->status, FILE_STATUS_PERMANENT, t("The file's status was set to permanent."));
// Check that the correct hooks were called.
$this->assertFileHooksCalled(array('insert'));
@@ -1958,13 +1958,13 @@ class FileSaveDataTest extends FileHookTestCase {
$contents = $this->randomName(8);
$result = file_save_data($contents, $existing->uri, FILE_EXISTS_RENAME);
- $this->assertTrue($result, "File saved sucessfully.");
+ $this->assertTrue($result, t("File saved sucessfully."));
- $this->assertEqual(file_directory_path('public'), file_directory_path(file_stream_wrapper_valid_scheme($result->uri)), "File was placed in Drupal's files directory.");
- $this->assertEqual($result->filename, $existing->filename, "Filename was set to the basename of the source, rather than that of the renamed file.");
- $this->assertEqual($contents, file_get_contents($result->uri), "Contents of the file are correct.");
- $this->assertEqual($result->filemime, 'application/octet-stream', "A MIME type was set.");
- $this->assertEqual($result->status, FILE_STATUS_PERMANENT, "The file's status was set to permanent.");
+ $this->assertEqual(file_directory_path('public'), file_directory_path(file_stream_wrapper_valid_scheme($result->uri)), t("File was placed in Drupal's files directory."));
+ $this->assertEqual($result->filename, $existing->filename, t("Filename was set to the basename of the source, rather than that of the renamed file."));
+ $this->assertEqual($contents, file_get_contents($result->uri), t("Contents of the file are correct."));
+ $this->assertEqual($result->filemime, 'application/octet-stream', t("A MIME type was set."));
+ $this->assertEqual($result->status, FILE_STATUS_PERMANENT, t("The file's status was set to permanent."));
// Check that the correct hooks were called.
$this->assertFileHooksCalled(array('insert'));
@@ -1986,13 +1986,13 @@ class FileSaveDataTest extends FileHookTestCase {
$contents = $this->randomName(8);
$result = file_save_data($contents, $existing->uri, FILE_EXISTS_REPLACE);
- $this->assertTrue($result, 'File saved sucessfully.');
+ $this->assertTrue($result, t('File saved sucessfully.'));
- $this->assertEqual(file_directory_path('public'), file_directory_path(file_stream_wrapper_valid_scheme($result->uri)), "File was placed in Drupal's files directory.");
- $this->assertEqual($result->filename, $existing->filename, 'Filename was set to the basename of the existing file, rather than preserving the original name.');
- $this->assertEqual($contents, file_get_contents($result->uri), 'Contents of the file are correct.');
- $this->assertEqual($result->filemime, 'application/octet-stream', 'A MIME type was set.');
- $this->assertEqual($result->status, FILE_STATUS_PERMANENT, "The file's status was set to permanent.");
+ $this->assertEqual(file_directory_path('public'), file_directory_path(file_stream_wrapper_valid_scheme($result->uri)), t("File was placed in Drupal's files directory."));
+ $this->assertEqual($result->filename, $existing->filename, t('Filename was set to the basename of the existing file, rather than preserving the original name.'));
+ $this->assertEqual($contents, file_get_contents($result->uri), t('Contents of the file are correct.'));
+ $this->assertEqual($result->filemime, 'application/octet-stream', t('A MIME type was set.'));
+ $this->assertEqual($result->status, FILE_STATUS_PERMANENT, t("The file's status was set to permanent."));
// Check that the correct hooks were called.
$this->assertFileHooksCalled(array('load', 'update'));
@@ -2013,8 +2013,8 @@ class FileSaveDataTest extends FileHookTestCase {
// Check the overwrite error.
$result = file_save_data('asdf', $existing->uri, FILE_EXISTS_ERROR);
- $this->assertFalse($result, 'Overwriting a file fails when FILE_EXISTS_ERROR is specified.');
- $this->assertEqual($contents, file_get_contents($existing->uri), 'Contents of existing file were unchanged.');
+ $this->assertFalse($result, t('Overwriting a file fails when FILE_EXISTS_ERROR is specified.'));
+ $this->assertEqual($contents, file_get_contents($existing->uri), t('Contents of existing file were unchanged.'));
// Check that no hooks were called while failing.
$this->assertFileHooksCalled(array());
@@ -2049,17 +2049,17 @@ class FileDownloadTest extends FileTestCase {
// Test generating an URL to a created file.
$file = $this->createFile();
$url = file_create_url($file->uri);
- $this->assertEqual($GLOBALS['base_url'] . '/' . file_directory_path() . '/' . $file->filename, $url, 'Correctly generated a URL for a created file.');
+ $this->assertEqual($GLOBALS['base_url'] . '/' . file_directory_path() . '/' . $file->filename, $url, t('Correctly generated a URL for a created file.'));
$this->drupalHead($url);
- $this->assertResponse(200, 'Confirmed that the generated URL is correct by downloading the created file.');
+ $this->assertResponse(200, t('Confirmed that the generated URL is correct by downloading the created file.'));
// Test generating an URL to a shipped file (i.e. a file that is part of
// Drupal core, a module or a theme, for example a JavaScript file).
$filepath = 'misc/jquery.js';
$url = file_create_url($filepath);
- $this->assertEqual($GLOBALS['base_url'] . '/' . $filepath, $url, 'Correctly generated a URL for a shipped file.');
+ $this->assertEqual($GLOBALS['base_url'] . '/' . $filepath, $url, t('Correctly generated a URL for a shipped file.'));
$this->drupalHead($url);
- $this->assertResponse(200, 'Confirmed that the generated URL is correct by downloading the shipped file.');
+ $this->assertResponse(200, t('Confirmed that the generated URL is correct by downloading the shipped file.'));
}
/**
@@ -2076,18 +2076,18 @@ class FileDownloadTest extends FileTestCase {
file_test_set_return('download', array('x-foo' => 'Bar'));
$this->drupalHead($url);
$headers = $this->drupalGetHeaders();
- $this->assertEqual($headers['x-foo'], 'Bar', 'Found header set by file_test module on private download.');
- $this->assertResponse(200, 'Correctly allowed access to a file when file_test provides headers.');
+ $this->assertEqual($headers['x-foo'] , 'Bar', t('Found header set by file_test module on private download.'));
+ $this->assertResponse(200, t('Correctly allowed access to a file when file_test provides headers.'));
// Deny access to all downloads via a -1 header.
file_test_set_return('download', -1);
$this->drupalHead($url);
- $this->assertResponse(403, 'Correctly denied access to a file when file_test sets the header to -1.');
+ $this->assertResponse(403, t('Correctly denied access to a file when file_test sets the header to -1.'));
// Try non-existent file.
$url = file_create_url('private://' . $this->randomName());
$this->drupalHead($url);
- $this->assertResponse(404, 'Correctly returned 404 response for a non-existent file.');
+ $this->assertResponse(404, t('Correctly returned 404 response for a non-existent file.'));
}
/**
@@ -2141,7 +2141,7 @@ class FileDownloadTest extends FileTestCase {
$file = $this->createFile($filepath, NULL, $scheme);
$url = file_create_url($file->uri);
- $this->assertEqual($url, $expected_url, 'Generated URL matches expected URL.');
+ $this->assertEqual($url, $expected_url, t('Generated URL matches expected URL.'));
if ($scheme == 'private') {
// Tell the implementation of hook_file_download() in file_test.module
@@ -2151,7 +2151,7 @@ class FileDownloadTest extends FileTestCase {
$this->drupalGet($url);
if ($this->assertResponse(200) == 'pass') {
- $this->assertRaw(file_get_contents($file->uri), 'Contents of the file are correct.');
+ $this->assertRaw(file_get_contents($file->uri), t('Contents of the file are correct.'));
}
file_delete($file);
@@ -2177,7 +2177,7 @@ class FileURLRewritingTest extends FileTestCase {
/**
* Test the generating of rewritten shipped file URLs.
*/
- function testShippedFileURL() {
+ function testShippedFileURL() {
// Test generating an URL to a shipped file (i.e. a file that is part of
// Drupal core, a module or a theme, for example a JavaScript file).
@@ -2185,28 +2185,28 @@ class FileURLRewritingTest extends FileTestCase {
variable_set('file_test_hook_file_url_alter', 'cdn');
$filepath = 'misc/jquery.js';
$url = file_create_url($filepath);
- $this->assertEqual(FILE_URL_TEST_CDN_1 . '/' . $filepath, $url, 'Correctly generated a CDN URL for a shipped file.');
+ $this->assertEqual(FILE_URL_TEST_CDN_1 . '/' . $filepath, $url, t('Correctly generated a CDN URL for a shipped file.'));
$filepath = 'misc/favicon.ico';
$url = file_create_url($filepath);
- $this->assertEqual(FILE_URL_TEST_CDN_2 . '/' . $filepath, $url, 'Correctly generated a CDN URL for a shipped file.');
+ $this->assertEqual(FILE_URL_TEST_CDN_2 . '/' . $filepath, $url, t('Correctly generated a CDN URL for a shipped file.'));
// Test alteration of file URLs to use root-relative URLs.
variable_set('file_test_hook_file_url_alter', 'root-relative');
$filepath = 'misc/jquery.js';
$url = file_create_url($filepath);
- $this->assertEqual(base_path() . '/' . $filepath, $url, 'Correctly generated a root-relative URL for a shipped file.');
+ $this->assertEqual(base_path() . '/' . $filepath, $url, t('Correctly generated a root-relative URL for a shipped file.'));
$filepath = 'misc/favicon.ico';
$url = file_create_url($filepath);
- $this->assertEqual(base_path() . '/' . $filepath, $url, 'Correctly generated a root-relative URL for a shipped file.');
+ $this->assertEqual(base_path() . '/' . $filepath, $url, t('Correctly generated a root-relative URL for a shipped file.'));
// Test alteration of file URLs to use protocol-relative URLs.
variable_set('file_test_hook_file_url_alter', 'protocol-relative');
$filepath = 'misc/jquery.js';
$url = file_create_url($filepath);
- $this->assertEqual('/' . base_path() . '/' . $filepath, $url, 'Correctly generated a protocol-relative URL for a shipped file.');
+ $this->assertEqual('/' . base_path() . '/' . $filepath, $url, t('Correctly generated a protocol-relative URL for a shipped file.'));
$filepath = 'misc/favicon.ico';
$url = file_create_url($filepath);
- $this->assertEqual('/' . base_path() . '/' . $filepath, $url, 'Correctly generated a protocol-relative URL for a shipped file.');
+ $this->assertEqual('/' . base_path() . '/' . $filepath, $url, t('Correctly generated a protocol-relative URL for a shipped file.'));
}
/**
@@ -2219,19 +2219,19 @@ class FileURLRewritingTest extends FileTestCase {
variable_set('file_test_hook_file_url_alter', 'cdn');
$file = $this->createFile();
$url = file_create_url($file->uri);
- $this->assertEqual(FILE_URL_TEST_CDN_2 . '/' . file_directory_path() . '/' . $file->filename, $url, 'Correctly generated a CDN URL for a created file.');
+ $this->assertEqual(FILE_URL_TEST_CDN_2 . '/' . file_directory_path() . '/' . $file->filename, $url, t('Correctly generated a CDN URL for a created file.'));
// Test alteration of file URLs to use root-relative URLs.
variable_set('file_test_hook_file_url_alter', 'root-relative');
$file = $this->createFile();
$url = file_create_url($file->uri);
- $this->assertEqual(base_path() . '/' . file_directory_path() . '/' . $file->filename, $url, 'Correctly generated a root-relative URL for a created file.');
+ $this->assertEqual(base_path() . '/' . file_directory_path() . '/' . $file->filename, $url, t('Correctly generated a root-relative URL for a created file.'));
// Test alteration of file URLs to use a protocol-relative URLs.
variable_set('file_test_hook_file_url_alter', 'protocol-relative');
$file = $this->createFile();
$url = file_create_url($file->uri);
- $this->assertEqual('/' . base_path() . '/' . file_directory_path() . '/' . $file->filename, $url, 'Correctly generated a protocol-relative URL for a created file.');
+ $this->assertEqual('/' . base_path() . '/' . file_directory_path() . '/' . $file->filename, $url, t('Correctly generated a protocol-relative URL for a created file.'));
}
}
@@ -2261,8 +2261,8 @@ class FileNameMungingTest extends FileTestCase {
variable_set('allow_insecure_uploads', 0);
$munged_name = file_munge_filename($this->name, '', TRUE);
$messages = drupal_get_messages();
- $this->assertTrue(in_array(t('For security reasons, your upload has been renamed to %filename.', array('%filename' => $munged_name)), $messages['status']), 'Alert properly set when a file is renamed.');
- $this->assertNotEqual($munged_name, $this->name, 'The new filename (' . $munged_name . ') has been modified from the original (' . $this->name . ')');
+ $this->assertTrue(in_array(t('For security reasons, your upload has been renamed to %filename.', array('%filename' => $munged_name)), $messages['status']), t('Alert properly set when a file is renamed.'));
+ $this->assertNotEqual($munged_name, $this->name, t('The new filename (%munged) has been modified from the original (%original)', array('%munged' => $munged_name, '%original' => $this->name)));
}
/**
@@ -2272,7 +2272,7 @@ class FileNameMungingTest extends FileTestCase {
function testMungeIgnoreInsecure() {
variable_set('allow_insecure_uploads', 1);
$munged_name = file_munge_filename($this->name, '');
- $this->assertIdentical($munged_name, $this->name, 'The original filename (' . $this->name . ') matches the munged filename (' . $munged_name . ') when insecure uploads are enabled.');
+ $this->assertIdentical($munged_name, $this->name, t('The original filename (%original) matches the munged filename (%munged) when insecure uploads are enabled.', array('%munged' => $munged_name, '%original' => $this->name)));
}
/**
@@ -2281,7 +2281,7 @@ class FileNameMungingTest extends FileTestCase {
function testMungeIgnoreWhitelisted() {
// Declare our extension as whitelisted.
$munged_name = file_munge_filename($this->name, $this->bad_extension);
- $this->assertIdentical($munged_name, $this->name, 'The new filename (' . $munged_name . ') matches the original (' . $this->name . ') once the extension has been whitelisted.');
+ $this->assertIdentical($munged_name, $this->name, t('The new filename (%munged) matches the original (%original) once the extension has been whitelisted.', array('%munged' => $munged_name, '%original' => $this->name)));
}
/**
@@ -2338,11 +2338,11 @@ class FileMimeTypeTest extends DrupalWebTestCase {
foreach ($test_case as $input => $expected) {
// Test stream [URI].
$output = file_get_mimetype($prefix . $input);
- $this->assertIdentical($output, $expected, 'Mimetype for ' . $input . ' is ' . $output . ' (expected: ' . $expected . ').');
+ $this->assertIdentical($output, $expected, t('Mimetype for %input is %output (expected: %expected).', array('%input' => $input, '%output' => $output, '%expected' => $expected)));
// Test normal path equivalent
$output = file_get_mimetype($input);
- $this->assertIdentical($output, $expected, 'Mimetype (using default mappings) for ' . $input . ' is ' . $output . ' (expected: ' . $expected . ').');
+ $this->assertIdentical($output, $expected, t('Mimetype (using default mappings) for %input is %output (expected: %expected).', array('%input' => $input, '%output' => $output, '%expected' => $expected)));
}
// Now test passing in the map.
@@ -2374,7 +2374,7 @@ class FileMimeTypeTest extends DrupalWebTestCase {
foreach ($test_case as $input => $expected) {
$output = file_get_mimetype($input, $mapping);
- $this->assertIdentical($output, $expected, 'Mimetype (using passed-in mappings) for ' . $input . ' is ' . $output . ' (expected: ' . $expected . ').');
+ $this->assertIdentical($output, $expected, t('Mimetype (using passed-in mappings) for %input is %output (expected: %expected).', array('%input' => $input, '%output' => $output, '%expected' => $expected)));
}
}
}
@@ -2410,9 +2410,9 @@ class StreamWrapperTest extends DrupalWebTestCase {
*/
function testGetClassName() {
// Check the dummy scheme.
- $this->assertEqual($this->classname, file_stream_wrapper_get_class($this->scheme), 'Got correct class name for dummy scheme.');
+ $this->assertEqual($this->classname, file_stream_wrapper_get_class($this->scheme), t('Got correct class name for dummy scheme.'));
// Check core's scheme.
- $this->assertEqual('DrupalPublicStreamWrapper', file_stream_wrapper_get_class('public'), 'Got correct class name for public scheme.');
+ $this->assertEqual('DrupalPublicStreamWrapper', file_stream_wrapper_get_class('public'), t('Got correct class name for public scheme.'));
}
/**
@@ -2420,10 +2420,10 @@ class StreamWrapperTest extends DrupalWebTestCase {
*/
function testGetInstanceByScheme() {
$instance = file_stream_wrapper_get_instance_by_scheme($this->scheme);
- $this->assertEqual($this->classname, get_class($instance), 'Got correct class type for dummy scheme.');
+ $this->assertEqual($this->classname, get_class($instance), t('Got correct class type for dummy scheme.'));
$instance = file_stream_wrapper_get_instance_by_scheme('public');
- $this->assertEqual('DrupalPublicStreamWrapper', get_class($instance), 'Got correct class type for public scheme.');
+ $this->assertEqual('DrupalPublicStreamWrapper', get_class($instance), t('Got correct class type for public scheme.'));
}
/**
@@ -2431,34 +2431,34 @@ class StreamWrapperTest extends DrupalWebTestCase {
*/
function testUriFunctions() {
$instance = file_stream_wrapper_get_instance_by_uri($this->scheme . '://foo');
- $this->assertEqual($this->classname, get_class($instance), 'Got correct class type for dummy URI.');
+ $this->assertEqual($this->classname, get_class($instance), t('Got correct class type for dummy URI.'));
$instance = file_stream_wrapper_get_instance_by_uri('public://foo');
- $this->assertEqual('DrupalPublicStreamWrapper', get_class($instance), 'Got correct class type for public URI.');
+ $this->assertEqual('DrupalPublicStreamWrapper', get_class($instance), t('Got correct class type for public URI.'));
// Test file_uri_target().
- $this->assertEqual(file_uri_target('public://foo/bar.txt'), 'foo/bar.txt', 'Got a valid stream target from public://foo/bar.txt.');
- $this->assertFalse(file_uri_target('foo/bar.txt'), 'foo/bar.txt is not a valid stream.');
+ $this->assertEqual(file_uri_target('public://foo/bar.txt'), 'foo/bar.txt', t('Got a valid stream target from public://foo/bar.txt.'));
+ $this->assertFalse(file_uri_target('foo/bar.txt'), t('foo/bar.txt is not a valid stream.'));
// Test file_build_uri() and file_directory_path().
- $this->assertEqual(file_build_uri('foo/bar.txt'), 'public://foo/bar.txt', 'Expected scheme was added.');
- $this->assertEqual(file_directory_path(), variable_get('file_public_path'), 'Expected default directory path was returned.');
- $this->assertEqual(file_directory_path('public'), variable_get('file_public_path'), 'Expected public directory path was returned.');
- $this->assertEqual(file_directory_path('temporary'), variable_get('file_temporary_path'), 'Expected temporary directory path was returned.');
- $this->assertEqual(file_directory_path($this->scheme), variable_get('stream_public_path', 'sites/default/files'), 'Expected dummy directory path was returned.');
- $this->assertFalse(file_directory_path('non-existent'), 'No directory path returned for invalid scheme.');
+ $this->assertEqual(file_build_uri('foo/bar.txt'), 'public://foo/bar.txt', t('Expected scheme was added.'));
+ $this->assertEqual(file_directory_path(), variable_get('file_public_path'), t('Expected default directory path was returned.'));
+ $this->assertEqual(file_directory_path('public'), variable_get('file_public_path'), t('Expected public directory path was returned.'));
+ $this->assertEqual(file_directory_path('temporary'), variable_get('file_temporary_path'), t('Expected temporary directory path was returned.'));
+ $this->assertEqual(file_directory_path($this->scheme), variable_get('stream_public_path', 'sites/default/files'), t('Expected dummy directory path was returned.'));
+ $this->assertFalse(file_directory_path('non-existent'), t('No directory path returned for invalid scheme.'));
variable_set('file_default_scheme', 'private');
- $this->assertEqual(file_build_uri('foo/bar.txt'), 'private://foo/bar.txt', 'Got a valid URI from foo/bar.txt.');
- $this->assertEqual(file_directory_path(), variable_get('file_private_path'), 'Expected default directory path was returned.');
- $this->assertEqual(file_directory_path('private'), variable_get('file_private_path'), 'Expected private directory path was returned.');
+ $this->assertEqual(file_build_uri('foo/bar.txt'), 'private://foo/bar.txt', t('Got a valid URI from foo/bar.txt.'));
+ $this->assertEqual(file_directory_path(), variable_get('file_private_path'), t('Expected default directory path was returned.'));
+ $this->assertEqual(file_directory_path('private'), variable_get('file_private_path'), t('Expected private directory path was returned.'));
}
/**
* Test the scheme functions.
*/
function testGetValidStreamScheme() {
- $this->assertEqual('foo', file_uri_scheme('foo://pork//chops'), 'Got the correct scheme from foo://asdf');
- $this->assertTrue(file_stream_wrapper_valid_scheme(file_uri_scheme('public://asdf')), 'Got a valid stream scheme from public://asdf');
- $this->assertFalse(file_stream_wrapper_valid_scheme(file_uri_scheme('foo://asdf')), 'Did not get a valid stream scheme from foo://asdf');
+ $this->assertEqual('foo', file_uri_scheme('foo://pork//chops'), t('Got the correct scheme from foo://asdf'));
+ $this->assertTrue(file_stream_wrapper_valid_scheme(file_uri_scheme('public://asdf')), t('Got a valid stream scheme from public://asdf'));
+ $this->assertFalse(file_stream_wrapper_valid_scheme(file_uri_scheme('foo://asdf')), t('Did not get a valid stream scheme from foo://asdf'));
}
}
diff --git a/modules/simpletest/tests/filetransfer.test b/modules/simpletest/tests/filetransfer.test
index e80696513..03e966d03 100644
--- a/modules/simpletest/tests/filetransfer.test
+++ b/modules/simpletest/tests/filetransfer.test
@@ -80,7 +80,7 @@ class FileTranferTest extends DrupalWebTestCase {
$gotit = TRUE;
try {
- $this->testConnection->copyDirectory($source, DRUPAL_ROOT . '/' . file_directory_path());
+ $this->testConnection->copyDirectory($source, DRUPAL_ROOT . '/'. file_directory_path());
}
catch (FileTransferException $e) {
$gotit = FALSE;
diff --git a/modules/simpletest/tests/form.test b/modules/simpletest/tests/form.test
index 6ffd603ba..525a8a291 100644
--- a/modules/simpletest/tests/form.test
+++ b/modules/simpletest/tests/form.test
@@ -129,7 +129,7 @@ class FormsTestCase extends DrupalWebTestCase {
// First, try to submit without the required checkbox.
$edit = array();
$this->drupalPost('form-test/checkbox', $edit, t('Submit'));
- $this->assertRaw(t('!name field is required.', array('!name' => 'required_checkbox')), 'A required checkbox is actually mandatory');
+ $this->assertRaw(t('!name field is required.', array('!name' => 'required_checkbox')), t('A required checkbox is actually mandatory'));
// Now try to submit the form correctly.
$values = drupal_json_decode($this->drupalPost(NULL, array('required_checkbox' => 1), t('Submit')));
@@ -142,7 +142,11 @@ class FormsTestCase extends DrupalWebTestCase {
'zero_checkbox_off' => '',
);
foreach ($expected_values as $widget => $expected_value) {
- $this->assertEqual($values[$widget], $expected_value, 'Checkbox ' . var_export($widget, TRUE) . ' returns expected value (expected: ' . var_export($expected_value, TRUE) . ', got: ' . var_export($values[$widget], TRUE) . ')');
+ $this->assertEqual($values[$widget], $expected_value, t('Checkbox %widget returns expected value (expected: %expected, got: %value)', array(
+ '%widget' => var_export($widget, TRUE),
+ '%expected' => var_export($expected_value, TRUE),
+ '%value' => var_export($values[$widget], TRUE),
+ )));
}
}
@@ -189,7 +193,7 @@ class FormsTestCase extends DrupalWebTestCase {
// All the elements should be marked as disabled, including the ones below
// the disabled container.
- $this->assertEqual(count($disabled_elements), 32, 'The correct elements have the disabled property in the HTML code.');
+ $this->assertEqual(count($disabled_elements), 32, t('The correct elements have the disabled property in the HTML code.'));
$this->drupalPost(NULL, $edit, t('Submit'));
$returned_values['hijacked'] = drupal_json_decode($this->content);
@@ -218,7 +222,7 @@ class FormsTestCase extends DrupalWebTestCase {
// Checkboxes values are not filtered out.
$values[$key] = array_filter($values[$key]);
}
- $this->assertIdentical($expected_value, $values[$key], 'Default value for ' . $key . ': expected ' . var_export($expected_value, TRUE) . ', returned ' . var_export($values[$key], TRUE) . '.');
+ $this->assertIdentical($expected_value, $values[$key], t('Default value for %type: expected %expected, returned %returned.', array('%type' => $key, '%expected' => var_export($expected_value, TRUE), '%returned' => var_export($values[$key], TRUE))));
}
// Recurse children.
@@ -269,7 +273,7 @@ class FormsTestCase extends DrupalWebTestCase {
':div-class' => $class,
':value' => isset($item['#value']) ? $item['#value'] : '',
));
- $this->assertTrue(isset($element[0]), 'Disabled form element class found for #type ' . $item['#type'] . '.');
+ $this->assertTrue(isset($element[0]), t('Disabled form element class found for #type %type.', array('%type' => $item['#type'])));
}
// Verify special element #type text-format.
@@ -277,12 +281,12 @@ class FormsTestCase extends DrupalWebTestCase {
':name' => 'text_format[value]',
':div-class' => 'form-disabled',
));
- $this->assertTrue(isset($element[0]), 'Disabled form element class found for #type ' . 'text_format[value]' . '.');
+ $this->assertTrue(isset($element[0]), t('Disabled form element class found for #type %type.', array('%type' => 'text_format[value]')));
$element = $this->xpath('//div[contains(@class, :div-class)]/descendant::select[@name=:name]', array(
':name' => 'text_format[format]',
':div-class' => 'form-disabled',
));
- $this->assertTrue(isset($element[0]), 'Disabled form element class found for #type ' . 'text_format[format]' . '.');
+ $this->assertTrue(isset($element[0]), t('Disabled form element class found for #type %type.', array('%type' => 'text_format[format]')));
}
/**
@@ -295,7 +299,7 @@ class FormsTestCase extends DrupalWebTestCase {
$checkbox = $this->xpath('//input[@name="checkboxes[two]"]');
$checkbox[0]['value'] = 'FORGERY';
$this->drupalPost(NULL, array('checkboxes[one]' => TRUE, 'checkboxes[two]' => TRUE), t('Submit'));
- $this->assertText('An illegal choice has been detected.', 'Input forgery was detected.');
+ $this->assertText('An illegal choice has been detected.', t('Input forgery was detected.'));
}
}
@@ -329,7 +333,7 @@ class FormAlterTestCase extends DrupalWebTestCase {
'system_form_form_test_alter_form_alter() executed.',
);
$content = preg_replace('/\s+/', ' ', filter_xss($this->content, array()));
- $this->assert(strpos($content, implode(' ', $expected)) !== FALSE, 'Form alter hooks executed in the expected order.');
+ $this->assert(strpos($content, implode(' ', $expected)) !== FALSE, t('Form alter hooks executed in the expected order.'));
}
}
@@ -360,8 +364,8 @@ class FormValidationTestCase extends DrupalWebTestCase {
'name' => 'element_validate',
);
$this->drupalPost(NULL, $edit, 'Save');
- $this->assertFieldByName('name', '#value changed by #element_validate', 'Form element #value was altered.');
- $this->assertText('Name value: value changed by form_set_value() in #element_validate', 'Form element value in $form_state was altered.');
+ $this->assertFieldByName('name', '#value changed by #element_validate', t('Form element #value was altered.'));
+ $this->assertText('Name value: value changed by form_set_value() in #element_validate', t('Form element value in $form_state was altered.'));
// Verify that #validate handlers can alter the form and submitted
// form values.
@@ -369,8 +373,8 @@ class FormValidationTestCase extends DrupalWebTestCase {
'name' => 'validate',
);
$this->drupalPost(NULL, $edit, 'Save');
- $this->assertFieldByName('name', '#value changed by #validate', 'Form element #value was altered.');
- $this->assertText('Name value: value changed by form_set_value() in #validate', 'Form element value in $form_state was altered.');
+ $this->assertFieldByName('name', '#value changed by #validate', t('Form element #value was altered.'));
+ $this->assertText('Name value: value changed by form_set_value() in #validate', t('Form element value in $form_state was altered.'));
// Verify that #element_validate handlers can make form elements
// inaccessible, but values persist.
@@ -379,12 +383,12 @@ class FormValidationTestCase extends DrupalWebTestCase {
);
$this->drupalPost(NULL, $edit, 'Save');
$this->assertNoFieldByName('name', t('Form element was hidden.'));
- $this->assertText('Name value: element_validate_access', 'Value for inaccessible form element exists.');
+ $this->assertText('Name value: element_validate_access', t('Value for inaccessible form element exists.'));
// Verify that value for inaccessible form element persists.
$this->drupalPost(NULL, array(), 'Save');
$this->assertNoFieldByName('name', t('Form element was hidden.'));
- $this->assertText('Name value: element_validate_access', 'Value for inaccessible form element exists.');
+ $this->assertText('Name value: element_validate_access', t('Value for inaccessible form element exists.'));
}
/**
@@ -436,49 +440,49 @@ class FormsElementsLabelsTestCase extends DrupalWebTestCase {
// Check that the checkbox/radio processing is not interfering with
// basic placement.
$elements = $this->xpath('//input[@id="edit-form-checkboxes-test-third-checkbox"]/following-sibling::label[@for="edit-form-checkboxes-test-third-checkbox" and @class="option"]');
- $this->assertTrue(isset($elements[0]), "Label follows field and label option class correct for regular checkboxes.");
+ $this->assertTrue(isset($elements[0]), t("Label follows field and label option class correct for regular checkboxes."));
$elements = $this->xpath('//input[@id="edit-form-radios-test-second-radio"]/following-sibling::label[@for="edit-form-radios-test-second-radio" and @class="option"]');
- $this->assertTrue(isset($elements[0]), "Label follows field and label option class correct for regular radios.");
+ $this->assertTrue(isset($elements[0]), t("Label follows field and label option class correct for regular radios."));
// Exercise various defaults for checkboxes and modifications to ensure
// appropriate override and correct behaviour.
$elements = $this->xpath('//input[@id="edit-form-checkbox-test"]/following-sibling::label[@for="edit-form-checkbox-test" and @class="option"]');
- $this->assertTrue(isset($elements[0]), "Label follows field and label option class correct for a checkbox by default.");
+ $this->assertTrue(isset($elements[0]), t("Label follows field and label option class correct for a checkbox by default."));
// Exercise various defaults for textboxes and modifications to ensure
// appropriate override and correct behaviour.
$elements = $this->xpath('//label[@for="edit-form-textfield-test-title-and-required"]/child::span[@class="form-required"]/parent::*/following-sibling::input[@id="edit-form-textfield-test-title-and-required"]');
- $this->assertTrue(isset($elements[0]), "Label preceeds textfield, with required marker inside label.");
+ $this->assertTrue(isset($elements[0]), t("Label preceeds textfield, with required marker inside label."));
$elements = $this->xpath('//input[@id="edit-form-textfield-test-no-title-required"]/preceding-sibling::label[@for="edit-form-textfield-test-no-title-required"]/span[@class="form-required"]');
- $this->assertTrue(isset($elements[0]), "Label tag with required marker preceeds required textfield with no title.");
+ $this->assertTrue(isset($elements[0]), t("Label tag with required marker preceeds required textfield with no title."));
$elements = $this->xpath('//input[@id="edit-form-textfield-test-title"]/preceding-sibling::span[@class="form-required"]');
- $this->assertFalse(isset($elements[0]), "No required marker on non-required field.");
+ $this->assertFalse(isset($elements[0]), t("No required marker on non-required field."));
$elements = $this->xpath('//input[@id="edit-form-textfield-test-title-after"]/following-sibling::label[@for="edit-form-textfield-test-title-after" and @class="option"]');
- $this->assertTrue(isset($elements[0]), "Label after field and label option class correct for text field.");
+ $this->assertTrue(isset($elements[0]), t("Label after field and label option class correct for text field."));
$elements = $this->xpath('//input[@id="edit-form-textfield-test-title-invisible"]/following-sibling::label[@for="edit-form-textfield-test-title-invisible" and @class="element-invisible"]');
- $this->assertTrue(isset($elements[0]), "Label after field and label class is element-invisible.");
+ $this->assertTrue(isset($elements[0]), t("Label after field and label class is element-invisible."));
$elements = $this->xpath('//label[@for="edit-form-textfield-test-title-no-show"]');
- $this->assertFalse(isset($elements[0]), "No label tag when title set not to display.");
+ $this->assertFalse(isset($elements[0]), t("No label tag when title set not to display."));
// Check #field_prefix and #field_suffix placement.
$elements = $this->xpath('//span[@class="field-prefix"]/following-sibling::div[@id="edit-form-radios-test"]');
- $this->assertTrue(isset($elements[0]), "Properly placed the #field_prefix element after the label and before the field.");
+ $this->assertTrue(isset($elements[0]), t("Properly placed the #field_prefix element after the label and before the field."));
$elements = $this->xpath('//span[@class="field-suffix"]/preceding-sibling::div[@id="edit-form-radios-test"]');
- $this->assertTrue(isset($elements[0]), "Properly places the #field_suffix element immediately after the form field.");
+ $this->assertTrue(isset($elements[0]), t("Properly places the #field_suffix element immediately after the form field."));
// Check #prefix and #suffix placement.
$elements = $this->xpath('//div[@id="form-test-textfield-title-prefix"]/following-sibling::div[contains(@class, \'form-item-form-textfield-test-title\')]');
- $this->assertTrue(isset($elements[0]), "Properly places the #prefix element before the form item.");
+ $this->assertTrue(isset($elements[0]), t("Properly places the #prefix element before the form item."));
$elements = $this->xpath('//div[@id="form-test-textfield-title-suffix"]/preceding-sibling::div[contains(@class, \'form-item-form-textfield-test-title\')]');
- $this->assertTrue(isset($elements[0]), "Properly places the #suffix element before the form item.");
+ $this->assertTrue(isset($elements[0]), t("Properly places the #suffix element before the form item."));
}
}
@@ -507,14 +511,14 @@ class FormsElementsTableSelectFunctionalTest extends DrupalWebTestCase {
$this->drupalGet('form_test/tableselect/multiple-true');
- $this->assertNoText(t('Empty text.'), 'Empty text should not be displayed.');
+ $this->assertNoText(t('Empty text.'), t('Empty text should not be displayed.'));
// Test for the presence of the Select all rows tableheader.
- $this->assertFieldByXPath('//th[@class="select-all"]', NULL, 'Presence of the "Select all" checkbox.');
+ $this->assertFieldByXPath('//th[@class="select-all"]', NULL, t('Presence of the "Select all" checkbox.'));
$rows = array('row1', 'row2', 'row3');
foreach ($rows as $row) {
- $this->assertFieldByXPath('//input[@type="checkbox"]', $row, 'Checkbox for value ' . $row . '.');
+ $this->assertFieldByXPath('//input[@type="checkbox"]', $row, t('Checkbox for value @row.', array('@row' => $row)));
}
}
@@ -524,14 +528,14 @@ class FormsElementsTableSelectFunctionalTest extends DrupalWebTestCase {
function testMultipleFalse() {
$this->drupalGet('form_test/tableselect/multiple-false');
- $this->assertNoText(t('Empty text.'), 'Empty text should not be displayed.');
+ $this->assertNoText(t('Empty text.'), t('Empty text should not be displayed.'));
// Test for the absence of the Select all rows tableheader.
- $this->assertNoFieldByXPath('//th[@class="select-all"]', '', 'Absence of the "Select all" checkbox.');
+ $this->assertNoFieldByXPath('//th[@class="select-all"]', '', t('Absence of the "Select all" checkbox.'));
$rows = array('row1', 'row2', 'row3');
foreach ($rows as $row) {
- $this->assertFieldByXPath('//input[@type="radio"]', $row, 'Radio button for value ' . $row . '.');
+ $this->assertFieldByXPath('//input[@type="radio"]', $row, t('Radio button for value @row.', array('@row' => $row)));
}
}
@@ -540,7 +544,7 @@ class FormsElementsTableSelectFunctionalTest extends DrupalWebTestCase {
*/
function testEmptyText() {
$this->drupalGet('form_test/tableselect/empty-text');
- $this->assertText(t('Empty text.'), 'Empty text should be displayed.');
+ $this->assertText(t('Empty text.'), t('Empty text should be displayed.'));
}
/**
@@ -553,18 +557,18 @@ class FormsElementsTableSelectFunctionalTest extends DrupalWebTestCase {
$edit['tableselect[row1]'] = TRUE;
$this->drupalPost('form_test/tableselect/multiple-true', $edit, 'Submit');
- $this->assertText(t('Submitted: row1 = row1'), 'Checked checkbox row1');
- $this->assertText(t('Submitted: row2 = 0'), 'Unchecked checkbox row2.');
- $this->assertText(t('Submitted: row3 = 0'), 'Unchecked checkbox row3.');
+ $this->assertText(t('Submitted: row1 = row1'), t('Checked checkbox row1'));
+ $this->assertText(t('Submitted: row2 = 0'), t('Unchecked checkbox row2.'));
+ $this->assertText(t('Submitted: row3 = 0'), t('Unchecked checkbox row3.'));
// Test a submission with multiple checkboxes checked.
$edit['tableselect[row1]'] = TRUE;
$edit['tableselect[row3]'] = TRUE;
$this->drupalPost('form_test/tableselect/multiple-true', $edit, 'Submit');
- $this->assertText(t('Submitted: row1 = row1'), 'Checked checkbox row1.');
- $this->assertText(t('Submitted: row2 = 0'), 'Unchecked checkbox row2.');
- $this->assertText(t('Submitted: row3 = row3'), 'Checked checkbox row3.');
+ $this->assertText(t('Submitted: row1 = row1'), t('Checked checkbox row1.'));
+ $this->assertText(t('Submitted: row2 = 0'), t('Unchecked checkbox row2.'));
+ $this->assertText(t('Submitted: row3 = row3'), t('Checked checkbox row3.'));
}
@@ -574,7 +578,7 @@ class FormsElementsTableSelectFunctionalTest extends DrupalWebTestCase {
function testMultipleFalseSubmit() {
$edit['tableselect'] = 'row1';
$this->drupalPost('form_test/tableselect/multiple-false', $edit, 'Submit');
- $this->assertText(t('Submitted: row1'), 'Selected radio button');
+ $this->assertText(t('Submitted: row1'), t('Selected radio button'));
}
/**
@@ -583,18 +587,18 @@ class FormsElementsTableSelectFunctionalTest extends DrupalWebTestCase {
function testAdvancedSelect() {
// When #multiple = TRUE a Select all checkbox should be displayed by default.
$this->drupalGet('form_test/tableselect/advanced-select/multiple-true-default');
- $this->assertFieldByXPath('//th[@class="select-all"]', NULL, 'Display a "Select all" checkbox by default when #multiple is TRUE.');
+ $this->assertFieldByXPath('//th[@class="select-all"]', NULL, t('Display a "Select all" checkbox by default when #multiple is TRUE.'));
// When #js_select is set to FALSE, a "Select all" checkbox should not be displayed.
$this->drupalGet('form_test/tableselect/advanced-select/multiple-true-no-advanced-select');
- $this->assertNoFieldByXPath('//th[@class="select-all"]', NULL, 'Do not display a "Select all" checkbox when #js_select is FALSE.');
+ $this->assertNoFieldByXPath('//th[@class="select-all"]', NULL, t('Do not display a "Select all" checkbox when #js_select is FALSE.'));
// A "Select all" checkbox never makes sense when #multiple = FALSE, regardless of the value of #js_select.
$this->drupalGet('form_test/tableselect/advanced-select/multiple-false-default');
- $this->assertNoFieldByXPath('//th[@class="select-all"]', NULL, 'Do not display a "Select all" checkbox when #multiple is FALSE.');
+ $this->assertNoFieldByXPath('//th[@class="select-all"]', NULL, t('Do not display a "Select all" checkbox when #multiple is FALSE.'));
$this->drupalGet('form_test/tableselect/advanced-select/multiple-false-advanced-select');
- $this->assertNoFieldByXPath('//th[@class="select-all"]', NULL, 'Do not display a "Select all" checkbox when #multiple is FALSE, even when #js_select is TRUE.');
+ $this->assertNoFieldByXPath('//th[@class="select-all"]', NULL, t('Do not display a "Select all" checkbox when #multiple is FALSE, even when #js_select is TRUE.'));
}
@@ -613,11 +617,11 @@ class FormsElementsTableSelectFunctionalTest extends DrupalWebTestCase {
// Test with a valid value.
list($processed_form, $form_state, $errors) = $this->formSubmitHelper($form, array('tableselect' => 'row1'));
- $this->assertFalse(isset($errors['tableselect']), 'Option checker allows valid values for checkboxes.');
+ $this->assertFalse(isset($errors['tableselect']), t('Option checker allows valid values for checkboxes.'));
// Test with an invalid value.
list($processed_form, $form_state, $errors) = $this->formSubmitHelper($form, array('tableselect' => 'non_existing_value'));
- $this->assertTrue(isset($errors['tableselect']), 'Option checker disallows invalid values for checkboxes.');
+ $this->assertTrue(isset($errors['tableselect']), t('Option checker disallows invalid values for checkboxes.'));
}
@@ -638,11 +642,11 @@ class FormsElementsTableSelectFunctionalTest extends DrupalWebTestCase {
// Test with a valid value.
list($processed_form, $form_state, $errors) = $this->formSubmitHelper($form, array('tableselect' => 'row1'));
- $this->assertFalse(isset($errors['tableselect']), 'Option checker allows valid values for radio buttons.');
+ $this->assertFalse(isset($errors['tableselect']), t('Option checker allows valid values for radio buttons.'));
// Test with an invalid value.
list($processed_form, $form_state, $errors) = $this->formSubmitHelper($form, array('tableselect' => 'non_existing_value'));
- $this->assertTrue(isset($errors['tableselect']), 'Option checker disallows invalid values for radio buttons.');
+ $this->assertTrue(isset($errors['tableselect']), t('Option checker disallows invalid values for radio buttons.'));
}
@@ -735,7 +739,7 @@ class FormsFormStorageTestCase extends DrupalWebTestCase {
$this->drupalPost(NULL, $edit, 'Save');
$this->assertText('Form constructions: 5');
- $this->assertText('Title: new', 'The form storage has stored the values.');
+ $this->assertText('Title: new', t('The form storage has stored the values.'));
}
/**
@@ -762,7 +766,7 @@ class FormsFormStorageTestCase extends DrupalWebTestCase {
$this->drupalPost(NULL, $edit, 'Save');
$this->assertText('Form constructions: 3');
- $this->assertText('Title: new', 'The form storage has stored the values.');
+ $this->assertText('Title: new', t('The form storage has stored the values.'));
}
/**
@@ -770,7 +774,7 @@ class FormsFormStorageTestCase extends DrupalWebTestCase {
*/
function testValidation() {
$this->drupalPost('form_test/form-storage', array('title' => '', 'value' => 'value_is_set'), 'Continue submit');
- $this->assertPattern('/value_is_set/', 'The input values have been kept.');
+ $this->assertPattern('/value_is_set/', t('The input values have been kept.'));
}
/**
@@ -820,7 +824,7 @@ class FormsFormStorageTestCase extends DrupalWebTestCase {
array(),
array('query' => array('cache' => 1)),
);
- foreach ($run_options as $options) {
+ foreach($run_options as $options) {
$this->drupalPost('form-test/state-persist', array(), t('Submit'), $options);
// The submit handler outputs the value in $form_state, assert it's there.
$this->assertText('State persisted.');
@@ -860,8 +864,8 @@ class FormsFormWrapperTestCase extends DrupalWebTestCase {
*/
function testWrapperCallback() {
$this->drupalGet('form_test/wrapper-callback');
- $this->assertText('Form wrapper callback element output.', 'The form contains form wrapper elements.');
- $this->assertText('Form builder element output.', 'The form contains form builder elements.');
+ $this->assertText('Form wrapper callback element output.', t('The form contains form wrapper elements.'));
+ $this->assertText('Form builder element output.', t('The form contains form builder elements.'));
}
}
@@ -894,22 +898,22 @@ class FormStateValuesCleanTestCase extends DrupalWebTestCase {
);
// Verify that all internal Form API elements were removed.
- $this->assertFalse(isset($values['form_id']), 'form_id' . ' was removed.');
- $this->assertFalse(isset($values['form_token']), 'form_token' . ' was removed.');
- $this->assertFalse(isset($values['form_build_id']), 'form_build_id' . ' was removed.');
- $this->assertFalse(isset($values['op']), 'op' . ' was removed.');
+ $this->assertFalse(isset($values['form_id']), t('%element was removed.', array('%element' => 'form_id')));
+ $this->assertFalse(isset($values['form_token']), t('%element was removed.', array('%element' => 'form_token')));
+ $this->assertFalse(isset($values['form_build_id']), t('%element was removed.', array('%element' => 'form_build_id')));
+ $this->assertFalse(isset($values['op']), t('%element was removed.', array('%element' => 'op')));
// Verify that all buttons were removed.
- $this->assertFalse(isset($values['foo']), 'foo' . ' was removed.');
- $this->assertFalse(isset($values['bar']), 'bar' . ' was removed.');
- $this->assertFalse(isset($values['baz']['foo']), 'foo' . ' was removed.');
- $this->assertFalse(isset($values['baz']['baz']), 'baz' . ' was removed.');
+ $this->assertFalse(isset($values['foo']), t('%element was removed.', array('%element' => 'foo')));
+ $this->assertFalse(isset($values['bar']), t('%element was removed.', array('%element' => 'bar')));
+ $this->assertFalse(isset($values['baz']['foo']), t('%element was removed.', array('%element' => 'foo')));
+ $this->assertFalse(isset($values['baz']['baz']), t('%element was removed.', array('%element' => 'baz')));
// Verify that nested form value still exists.
- $this->assertTrue(isset($values['baz']['beer']), 'Nested form value still exists.');
+ $this->assertTrue(isset($values['baz']['beer']), t('Nested form value still exists.'));
// Verify that actual form values equal resulting form values.
- $this->assertEqual($values, $result, 'Expected form values equal actual form values.');
+ $this->assertEqual($values, $result, t('Expected form values equal actual form values.'));
}
}
@@ -946,14 +950,14 @@ class FormsRebuildTestCase extends DrupalWebTestCase {
$this->drupalPost('form-test/form-rebuild-preserve-values', $edit, 'Add more');
// Verify that initial elements retained their submitted values.
- $this->assertFieldChecked('edit-checkbox-1-default-off', 'A submitted checked checkbox retained its checked state during a rebuild.');
- $this->assertNoFieldChecked('edit-checkbox-1-default-on', 'A submitted unchecked checkbox retained its unchecked state during a rebuild.');
- $this->assertFieldById('edit-text-1', 'foo', 'A textfield retained its submitted value during a rebuild.');
+ $this->assertFieldChecked('edit-checkbox-1-default-off', t('A submitted checked checkbox retained its checked state during a rebuild.'));
+ $this->assertNoFieldChecked('edit-checkbox-1-default-on', t('A submitted unchecked checkbox retained its unchecked state during a rebuild.'));
+ $this->assertFieldById('edit-text-1', 'foo', t('A textfield retained its submitted value during a rebuild.'));
// Verify that newly added elements were initialized with their default values.
- $this->assertFieldChecked('edit-checkbox-2-default-on', 'A newly added checkbox was initialized with a default checked state.');
- $this->assertNoFieldChecked('edit-checkbox-2-default-off', 'A newly added checkbox was initialized with a default unchecked state.');
- $this->assertFieldById('edit-text-2', 'DEFAULT 2', 'A newly added textfield was initialized with its default value.');
+ $this->assertFieldChecked('edit-checkbox-2-default-on', t('A newly added checkbox was initialized with a default checked state.'));
+ $this->assertNoFieldChecked('edit-checkbox-2-default-off', t('A newly added checkbox was initialized with a default unchecked state.'));
+ $this->assertFieldById('edit-text-2', 'DEFAULT 2', t('A newly added textfield was initialized with its default value.'));
}
/**
@@ -991,7 +995,7 @@ class FormsRebuildTestCase extends DrupalWebTestCase {
$button = $this->xpath('//input[@name="field_ajax_test_add_more"]');
$button_id = (string) $button[0]['id'];
$this->drupalPostAJAX(NULL, array(), array('field_ajax_test_add_more' => t('Add another item')), 'system/ajax', array(), array(), 'page-node-form', $settings['ajax'][$button_id]);
- $this->assert(count($this->xpath('//div[contains(@class, "field-name-field-ajax-test")]//input[@type="text"]')) == 2, 'AJAX submission succeeded.');
+ $this->assert(count($this->xpath('//div[contains(@class, "field-name-field-ajax-test")]//input[@type="text"]')) == 2, t('AJAX submission succeeded.'));
// Submit the form with the non-AJAX "Save" button, leaving the title field
// blank to trigger a validation error, and ensure that a validation error
@@ -999,11 +1003,11 @@ class FormsRebuildTestCase extends DrupalWebTestCase {
// re-rendered without being re-built, which is what happens when there's
// a validation error.
$this->drupalPost(NULL, array(), t('Save'));
- $this->assertText('Title field is required.', 'Non-AJAX submission correctly triggered a validation error.');
+ $this->assertText('Title field is required.', t('Non-AJAX submission correctly triggered a validation error.'));
// Ensure that the form's action is correct.
$forms = $this->xpath('//form[contains(@class, "node-page-form")]');
- $this->assert(count($forms) == 1 && $forms[0]['action'] == url('node/add/page'), 'Re-rendered form contains the correct action value.');
+ $this->assert(count($forms) == 1 && $forms[0]['action'] == url('node/add/page'), t('Re-rendered form contains the correct action value.'));
}
}
@@ -1030,7 +1034,7 @@ class FormsProgrammaticTestCase extends DrupalWebTestCase {
function testSubmissionWorkflow() {
// Backup the current batch status and reset it to avoid conflicts while
// processing the dummy form submit handler.
- $current_batch = $batch = & batch_get();
+ $current_batch = $batch =& batch_get();
$batch = array();
// Test that a programmatic form submission is rejected when a required
@@ -1073,7 +1077,7 @@ class FormsProgrammaticTestCase extends DrupalWebTestCase {
'%values' => print_r($values, TRUE),
'%errors' => $valid_form ? t('None') : implode(' ', $errors),
);
- $this->assertTrue($valid_input == $valid_form, 'Input values: ' . $args['%values'] . '<br/>Validation handler errors: ' . $args['%errors']);
+ $this->assertTrue($valid_input == $valid_form, t('Input values: %values<br/>Validation handler errors: %errors', $args));
// We check submitted values only if we have a valid input.
if ($valid_input) {
@@ -1081,7 +1085,7 @@ class FormsProgrammaticTestCase extends DrupalWebTestCase {
// submission handler was properly executed.
$stored_values = $form_state['storage']['programmatic_form_submit'];
foreach ($values as $key => $value) {
- $this->assertTrue(isset($stored_values[$key]) && $stored_values[$key] == $value, 'Submission handler correctly executed: ' . $key . ' is ' . print_r($value, TRUE));
+ $this->assertTrue(isset($stored_values[$key]) && $stored_values[$key] == $value, t('Submission handler correctly executed: %stored_key is %stored_value', array('%stored_key' => $key, '%stored_value' => print_r($value, TRUE))));
}
}
}
@@ -1118,24 +1122,24 @@ class FormsTriggeringElementTestCase extends DrupalWebTestCase {
// $form_state['triggering_element'] and the form submit handler not
// running.
$this->drupalPost($path, $edit, NULL, array(), array(), $form_html_id);
- $this->assertText('There is no clicked button.', '$form_state[\'triggering_element\'] set to NULL.');
- $this->assertNoText('Submit handler for form_test_clicked_button executed.', 'Form submit handler did not execute.');
+ $this->assertText('There is no clicked button.', t('$form_state[\'triggering_element\'] set to NULL.'));
+ $this->assertNoText('Submit handler for form_test_clicked_button executed.', t('Form submit handler did not execute.'));
// Ensure submitting a form with one or more submit buttons results in
// $form_state['triggering_element'] being set to the first one the user has
// access to. An argument with 'r' in it indicates a restricted
// (#access=FALSE) button.
$this->drupalPost($path . '/s', $edit, NULL, array(), array(), $form_html_id);
- $this->assertText('The clicked button is button1.', '$form_state[\'triggering_element\'] set to only button.');
- $this->assertText('Submit handler for form_test_clicked_button executed.', 'Form submit handler executed.');
+ $this->assertText('The clicked button is button1.', t('$form_state[\'triggering_element\'] set to only button.'));
+ $this->assertText('Submit handler for form_test_clicked_button executed.', t('Form submit handler executed.'));
$this->drupalPost($path . '/s/s', $edit, NULL, array(), array(), $form_html_id);
- $this->assertText('The clicked button is button1.', '$form_state[\'triggering_element\'] set to first button.');
- $this->assertText('Submit handler for form_test_clicked_button executed.', 'Form submit handler executed.');
+ $this->assertText('The clicked button is button1.', t('$form_state[\'triggering_element\'] set to first button.'));
+ $this->assertText('Submit handler for form_test_clicked_button executed.', t('Form submit handler executed.'));
$this->drupalPost($path . '/rs/s', $edit, NULL, array(), array(), $form_html_id);
- $this->assertText('The clicked button is button2.', '$form_state[\'triggering_element\'] set to first available button.');
- $this->assertText('Submit handler for form_test_clicked_button executed.', 'Form submit handler executed.');
+ $this->assertText('The clicked button is button2.', t('$form_state[\'triggering_element\'] set to first available button.'));
+ $this->assertText('Submit handler for form_test_clicked_button executed.', t('Form submit handler executed.'));
// Ensure submitting a form with buttons of different types results in
// $form_state['triggering_element'] being set to the first button,
@@ -1143,16 +1147,16 @@ class FormsTriggeringElementTestCase extends DrupalWebTestCase {
// submit handler not executing. The types are 's'(ubmit), 'b'(utton), and
// 'i'(mage_button).
$this->drupalPost($path . '/s/b/i', $edit, NULL, array(), array(), $form_html_id);
- $this->assertText('The clicked button is button1.', '$form_state[\'triggering_element\'] set to first button.');
- $this->assertText('Submit handler for form_test_clicked_button executed.', 'Form submit handler executed.');
+ $this->assertText('The clicked button is button1.', t('$form_state[\'triggering_element\'] set to first button.'));
+ $this->assertText('Submit handler for form_test_clicked_button executed.', t('Form submit handler executed.'));
$this->drupalPost($path . '/b/s/i', $edit, NULL, array(), array(), $form_html_id);
- $this->assertText('The clicked button is button1.', '$form_state[\'triggering_element\'] set to first button.');
- $this->assertNoText('Submit handler for form_test_clicked_button executed.', 'Form submit handler did not execute.');
+ $this->assertText('The clicked button is button1.', t('$form_state[\'triggering_element\'] set to first button.'));
+ $this->assertNoText('Submit handler for form_test_clicked_button executed.', t('Form submit handler did not execute.'));
$this->drupalPost($path . '/i/s/b', $edit, NULL, array(), array(), $form_html_id);
- $this->assertText('The clicked button is button1.', '$form_state[\'triggering_element\'] set to first button.');
- $this->assertText('Submit handler for form_test_clicked_button executed.', 'Form submit handler executed.');
+ $this->assertText('The clicked button is button1.', t('$form_state[\'triggering_element\'] set to first button.'));
+ $this->assertText('Submit handler for form_test_clicked_button executed.', t('Form submit handler executed.'));
}
/**
@@ -1180,8 +1184,8 @@ class FormsTriggeringElementTestCase extends DrupalWebTestCase {
// because negative assertions alone can be brittle. See
// testNoButtonInfoInPost() for why the triggering element gets set to
// 'button2'.
- $this->assertNoText('The clicked button is button1.', '$form_state[\'triggering_element\'] not set to a restricted button.');
- $this->assertText('The clicked button is button2.', '$form_state[\'triggering_element\'] not set to a restricted button.');
+ $this->assertNoText('The clicked button is button1.', t('$form_state[\'triggering_element\'] not set to a restricted button.'));
+ $this->assertText('The clicked button is button2.', t('$form_state[\'triggering_element\'] not set to a restricted button.'));
}
}
diff --git a/modules/simpletest/tests/graph.test b/modules/simpletest/tests/graph.test
index aad60f81d..70af3ff1e 100644
--- a/modules/simpletest/tests/graph.test
+++ b/modules/simpletest/tests/graph.test
@@ -68,7 +68,7 @@ class GraphUnitTest extends DrupalUnitTestCase {
$this->assertReversePaths($graph, $expected_reverse_paths);
// Assert that DFS didn't created "missing" vertexes automatically.
- $this->assertFALSE(isset($graph[6]), 'Vertex 6 has not been created');
+ $this->assertFALSE(isset($graph[6]), t('Vertex 6 has not been created'));
$expected_components = array(
array(1, 2, 3, 4, 5, 7),
@@ -114,7 +114,7 @@ class GraphUnitTest extends DrupalUnitTestCase {
// Build an array with keys = $paths and values = TRUE.
$expected = array_fill_keys($paths, TRUE);
$result = isset($graph[$vertex]['paths']) ? $graph[$vertex]['paths'] : array();
- $this->assertEqual($expected, $result, 'Expected paths for vertex ' . $vertex . ': ' . $this->displayArray($expected, TRUE) . ', got ' . $this->displayArray($result, TRUE));
+ $this->assertEqual($expected, $result, t('Expected paths for vertex @vertex: @expected-paths, got @paths', array('@vertex' => $vertex, '@expected-paths' => $this->displayArray($expected, TRUE), '@paths' => $this->displayArray($result, TRUE))));
}
}
@@ -132,7 +132,7 @@ class GraphUnitTest extends DrupalUnitTestCase {
// Build an array with keys = $paths and values = TRUE.
$expected = array_fill_keys($paths, TRUE);
$result = isset($graph[$vertex]['reverse_paths']) ? $graph[$vertex]['reverse_paths'] : array();
- $this->assertEqual($expected, $result, 'Expected reverse paths for vertex ' . $vertex . ': ' . $this->displayArray($expected, TRUE) . ', got ' . $this->displayArray($result, TRUE));
+ $this->assertEqual($expected, $result, t('Expected reverse paths for vertex @vertex: @expected-paths, got @paths', array('@vertex' => $vertex, '@expected-paths' => $this->displayArray($expected, TRUE), '@paths' => $this->displayArray($result, TRUE))));
}
}
@@ -152,9 +152,9 @@ class GraphUnitTest extends DrupalUnitTestCase {
$result_components[] = $graph[$vertex]['component'];
unset($unassigned_vertices[$vertex]);
}
- $this->assertEqual(1, count(array_unique($result_components)), 'Expected one unique component for vertices ' . $this->displayArray($component) . ', got ' . $this->displayArray($result_components));
+ $this->assertEqual(1, count(array_unique($result_components)), t('Expected one unique component for vertices @vertices, got @components', array('@vertices' => $this->displayArray($component), '@components' => $this->displayArray($result_components))));
}
- $this->assertEqual(array(), $unassigned_vertices, 'Vertices not assigned to a component: ' . $this->displayArray($unassigned_vertices, TRUE));
+ $this->assertEqual(array(), $unassigned_vertices, t('Vertices not assigned to a component: @vertices', array('@vertices' => $this->displayArray($unassigned_vertices, TRUE))));
}
/**
@@ -169,7 +169,7 @@ class GraphUnitTest extends DrupalUnitTestCase {
foreach ($expected_orders as $order) {
$previous_vertex = array_shift($order);
foreach ($order as $vertex) {
- $this->assertTrue($graph[$previous_vertex]['weight'] < $graph[$vertex]['weight'], 'Weights of ' . $previous_vertex . ' and ' . $vertex . ' are correct relative to each other');
+ $this->assertTrue($graph[$previous_vertex]['weight'] < $graph[$vertex]['weight'], t('Weights of @previous-vertex and @vertex are correct relative to each other', array('@previous-vertex' => $previous_vertex, '@vertex' => $vertex)));
}
}
}
diff --git a/modules/simpletest/tests/image.test b/modules/simpletest/tests/image.test
index 89729d0fc..d448d4876 100644
--- a/modules/simpletest/tests/image.test
+++ b/modules/simpletest/tests/image.test
@@ -50,19 +50,19 @@ class ImageToolkitTestCase extends DrupalWebTestCase {
// Determine if there were any expected that were not called.
$uncalled = array_diff($expected, $actual);
if (count($uncalled)) {
- $this->assertTrue(FALSE, 'Expected operations ' . implode(', ', $expected) . ' to be called but ' . implode(', ', $uncalled) . ' was not called.');
+ $this->assertTrue(FALSE, t('Expected operations %expected to be called but %uncalled was not called.', array('%expected' => implode(', ', $expected), '%uncalled' => implode(', ', $uncalled))));
}
else {
- $this->assertTrue(TRUE, 'All the expected operations were called: ' . implode(', ', $expected));
+ $this->assertTrue(TRUE, t('All the expected operations were called: %expected', array('%expected' => implode(', ', $expected))));
}
// Determine if there were any unexpected calls.
$unexpected = array_diff($actual, $expected);
if (count($unexpected)) {
- $this->assertTrue(FALSE, 'Unexpected operations were called: ' . implode(', ', $unexpected) . '.');
+ $this->assertTrue(FALSE, t('Unexpected operations were called: %unexpected.', array('%unexpected' => implode(', ', $unexpected))));
}
else {
- $this->assertTrue(TRUE, 'No unexpected operations were called.');
+ $this->assertTrue(TRUE, t('No unexpected operations were called.'));
}
}
}
@@ -85,8 +85,8 @@ class ImageToolkitUnitTest extends ImageToolkitTestCase {
*/
function testGetAvailableToolkits() {
$toolkits = image_get_available_toolkits();
- $this->assertTrue(isset($toolkits['test']), 'The working toolkit was returned.');
- $this->assertFalse(isset($toolkits['broken']), 'The toolkit marked unavailable was not returned');
+ $this->assertTrue(isset($toolkits['test']), t('The working toolkit was returned.'));
+ $this->assertFalse(isset($toolkits['broken']), t('The toolkit marked unavailable was not returned'));
$this->assertToolkitOperationsCalled(array());
}
@@ -95,8 +95,8 @@ class ImageToolkitUnitTest extends ImageToolkitTestCase {
*/
function testLoad() {
$image = image_load($this->file, $this->toolkit);
- $this->assertTrue(is_object($image), 'Returned an object.');
- $this->assertEqual($this->toolkit, $image->toolkit, 'Image had toolkit set.');
+ $this->assertTrue(is_object($image), t('Returned an object.'));
+ $this->assertEqual($this->toolkit, $image->toolkit, t('Image had toolkit set.'));
$this->assertToolkitOperationsCalled(array('load', 'get_info'));
}
@@ -104,7 +104,7 @@ class ImageToolkitUnitTest extends ImageToolkitTestCase {
* Test the image_save() function.
*/
function testSave() {
- $this->assertFalse(image_save($this->image), 'Function returned the expected value.');
+ $this->assertFalse(image_save($this->image), t('Function returned the expected value.'));
$this->assertToolkitOperationsCalled(array('save'));
}
@@ -112,83 +112,83 @@ class ImageToolkitUnitTest extends ImageToolkitTestCase {
* Test the image_resize() function.
*/
function testResize() {
- $this->assertTrue(image_resize($this->image, 1, 2), 'Function returned the expected value.');
+ $this->assertTrue(image_resize($this->image, 1, 2), t('Function returned the expected value.'));
$this->assertToolkitOperationsCalled(array('resize'));
// Check the parameters.
$calls = image_test_get_all_calls();
- $this->assertEqual($calls['resize'][0][1], 1, 'Width was passed correctly');
- $this->assertEqual($calls['resize'][0][2], 2, 'Height was passed correctly');
+ $this->assertEqual($calls['resize'][0][1], 1, t('Width was passed correctly'));
+ $this->assertEqual($calls['resize'][0][2], 2, t('Height was passed correctly'));
}
/**
* Test the image_scale() function.
*/
function testScale() {
- // TODO: need to test upscaling
- $this->assertTrue(image_scale($this->image, 10, 10), 'Function returned the expected value.');
+// TODO: need to test upscaling
+ $this->assertTrue(image_scale($this->image, 10, 10), t('Function returned the expected value.'));
$this->assertToolkitOperationsCalled(array('resize'));
// Check the parameters.
$calls = image_test_get_all_calls();
- $this->assertEqual($calls['resize'][0][1], 10, 'Width was passed correctly');
- $this->assertEqual($calls['resize'][0][2], 5, 'Height was based off aspect ratio and passed correctly');
+ $this->assertEqual($calls['resize'][0][1], 10, t('Width was passed correctly'));
+ $this->assertEqual($calls['resize'][0][2], 5, t('Height was based off aspect ratio and passed correctly'));
}
/**
* Test the image_scale_and_crop() function.
*/
function testScaleAndCrop() {
- $this->assertTrue(image_scale_and_crop($this->image, 5, 10), 'Function returned the expected value.');
+ $this->assertTrue(image_scale_and_crop($this->image, 5, 10), t('Function returned the expected value.'));
$this->assertToolkitOperationsCalled(array('resize', 'crop'));
// Check the parameters.
$calls = image_test_get_all_calls();
- $this->assertEqual($calls['crop'][0][1], 7.5, 'X was computed and passed correctly');
- $this->assertEqual($calls['crop'][0][2], 0, 'Y was computed and passed correctly');
- $this->assertEqual($calls['crop'][0][3], 5, 'Width was computed and passed correctly');
- $this->assertEqual($calls['crop'][0][4], 10, 'Height was computed and passed correctly');
+ $this->assertEqual($calls['crop'][0][1], 7.5, t('X was computed and passed correctly'));
+ $this->assertEqual($calls['crop'][0][2], 0, t('Y was computed and passed correctly'));
+ $this->assertEqual($calls['crop'][0][3], 5, t('Width was computed and passed correctly'));
+ $this->assertEqual($calls['crop'][0][4], 10, t('Height was computed and passed correctly'));
}
/**
* Test the image_rotate() function.
*/
function testRotate() {
- $this->assertTrue(image_rotate($this->image, 90, 1), 'Function returned the expected value.');
+ $this->assertTrue(image_rotate($this->image, 90, 1), t('Function returned the expected value.'));
$this->assertToolkitOperationsCalled(array('rotate'));
// Check the parameters.
$calls = image_test_get_all_calls();
- $this->assertEqual($calls['rotate'][0][1], 90, 'Degrees were passed correctly');
- $this->assertEqual($calls['rotate'][0][2], 1, 'Background color was passed correctly');
+ $this->assertEqual($calls['rotate'][0][1], 90, t('Degrees were passed correctly'));
+ $this->assertEqual($calls['rotate'][0][2], 1, t('Background color was passed correctly'));
}
/**
* Test the image_crop() function.
*/
function testCrop() {
- $this->assertTrue(image_crop($this->image, 1, 2, 3, 4), 'Function returned the expected value.');
+ $this->assertTrue(image_crop($this->image, 1, 2, 3, 4), t('Function returned the expected value.'));
$this->assertToolkitOperationsCalled(array('crop'));
// Check the parameters.
$calls = image_test_get_all_calls();
- $this->assertEqual($calls['crop'][0][1], 1, 'X was passed correctly');
- $this->assertEqual($calls['crop'][0][2], 2, 'Y was passed correctly');
- $this->assertEqual($calls['crop'][0][3], 3, 'Width was passed correctly');
- $this->assertEqual($calls['crop'][0][4], 4, 'Height was passed correctly');
+ $this->assertEqual($calls['crop'][0][1], 1, t('X was passed correctly'));
+ $this->assertEqual($calls['crop'][0][2], 2, t('Y was passed correctly'));
+ $this->assertEqual($calls['crop'][0][3], 3, t('Width was passed correctly'));
+ $this->assertEqual($calls['crop'][0][4], 4, t('Height was passed correctly'));
}
/**
* Test the image_desaturate() function.
*/
function testDesaturate() {
- $this->assertTrue(image_desaturate($this->image), 'Function returned the expected value.');
+ $this->assertTrue(image_desaturate($this->image), t('Function returned the expected value.'));
$this->assertToolkitOperationsCalled(array('desaturate'));
// Check the parameters.
$calls = image_test_get_all_calls();
- $this->assertEqual(count($calls['desaturate'][0]), 1, 'Only the image was passed.');
+ $this->assertEqual(count($calls['desaturate'][0]), 1, t('Only the image was passed.'));
}
}
@@ -257,7 +257,7 @@ class ImageToolkitGdTestCase extends DrupalWebTestCase {
function testManipulations() {
// If GD isn't available don't bother testing this.
if (!function_exists('image_gd_check_settings') || !image_gd_check_settings()) {
- $this->pass('Image manipulations for the GD toolkit were skipped because the GD toolkit is not available.');
+ $this->pass(t('Image manipulations for the GD toolkit were skipped because the GD toolkit is not available.'));
return;
}
@@ -385,7 +385,7 @@ class ImageToolkitGdTestCase extends DrupalWebTestCase {
// Load up a fresh image.
$image = image_load(drupal_get_path('module', 'simpletest') . '/files/' . $file, 'gd');
if (!$image) {
- $this->fail('Could not load image ' . $file . '.');
+ $this->fail(t('Could not load image %file.', array('%file' => $file)));
continue 2;
}
@@ -448,11 +448,11 @@ class ImageToolkitGdTestCase extends DrupalWebTestCase {
file_prepare_directory($directory, FILE_CREATE_DIRECTORY);
image_save($image, $directory . '/' . $op . '.' . $image->info['extension']);
- $this->assertTrue($correct_dimensions_real, 'Image ' . $file . ' after ' . $op . ' action has proper dimensions.');
- $this->assertTrue($correct_dimensions_object, 'Image ' . $file . ' object after ' . $op . ' action is reporting the proper height and width values.');
+ $this->assertTrue($correct_dimensions_real, t('Image %file after %action action has proper dimensions.', array('%file' => $file, '%action' => $op)));
+ $this->assertTrue($correct_dimensions_object, t('Image %file object after %action action is reporting the proper height and width values.', array('%file' => $file, '%action' => $op)));
// JPEG colors will always be messed up due to compression.
if ($image->info['extension'] != 'jpg') {
- $this->assertTrue($correct_colors, 'Image ' . $file . ' object after ' . $op . ' action has the correct color placement.');
+ $this->assertTrue($correct_colors, t('Image %file object after %action action has the correct color placement.', array('%file' => $file, '%action' => $op)));
}
}
}
diff --git a/modules/simpletest/tests/lock.test b/modules/simpletest/tests/lock.test
index 815dd6065..d9fc53f75 100644
--- a/modules/simpletest/tests/lock.test
+++ b/modules/simpletest/tests/lock.test
@@ -24,35 +24,35 @@ class LockFunctionalTest extends DrupalWebTestCase {
function testLockAcquire() {
$lock_acquired = 'TRUE: Lock successfully acquired in system_test_lock_acquire()';
$lock_not_acquired = 'FALSE: Lock not acquired in system_test_lock_acquire()';
- $this->assertTrue(lock_acquire('system_test_lock_acquire'), 'Lock acquired by this request.', 'Lock');
- $this->assertTrue(lock_acquire('system_test_lock_acquire'), 'Lock extended by this request.', 'Lock');
+ $this->assertTrue(lock_acquire('system_test_lock_acquire'), t('Lock acquired by this request.'), t('Lock'));
+ $this->assertTrue(lock_acquire('system_test_lock_acquire'), t('Lock extended by this request.'), t('Lock'));
lock_release('system_test_lock_acquire');
// Cause another request to acquire the lock.
$this->drupalGet('system-test/lock-acquire');
- $this->assertText($lock_acquired, 'Lock acquired by the other request.', 'Lock');
+ $this->assertText($lock_acquired, t('Lock acquired by the other request.'), t('Lock'));
// The other request has finished, thus it should have released its lock.
- $this->assertTrue(lock_acquire('system_test_lock_acquire'), 'Lock acquired by this request.', 'Lock');
+ $this->assertTrue(lock_acquire('system_test_lock_acquire'), t('Lock acquired by this request.'), t('Lock'));
// This request holds the lock, so the other request cannot acquire it.
$this->drupalGet('system-test/lock-acquire');
- $this->assertText($lock_not_acquired, 'Lock not acquired by the other request.', 'Lock');
+ $this->assertText($lock_not_acquired, t('Lock not acquired by the other request.'), t('Lock'));
lock_release('system_test_lock_acquire');
// Try a very short timeout and lock breaking.
- $this->assertTrue(lock_acquire('system_test_lock_acquire', 0.5), 'Lock acquired by this request.', 'Lock');
+ $this->assertTrue(lock_acquire('system_test_lock_acquire', 0.5), t('Lock acquired by this request.'), t('Lock'));
sleep(1);
// The other request should break our lock.
$this->drupalGet('system-test/lock-acquire');
- $this->assertText($lock_acquired, 'Lock acquired by the other request, breaking our lock.', 'Lock');
+ $this->assertText($lock_acquired, t('Lock acquired by the other request, breaking our lock.'), t('Lock'));
// We cannot renew it, since the other thread took it.
- $this->assertFalse(lock_acquire('system_test_lock_acquire'), 'Lock cannot be extended by this request.', 'Lock');
+ $this->assertFalse(lock_acquire('system_test_lock_acquire'), t('Lock cannot be extended by this request.'), t('Lock'));
// Check the shut-down function.
$lock_acquired_exit = 'TRUE: Lock successfully acquired in system_test_lock_exit()';
$lock_not_acquired_exit = 'FALSE: Lock not acquired in system_test_lock_exit()';
$this->drupalGet('system-test/lock-exit');
- $this->assertText($lock_acquired_exit, 'Lock acquired by the other request before exit.', 'Lock');
- $this->assertTrue(lock_acquire('system_test_lock_exit'), 'Lock acquired by this request after the other request exits.', 'Lock');
+ $this->assertText($lock_acquired_exit, t('Lock acquired by the other request before exit.'), t('Lock'));
+ $this->assertTrue(lock_acquire('system_test_lock_exit'), t('Lock acquired by this request after the other request exits.'), t('Lock'));
}
}
diff --git a/modules/simpletest/tests/mail.test b/modules/simpletest/tests/mail.test
index c8b586605..48b61c3c7 100644
--- a/modules/simpletest/tests/mail.test
+++ b/modules/simpletest/tests/mail.test
@@ -38,7 +38,7 @@ class MailTestCase extends DrupalWebTestCase implements MailSystemInterface {
$message = drupal_mail('simpletest', 'mail_test', 'testing@drupal.org', $language);
// Assert whether the message was sent through the send function.
- $this->assertEqual(self::$sent_message['to'], 'testing@drupal.org', 'Pluggable mail system is extendable.');
+ $this->assertEqual(self::$sent_message['to'], 'testing@drupal.org', t('Pluggable mail system is extendable.'));
}
/**
diff --git a/modules/simpletest/tests/menu.test b/modules/simpletest/tests/menu.test
index b24daf354..3fd90efc2 100644
--- a/modules/simpletest/tests/menu.test
+++ b/modules/simpletest/tests/menu.test
@@ -30,8 +30,8 @@ class MenuRouterTestCase extends DrupalWebTestCase {
*/
function testTitleCallbackFalse() {
$this->drupalGet('node');
- $this->assertText('A title with @placeholder', 'Raw text found on the page');
- $this->assertNoText(t('A title with @placeholder', array('@placeholder' => 'some other text')), 'Text with placeholder substitutions not found.');
+ $this->assertText('A title with @placeholder', t('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.'));
}
/**
@@ -39,8 +39,8 @@ class MenuRouterTestCase extends DrupalWebTestCase {
*/
function testThemeCallbackAdministrative() {
$this->drupalGet('menu-test/theme-callback/use-admin-theme');
- $this->assertText('Custom theme: seven. Actual theme: seven.', 'The administrative theme can be correctly set in a theme callback.');
- $this->assertRaw('seven/style.css', "The administrative theme's CSS appears on the page.");
+ $this->assertText('Custom theme: seven. Actual theme: seven.', t('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."));
}
/**
@@ -48,8 +48,8 @@ class MenuRouterTestCase extends DrupalWebTestCase {
*/
function testThemeCallbackInheritance() {
$this->drupalGet('menu-test/theme-callback/use-admin-theme/inheritance');
- $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', "The administrative theme's CSS appears on the page.");
+ $this->assertText('Custom theme: seven. Actual theme: seven. Theme callback inheritance is being tested.', t('Theme callback inheritance correctly uses the administrative theme.'));
+ $this->assertRaw('seven/style.css', t("The administrative theme's CSS appears on the page."));
}
/**
@@ -58,7 +58,7 @@ class MenuRouterTestCase extends DrupalWebTestCase {
*/
function testFileInheritance() {
$this->drupalGet('admin/config/development/file-inheritance');
- $this->assertText('File inheritance test description', 'File inheritance works.');
+ $this->assertText('File inheritance test description', t('File inheritance works.'));
}
/**
@@ -81,14 +81,14 @@ class MenuRouterTestCase extends DrupalWebTestCase {
// For a regular user, the fact that the site is in maintenance mode means
// we expect the theme callback system to be bypassed entirely.
$this->drupalGet('menu-test/theme-callback/use-admin-theme');
- $this->assertRaw('garland/style.css', "The maintenance theme's CSS appears on the page.");
+ $this->assertRaw('garland/style.css', t("The maintenance theme's CSS appears on the page."));
// An administrator, however, should continue to see the requested theme.
$admin_user = $this->drupalCreateUser(array('access site in maintenance mode'));
$this->drupalLogin($admin_user);
$this->drupalGet('menu-test/theme-callback/use-admin-theme');
- $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', "The administrative theme's CSS appears on the page.");
+ $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->assertRaw('seven/style.css', t("The administrative theme's CSS appears on the page."));
}
/**
@@ -104,7 +104,7 @@ class MenuRouterTestCase extends DrupalWebTestCase {
$this->drupalGet('node');
$this->assertText($offline_message);
$this->drupalGet('menu_login_callback');
- $this->assertText('This is menu_login_callback().', 'Maintenance mode can be bypassed through hook_login_paths().');
+ $this->assertText('This is menu_login_callback().', t('Maintenance mode can be bypassed through hook_login_paths().'));
}
/**
@@ -117,11 +117,11 @@ class MenuRouterTestCase extends DrupalWebTestCase {
$this->DrupalGet('user/login');
// Check that we got to 'user'.
- $this->assertTrue($this->url == url('user', array('absolute' => TRUE)), "Logged-in user redirected to q=user on accessing q=user/login");
+ $this->assertTrue($this->url == url('user', array('absolute' => TRUE)), t("Logged-in user redirected to q=user on accessing q=user/login"));
// user/register should redirect to user/UID/edit.
$this->DrupalGet('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");
+ $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"));
}
/**
@@ -130,14 +130,14 @@ class MenuRouterTestCase extends DrupalWebTestCase {
function testThemeCallbackOptionalTheme() {
// Request a theme that is not enabled.
$this->drupalGet('menu-test/theme-callback/use-stark-theme');
- $this->assertText('Custom theme: NONE. Actual theme: garland.', 'The theme callback system falls back on the default theme when a theme that is not enabled is requested.');
- $this->assertRaw('garland/style.css', "The default theme's CSS appears on the page.");
+ $this->assertText('Custom theme: NONE. Actual theme: garland.', t('The theme callback system falls back on the default theme when a theme that is not enabled is requested.'));
+ $this->assertRaw('garland/style.css', t("The default theme's CSS appears on the page."));
// Now enable the theme and request it again.
theme_enable(array('stark'));
$this->drupalGet('menu-test/theme-callback/use-stark-theme');
- $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', "The optional theme's CSS appears on the page.");
+ $this->assertText('Custom theme: stark. Actual theme: stark.', t('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."));
}
/**
@@ -145,8 +145,8 @@ class MenuRouterTestCase extends DrupalWebTestCase {
*/
function testThemeCallbackFakeTheme() {
$this->drupalGet('menu-test/theme-callback/use-fake-theme');
- $this->assertText('Custom theme: NONE. Actual theme: garland.', 'The theme callback system falls back on the default theme when a theme that does not exist is requested.');
- $this->assertRaw('garland/style.css', "The default theme's CSS appears on the page.");
+ $this->assertText('Custom theme: NONE. Actual theme: garland.', t('The theme callback system falls back on the default theme when a theme that does not exist is requested.'));
+ $this->assertRaw('garland/style.css', t("The default theme's CSS appears on the page."));
}
/**
@@ -154,8 +154,8 @@ class MenuRouterTestCase extends DrupalWebTestCase {
*/
function testThemeCallbackNoThemeRequested() {
$this->drupalGet('menu-test/theme-callback/no-theme-requested');
- $this->assertText('Custom theme: NONE. Actual theme: garland.', 'The theme callback system falls back on the default theme when no theme is requested.');
- $this->assertRaw('garland/style.css', "The default theme's CSS appears on the page.");
+ $this->assertText('Custom theme: NONE. Actual theme: garland.', t('The theme callback system falls back on the default theme when no theme is requested.'));
+ $this->assertRaw('garland/style.css', t("The default theme's CSS appears on the page."));
}
/**
@@ -170,15 +170,15 @@ class MenuRouterTestCase extends DrupalWebTestCase {
// is not a currently enabled theme, our above request should be ignored,
// and Seven should still be used.
$this->drupalGet('menu-test/theme-callback/use-admin-theme');
- $this->assertText('Custom theme: seven. Actual theme: seven.', 'The result of hook_custom_theme() does not override a theme callback when it returns a theme that is not enabled.');
- $this->assertRaw('seven/style.css', "The Seven theme's CSS appears on the page.");
+ $this->assertText('Custom theme: seven. Actual theme: seven.', t('The result of hook_custom_theme() does not override a theme callback when it returns a theme that is not enabled.'));
+ $this->assertRaw('seven/style.css', t("The Seven theme's CSS appears on the page."));
// Now enable the Stark theme and request the same page as above. This
// time, we expect hook_custom_theme() to prevail.
theme_enable(array('stark'));
$this->drupalGet('menu-test/theme-callback/use-admin-theme');
- $this->assertText('Custom theme: stark. Actual theme: stark.', 'The result of hook_custom_theme() overrides what was set in a theme callback.');
- $this->assertRaw('stark/layout.css', "The Stark theme's CSS appears on the page.");
+ $this->assertText('Custom theme: stark. Actual theme: stark.', t('The result of hook_custom_theme() overrides what was set in a theme callback.'));
+ $this->assertRaw('stark/layout.css', t("The Stark theme's CSS appears on the page."));
}
/**
@@ -212,19 +212,19 @@ class MenuRouterTestCase extends DrupalWebTestCase {
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.
$this->drupalGet('menu_test_maintain/1');
- $this->assertLink(t('Menu link updated'), 0, 'Found updated menu link');
- $this->assertNoLink(t('Menu link #1'), 0, 'Not found menu link #1');
- $this->assertNoLink(t('Menu link #1'), 0, 'Not found menu link #1-1');
- $this->assertLink(t('Menu link #2'), 0, 'Found menu link #2');
+ $this->assertLink(t('Menu link updated'), 0, t('Found updated menu link'));
+ $this->assertNoLink(t('Menu link #1'), 0, t('Not found menu link #1'));
+ $this->assertNoLink(t('Menu link #1'), 0, t('Not found menu link #1-1'));
+ $this->assertLink(t('Menu link #2'), 0, t('Found menu link #2'));
// Delete all links for the given path.
menu_link_maintain('menu_test', 'delete', 'menu_test_maintain/1', '');
// Load a different page to be sure that we have up to date information.
$this->drupalGet('menu_test_maintain/2');
- $this->assertNoLink(t('Menu link updated'), 0, 'Not found deleted menu link');
- $this->assertNoLink(t('Menu link #1'), 0, 'Not found menu link #1');
- $this->assertNoLink(t('Menu link #1'), 0, 'Not found menu link #1-1');
- $this->assertLink(t('Menu link #2'), 0, 'Found menu link #2');
+ $this->assertNoLink(t('Menu link updated'), 0, t('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, t('Not found menu link #1-1'));
+ $this->assertLink(t('Menu link #2'), 0, t('Found menu link #2'));
}
/**
@@ -248,7 +248,7 @@ class MenuRouterTestCase extends DrupalWebTestCase {
$menu_names = menu_get_names();
$this->pass(implode(' | ', $menu_names));
for ($i = 0; $i < 3; $i++) {
- $this->assertTrue(in_array('menu_test_' . $i, $menu_names), 'Expected menu name ' . 'menu_test_' . $i . ' is returned.');
+ $this->assertTrue(in_array('menu_test_' . $i, $menu_names), t('Expected menu name %expected is returned.', array('%expected' => 'menu_test_' . $i)));
}
}
@@ -261,7 +261,7 @@ class MenuRouterTestCase extends DrupalWebTestCase {
$sql = "SELECT menu_name FROM {menu_links} WHERE router_path = 'menu_name_test'";
$name = db_query($sql)->fetchField();
- $this->assertEqual($name, 'original', 'Menu name is "original".');
+ $this->assertEqual($name, 'original', t('Menu name is "original".'));
// Change the menu_name parameter in menu_test.module, then force a menu
// rebuild.
@@ -270,7 +270,7 @@ class MenuRouterTestCase extends DrupalWebTestCase {
$sql = "SELECT menu_name FROM {menu_links} WHERE router_path = 'menu_name_test'";
$name = db_query($sql)->fetchField();
- $this->assertEqual($name, 'changed', 'Menu name was successfully changed after rebuild.');
+ $this->assertEqual($name, 'changed', t('Menu name was successfully changed after rebuild.'));
}
/**
@@ -281,8 +281,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();
$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'], 'The parent of a directly attached child is correct.');
- $this->assertEqual($unattached_child_link['plid'], $parent_link['mlid'], 'The parent of a non-directly attached child is correct.');
+ $this->assertEqual($child_link['plid'], $parent_link['mlid'], t('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.'));
}
/**
@@ -302,40 +302,40 @@ class MenuRouterTestCase extends DrupalWebTestCase {
$plid = $parent['mlid'];
$link = $links['menu-test/hidden/menu/list'];
- $this->assertEqual($link['depth'], $depth, $link['router_path'] . ' depth ' . $link['depth'] . ' is equal to ' . $depth . '.');
- $this->assertEqual($link['plid'], $plid, $link['router_path'] . ' plid ' . $link['plid'] . ' is equal to ' . $plid . '.');
+ $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['plid'], $plid, t('%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'];
- $this->assertEqual($link['depth'], $depth, $link['router_path'] . ' depth ' . $link['depth'] . ' is equal to ' . $depth . '.');
- $this->assertEqual($link['plid'], $plid, $link['router_path'] . ' plid ' . $link['plid'] . ' is equal to ' . $plid . '.');
+ $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['plid'], $plid, t('%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'];
- $this->assertEqual($link['depth'], $depth, $link['router_path'] . ' depth ' . $link['depth'] . ' is equal to ' . $depth . '.');
- $this->assertEqual($link['plid'], $plid, $link['router_path'] . ' plid ' . $link['plid'] . ' is equal to ' . $plid . '.');
+ $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['plid'], $plid, t('%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/%'];
- $this->assertEqual($link['depth'], $depth, $link['router_path'] . ' depth ' . $link['depth'] . ' is equal to ' . $depth . '.');
- $this->assertEqual($link['plid'], $plid, $link['router_path'] . ' plid ' . $link['plid'] . ' is equal to ' . $plid . '.');
+ $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['plid'], $plid, t('%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/%'];
$depth = $parent['depth'] + 1;
$plid = $parent['mlid'];
$link = $links['menu-test/hidden/menu/manage/%/list'];
- $this->assertEqual($link['depth'], $depth, $link['router_path'] . ' depth ' . $link['depth'] . ' is equal to ' . $depth . '.');
- $this->assertEqual($link['plid'], $plid, $link['router_path'] . ' plid ' . $link['plid'] . ' is equal to ' . $plid . '.');
+ $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['plid'], $plid, t('%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'];
- $this->assertEqual($link['depth'], $depth, $link['router_path'] . ' depth ' . $link['depth'] . ' is equal to ' . $depth . '.');
- $this->assertEqual($link['plid'], $plid, $link['router_path'] . ' plid ' . $link['plid'] . ' is equal to ' . $plid . '.');
+ $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['plid'], $plid, t('%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'];
- $this->assertEqual($link['depth'], $depth, $link['router_path'] . ' depth ' . $link['depth'] . ' is equal to ' . $depth . '.');
- $this->assertEqual($link['plid'], $plid, $link['router_path'] . ' plid ' . $link['plid'] . ' is equal to ' . $plid . '.');
+ $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['plid'], $plid, t('%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'];
- $this->assertEqual($link['depth'], $depth, $link['router_path'] . ' depth ' . $link['depth'] . ' is equal to ' . $depth . '.');
- $this->assertEqual($link['plid'], $plid, $link['router_path'] . ' plid ' . $link['plid'] . ' is equal to ' . $plid . '.');
+ $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['plid'], $plid, t('%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.
$links = db_select('menu_links', 'ml')
@@ -350,28 +350,28 @@ class MenuRouterTestCase extends DrupalWebTestCase {
$plid = $parent['mlid'];
$link = $links['menu-test/hidden/block/list'];
- $this->assertEqual($link['depth'], $depth, $link['router_path'] . ' depth ' . $link['depth'] . ' is equal to ' . $depth . '.');
- $this->assertEqual($link['plid'], $plid, $link['router_path'] . ' plid ' . $link['plid'] . ' is equal to ' . $plid . '.');
+ $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['plid'], $plid, t('%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'];
- $this->assertEqual($link['depth'], $depth, $link['router_path'] . ' depth ' . $link['depth'] . ' is equal to ' . $depth . '.');
- $this->assertEqual($link['plid'], $plid, $link['router_path'] . ' plid ' . $link['plid'] . ' is equal to ' . $plid . '.');
+ $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['plid'], $plid, t('%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/%/%'];
- $this->assertEqual($link['depth'], $depth, $link['router_path'] . ' depth ' . $link['depth'] . ' is equal to ' . $depth . '.');
- $this->assertEqual($link['plid'], $plid, $link['router_path'] . ' plid ' . $link['plid'] . ' is equal to ' . $plid . '.');
+ $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['plid'], $plid, t('%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/%/%'];
$depth = $parent['depth'] + 1;
$plid = $parent['mlid'];
$link = $links['menu-test/hidden/block/manage/%/%/configure'];
- $this->assertEqual($link['depth'], $depth, $link['router_path'] . ' depth ' . $link['depth'] . ' is equal to ' . $depth . '.');
- $this->assertEqual($link['plid'], $plid, $link['router_path'] . ' plid ' . $link['plid'] . ' is equal to ' . $plid . '.');
+ $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['plid'], $plid, t('%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'];
- $this->assertEqual($link['depth'], $depth, $link['router_path'] . ' depth ' . $link['depth'] . ' is equal to ' . $depth . '.');
- $this->assertEqual($link['plid'], $plid, $link['router_path'] . ' plid ' . $link['plid'] . ' is equal to ' . $plid . '.');
+ $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['plid'], $plid, t('%path plid @link_plid is equal to @plid.', array('%path' => $link['router_path'], '@link_plid' => $link['plid'], '@plid' => $plid)));
}
/**
@@ -380,7 +380,7 @@ class MenuRouterTestCase extends DrupalWebTestCase {
function testMenuSetItem() {
$item = menu_get_item('node');
- $this->assertEqual($item['path'], 'node', "Path from menu_get_item('node') is equal to 'node'", 'menu');
+ $this->assertEqual($item['path'], 'node', t("Path from menu_get_item('node') is equal to 'node'"), 'menu');
// Modify the path for the item then save it.
$item['path'] = 'node_test';
@@ -388,7 +388,7 @@ class MenuRouterTestCase extends DrupalWebTestCase {
menu_set_item('node', $item);
$compare_item = menu_get_item('node');
- $this->assertEqual($compare_item, $item, 'Modified menu item is equal to newly retrieved menu item.', 'menu');
+ $this->assertEqual($compare_item, $item, t('Modified menu item is equal to newly retrieved menu item.'), 'menu');
}
/**
@@ -397,13 +397,13 @@ class MenuRouterTestCase extends DrupalWebTestCase {
function testMenuItemHooks() {
// Create an item.
menu_link_maintain('menu_test', 'insert', 'menu_test_maintain/4', 'Menu link #4');
- $this->assertEqual(menu_test_static_variable(), 'insert', 'hook_menu_link_insert() fired correctly');
+ $this->assertEqual(menu_test_static_variable(), 'insert', t('hook_menu_link_insert() fired correctly'));
// Update the item.
menu_link_maintain('menu_test', 'update', 'menu_test_maintain/4', 'Menu link updated');
- $this->assertEqual(menu_test_static_variable(), 'update', 'hook_menu_link_update() fired correctly');
+ $this->assertEqual(menu_test_static_variable(), 'update', t('hook_menu_link_update() fired correctly'));
// Delete the item.
menu_link_maintain('menu_test', 'delete', 'menu_test_maintain/4', '');
- $this->assertEqual(menu_test_static_variable(), 'delete', 'hook_menu_link_delete() fired correctly');
+ $this->assertEqual(menu_test_static_variable(), 'delete', t('hook_menu_link_delete() fired correctly'));
}
/**
@@ -428,8 +428,8 @@ class MenuRouterTestCase extends DrupalWebTestCase {
// Load front page.
$this->drupalGet('node');
- $this->assertRaw('title="Test title attribute"', 'Title attribute of a menu link renders.');
- $this->assertRaw('testparam=testvalue', 'Query parameter added to menu link.');
+ $this->assertRaw('title="Test title attribute"', t('Title attribute of a menu link renders.'));
+ $this->assertRaw('testparam=testvalue', t('Query parameter added to menu link.'));
}
}
@@ -451,14 +451,14 @@ class MenuRebuildTestCase extends DrupalWebTestCase {
function testMenuRebuildByVariable() {
// Check if 'admin' path exists.
$admin_exists = db_query('SELECT path from {menu_router} WHERE path = :path', array(':path' => 'admin'))->fetchField();
- $this->assertEqual($admin_exists, 'admin', "The path 'admin/' exists prior to deleting.");
+ $this->assertEqual($admin_exists, 'admin', t("The path 'admin/' exists prior to deleting."));
// Delete the path item 'admin', and test that the path doesn't exist in the database.
$delete = db_delete('menu_router')
->condition('path', 'admin')
->execute();
$admin_exists = db_query('SELECT path from {menu_router} WHERE path = :path', array(':path' => 'admin'))->fetchField();
- $this->assertFalse($admin_exists, "The path 'admin/' has been deleted and doesn't exist in the database.");
+ $this->assertFalse($admin_exists, t("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()
// to rebuild the menu item. Now 'admin' should exist.
@@ -466,7 +466,7 @@ class MenuRebuildTestCase extends DrupalWebTestCase {
// menu_execute_active_handler() should trigger the rebuild.
$this->drupalGet('<front>');
$admin_exists = db_query('SELECT path from {menu_router} WHERE path = :path', array(':path' => 'admin'))->fetchField();
- $this->assertEqual($admin_exists, 'admin', "The menu has been rebuilt, the path 'admin' now exists again.");
+ $this->assertEqual($admin_exists, 'admin', t("The menu has been rebuilt, the path 'admin' now exists again."));
}
}
@@ -501,12 +501,12 @@ class MenuTreeDataTestCase extends DrupalUnitTestCase {
$tree = menu_tree_data($this->links);
// Validate that parent items #1, #2, and #5 exist on the root level.
- $this->assertSameLink($this->links[1], $tree[1]['link'], 'Parent item #1 exists.');
- $this->assertSameLink($this->links[2], $tree[2]['link'], 'Parent item #2 exists.');
- $this->assertSameLink($this->links[5], $tree[5]['link'], 'Parent item #5 exists.');
+ $this->assertSameLink($this->links[1], $tree[1]['link'], t('Parent item #1 exists.'));
+ $this->assertSameLink($this->links[2], $tree[2]['link'], t('Parent item #2 exists.'));
+ $this->assertSameLink($this->links[5], $tree[5]['link'], t('Parent item #5 exists.'));
// 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'], 'Child item #4 exists in the hierarchy.');
+ $this->assertSameLink($this->links[4], $tree[2]['below'][3]['below'][4]['link'], t('Child item #4 exists in the hierarchy.'));
}
/**
diff --git a/modules/simpletest/tests/module.test b/modules/simpletest/tests/module.test
index d3f84ee7d..9246c1484 100644
--- a/modules/simpletest/tests/module.test
+++ b/modules/simpletest/tests/module.test
@@ -77,9 +77,9 @@ class ModuleUnitTest extends DrupalWebTestCase {
*/
protected function assertModuleList(Array $expected_values, $condition) {
$expected_values = array_combine($expected_values, $expected_values);
- $this->assertEqual($expected_values, module_list(), $condition . ': module_list() returns correct results');
+ $this->assertEqual($expected_values, module_list(), t('@condition: module_list() returns correct results', array('@condition' => $condition)));
ksort($expected_values);
- $this->assertIdentical($expected_values, module_list(FALSE, FALSE, TRUE), $condition . ': module_list() returns correctly sorted results');
+ $this->assertIdentical($expected_values, module_list(FALSE, FALSE, TRUE), t('@condition: module_list() returns correctly sorted results', array('@condition' => $condition)));
}
/**
@@ -88,16 +88,16 @@ class ModuleUnitTest extends DrupalWebTestCase {
function testModuleImplements() {
// Clear the cache.
cache_clear_all('module_implements', 'cache_bootstrap');
- $this->assertFalse(cache_get('module_implements', 'cache_bootstrap'), 'The module implements cache is empty.');
+ $this->assertFalse(cache_get('module_implements', 'cache_bootstrap'), t('The module implements cache is empty.'));
$this->drupalGet('');
- $this->assertTrue(cache_get('module_implements', 'cache_bootstrap'), 'The module implements cache is populated after requesting a page.');
+ $this->assertTrue(cache_get('module_implements', 'cache_bootstrap'), t('The module implements cache is populated after requesting a page.'));
// Test again with an authenticated user.
$this->user = $this->drupalCreateUser();
$this->drupalLogin($this->user);
cache_clear_all('module_implements', 'cache_bootstrap');
$this->drupalGet('');
- $this->assertTrue(cache_get('module_implements', 'cache_bootstrap'), 'The module implements cache is populated after requesting a page.');
+ $this->assertTrue(cache_get('module_implements', 'cache_bootstrap'), t('The module implements cache is populated after requesting a page.'));
// Make sure group include files are detected properly even when the file is
// already loaded when the cache is rebuilt.
@@ -116,23 +116,23 @@ class ModuleUnitTest extends DrupalWebTestCase {
*/
function testDependencyResolution() {
module_enable(array('module_test'), FALSE);
- $this->assertTrue(module_exists('module_test'), 'Test module is enabled.');
+ $this->assertTrue(module_exists('module_test'), t('Test module is enabled.'));
// First, create a fake missing dependency. Forum depends on poll, which
// depends on a made-up module, foo. Nothing should be installed.
variable_set('dependency_test', 'missing dependency');
$result = module_enable(array('forum'));
- $this->assertFalse($result, 'module_enable() returns FALSE if dependencies are missing.');
- $this->assertFalse(module_exists('forum'), 'module_enable() aborts if dependencies are missing.');
+ $this->assertFalse($result, t('module_enable() returns FALSE if dependencies are missing.'));
+ $this->assertFalse(module_exists('forum'), t('module_enable() aborts if dependencies are missing.'));
// Now, fix the missing dependency. module_enable() should work.
variable_set('dependency_test', 'dependency');
$result = module_enable(array('forum'));
- $this->assertTrue($result, 'module_enable() returns the correct value.');
+ $this->assertTrue($result, t('module_enable() returns the correct value.'));
// Verify that the fake dependency chain was installed.
- $this->assertTrue(module_exists('poll') && module_exists('php'), 'Dependency chain was installed by module_enable().');
+ $this->assertTrue(module_exists('poll') && module_exists('php'), t('Dependency chain was installed by module_enable().'));
// Finally, verify that the original module was installed.
- $this->assertTrue(module_exists('forum'), 'Module installation with unlisted dependencies succeeded.');
+ $this->assertTrue(module_exists('forum'), t('Module installation with unlisted dependencies succeeded.'));
}
}
@@ -168,8 +168,8 @@ class ModuleInstallTestCase extends DrupalWebTestCase {
// Check for data that was inserted using drupal_write_record() while the
// 'module_test' module was being installed and enabled.
$data = db_query("SELECT data FROM {module_test}")->fetchCol();
- $this->assertTrue(in_array('Data inserted in hook_install()', $data), 'Data inserted using drupal_write_record() in hook_install() is correctly saved.');
- $this->assertTrue(in_array('Data inserted in hook_enable()', $data), 'Data inserted using drupal_write_record() in hook_enable() is correctly saved.');
+ $this->assertTrue(in_array('Data inserted in hook_install()', $data), t('Data inserted using drupal_write_record() in hook_install() is correctly saved.'));
+ $this->assertTrue(in_array('Data inserted in hook_enable()', $data), t('Data inserted using drupal_write_record() in hook_enable() is correctly saved.'));
}
}
@@ -200,6 +200,6 @@ class ModuleUninstallTestCase extends DrupalWebTestCase {
// Are the perms defined by module_test removed from {role_permission}.
$count = db_query("SELECT COUNT(rid) FROM {role_permission} WHERE permission = :perm", array(':perm' => 'module_test perm'))->fetchField();
- $this->assertEqual(0, $count, 'Permissions were all removed.');
+ $this->assertEqual(0, $count, t('Permissions were all removed.'));
}
}
diff --git a/modules/simpletest/tests/path.test b/modules/simpletest/tests/path.test
index ea3c0a1d7..f99585691 100644
--- a/modules/simpletest/tests/path.test
+++ b/modules/simpletest/tests/path.test
@@ -42,7 +42,7 @@ class DrupalMatchPathTestCase extends DrupalWebTestCase {
foreach ($tests as $patterns => $cases) {
foreach ($cases as $path => $expected_result) {
$actual_result = drupal_match_path($path, $patterns);
- $this->assertIdentical($actual_result, $expected_result, 'Tried matching the path <code>' . $path . '</code> to the pattern <pre>' . $patterns . '</pre> - expected ' . var_export($expected_result, TRUE) . ', got ' . var_export($actual_result, TRUE) . '.');
+ $this->assertIdentical($actual_result, $expected_result, t('Tried matching the path <code>@path</code> to the pattern <pre>@patterns</pre> - expected @expected, got @actual.', array('@path' => $path, '@patterns' => $patterns, '@expected' => var_export($expected_result, TRUE), '@actual' => var_export($actual_result, TRUE))));
}
}
}
@@ -197,8 +197,8 @@ class UrlAlterFunctionalTest extends DrupalWebTestCase {
*/
function testCurrentUrlRequestedPath() {
$this->drupalGet('url-alter-test/bar');
- $this->assertRaw('request_path=url-alter-test/bar', 'request_path() returns the requested path.');
- $this->assertRaw('current_path=url-alter-test/foo', 'current_path() returns the internal path.');
+ $this->assertRaw('request_path=url-alter-test/bar', t('request_path() returns the requested path.'));
+ $this->assertRaw('current_path=url-alter-test/foo', t('current_path() returns the internal path.'));
}
/**
@@ -216,7 +216,7 @@ class UrlAlterFunctionalTest extends DrupalWebTestCase {
$result = url($original);
$base_path = base_path() . (variable_get('clean_url', '0') ? '' : '?q=');
$result = substr($result, strlen($base_path));
- $this->assertIdentical($result, $final, 'Altered outbound URL ' . $original . ', expected ' . $final . ', and got ' . $result . '.');
+ $this->assertIdentical($result, $final, t('Altered outbound URL %original, expected %final, and got %result.', array('%original' => $original, '%final' => $final, '%result' => $result)));
}
/**
@@ -233,6 +233,6 @@ class UrlAlterFunctionalTest extends DrupalWebTestCase {
protected function assertUrlInboundAlter($original, $final) {
// Test inbound altering.
$result = drupal_get_normal_path($original);
- $this->assertIdentical($result, $final, 'Altered inbound URL ' . $original . ', expected ' . $final . ', and got ' . $result . '.');
+ $this->assertIdentical($result, $final, t('Altered inbound URL %original, expected %final, and got %result.', array('%original' => $original, '%final' => $final, '%result' => $result)));
}
}
diff --git a/modules/simpletest/tests/registry.test b/modules/simpletest/tests/registry.test
index 0afe5e3aa..10b04578d 100644
--- a/modules/simpletest/tests/registry.test
+++ b/modules/simpletest/tests/registry.test
@@ -25,7 +25,7 @@ class RegistryParseFileTestCase extends DrupalWebTestCase {
_registry_parse_file($this->fileName, $this->getFileContents());
foreach (array('className', 'interfaceName') as $resource) {
$foundName = db_query('SELECT name FROM {registry} WHERE name = :name', array(':name' => $this->$resource))->fetchField();
- $this->assertTrue($this->$resource == $foundName, 'Resource "' . $this->$resource . '" found.');
+ $this->assertTrue($this->$resource == $foundName, t('Resource "@resource" found.', array('@resource' => $this->$resource)));
}
}
@@ -103,11 +103,11 @@ class RegistryParseFilesTestCase extends DrupalWebTestCase {
// Test that we have all the right resources.
foreach (array('className', 'interfaceName') as $resource) {
$foundName = db_query('SELECT name FROM {registry} WHERE name = :name', array(':name' => $this->$fileType->$resource))->fetchField();
- $this->assertTrue($this->$fileType->$resource == $foundName, 'Resource "' . $this->$fileType->$resource . '" found.');
+ $this->assertTrue($this->$fileType->$resource == $foundName, t('Resource "@resource" found.', array('@resource' => $this->$fileType->$resource)));
}
// Test that we have the right hash.
$hash = db_query('SELECT hash FROM {registry_file} WHERE filename = :filename', array(':filename' => $this->$fileType->fileName))->fetchField();
- $this->assertTrue(hash('sha256', $this->$fileType->contents) == $hash, 'sha-256 for "' . $this->$fileType->fileName . '" matched.' . $fileType . $hash);
+ $this->assertTrue(hash('sha256', $this->$fileType->contents) == $hash, t('sha-256 for "@filename" matched.' . $fileType . $hash, array('@filename' => $this->$fileType->fileName)));
}
}
diff --git a/modules/simpletest/tests/schema.test b/modules/simpletest/tests/schema.test
index 65cdf2ce5..53e8ea723 100644
--- a/modules/simpletest/tests/schema.test
+++ b/modules/simpletest/tests/schema.test
@@ -40,7 +40,7 @@ class SchemaTestCase extends DrupalWebTestCase {
db_create_table('test_table', $table_specification);
// Assert that the table exists.
- $this->assertTrue(db_table_exists('test_table'), 'The table exists.');
+ $this->assertTrue(db_table_exists('test_table'), t('The table exists.'));
// Assert that the table comment has been set.
$this->checkSchemaComment($table_specification['description'], 'test_table');
@@ -49,46 +49,46 @@ class SchemaTestCase extends DrupalWebTestCase {
$this->checkSchemaComment($table_specification['fields']['test_field']['description'], 'test_table', 'test_field');
// An insert without a value for the column 'test_table' should fail.
- $this->assertFalse($this->tryInsert(), 'Insert without a default failed.');
+ $this->assertFalse($this->tryInsert(), t('Insert without a default failed.'));
// Add a default value to the column.
db_field_set_default('test_table', 'test_field', 0);
// The insert should now succeed.
- $this->assertTrue($this->tryInsert(), 'Insert with a default succeeded.');
+ $this->assertTrue($this->tryInsert(), t('Insert with a default succeeded.'));
// Remove the default.
db_field_set_no_default('test_table', 'test_field');
// The insert should fail again.
- $this->assertFalse($this->tryInsert(), 'Insert without a default failed.');
+ $this->assertFalse($this->tryInsert(), t('Insert without a default failed.'));
// Test for fake index and test for the boolean result of indexExists().
$index_exists = Database::getConnection()->schema()->indexExists('test_table', 'test_field');
- $this->assertIdentical($index_exists, FALSE, 'Fake index does not exists');
+ $this->assertIdentical($index_exists, FALSE, t('Fake index does not exists'));
// Add index.
db_add_index('test_table', 'test_field', array('test_field'));
// Test for created index and test for the boolean result of indexExists().
$index_exists = Database::getConnection()->schema()->indexExists('test_table', 'test_field');
- $this->assertIdentical($index_exists, TRUE, 'Index created.');
+ $this->assertIdentical($index_exists, TRUE, t('Index created.'));
// Rename the table.
db_rename_table('test_table', 'test_table2');
// Index should be renamed.
$index_exists = Database::getConnection()->schema()->indexExists('test_table2', 'test_field');
- $this->assertTrue($index_exists, 'Index was renamed.');
+ $this->assertTrue($index_exists, t('Index was renamed.'));
// We need the default so that we can insert after the rename.
db_field_set_default('test_table2', 'test_field', 0);
- $this->assertFalse($this->tryInsert(), 'Insert into the old table failed.');
- $this->assertTrue($this->tryInsert('test_table2'), 'Insert into the new table succeeded.');
+ $this->assertFalse($this->tryInsert(), t('Insert into the old table failed.'));
+ $this->assertTrue($this->tryInsert('test_table2'), t('Insert into the new table succeeded.'));
// We should have successfully inserted exactly two rows.
$count = db_query('SELECT COUNT(*) FROM {test_table2}')->fetchField();
- $this->assertEqual($count, 2, 'Two fields were successfully inserted.');
+ $this->assertEqual($count, 2, t('Two fields were successfully inserted.'));
// Try to drop the table.
db_drop_table('test_table2');
- $this->assertFalse(db_table_exists('test_table2'), 'The dropped table does not exist.');
+ $this->assertFalse(db_table_exists('test_table2'), t('The dropped table does not exist.'));
// Recreate the table.
db_create_table('test_table', $table_specification);
@@ -104,19 +104,19 @@ class SchemaTestCase extends DrupalWebTestCase {
// Assert that the column comment has been set.
$this->checkSchemaComment('Changed column description.', 'test_table', 'test_serial');
- $this->assertTrue($this->tryInsert(), 'Insert with a serial succeeded.');
+ $this->assertTrue($this->tryInsert(), t('Insert with a serial succeeded.'));
$max1 = db_query('SELECT MAX(test_serial) FROM {test_table}')->fetchField();
- $this->assertTrue($this->tryInsert(), 'Insert with a serial succeeded.');
+ $this->assertTrue($this->tryInsert(), t('Insert with a serial succeeded.'));
$max2 = db_query('SELECT MAX(test_serial) FROM {test_table}')->fetchField();
- $this->assertTrue($max2 > $max1, 'The serial is monotone.');
+ $this->assertTrue($max2 > $max1, t('The serial is monotone.'));
$count = db_query('SELECT COUNT(*) FROM {test_table}')->fetchField();
- $this->assertEqual($count, 2, 'There were two rows.');
+ $this->assertEqual($count, 2, t('There were two rows.'));
}
function tryInsert($table = 'test_table') {
try {
- db_insert($table)
+ db_insert($table)
->fields(array('id' => mt_rand(10, 20)))
->execute();
return TRUE;
@@ -139,7 +139,7 @@ class SchemaTestCase extends DrupalWebTestCase {
function checkSchemaComment($description, $table, $column = NULL) {
if (method_exists(Database::getConnection()->schema(), 'getComment')) {
$comment = Database::getConnection()->schema()->getComment($table, $column);
- $this->assertEqual($comment, $description, 'The comment matches the schema description.');
+ $this->assertEqual($comment, $description, t('The comment matches the schema description.'));
}
}
@@ -159,7 +159,7 @@ class SchemaTestCase extends DrupalWebTestCase {
// Now set up columns for the other types.
$types = array('int', 'float', 'numeric');
foreach ($types as $type) {
- $column_spec = array('type' => $type, 'unsigned' => TRUE);
+ $column_spec = array('type' => $type, 'unsigned'=> TRUE);
if ($type == 'numeric') {
$column_spec += array('precision' => 10, 'scale' => 0);
}
@@ -169,9 +169,9 @@ class SchemaTestCase extends DrupalWebTestCase {
}
// Finally, check each column and try to insert invalid values into them.
- foreach ($table_spec['fields'] as $column_name => $column_spec) {
- $this->assertTrue(db_field_exists($table_name, $column_name), 'Unsigned ' . $column_spec['type'] . ' column was created.');
- $this->assertFalse($this->tryUnsignedInsert($table_name, $column_name), 'Unsigned ' . $column_spec['type'] . ' column rejected a negative value.');
+ foreach($table_spec['fields'] as $column_name => $column_spec) {
+ $this->assertTrue(db_field_exists($table_name, $column_name), t('Unsigned @type column was created.', array('@type' => $column_spec['type'])));
+ $this->assertFalse($this->tryUnsignedInsert($table_name, $column_name), t('Unsigned @type column rejected a negative value.', array('@type' => $column_spec['type'])));
}
}
diff --git a/modules/simpletest/tests/session.test b/modules/simpletest/tests/session.test
index 9b899a15d..600843bb8 100644
--- a/modules/simpletest/tests/session.test
+++ b/modules/simpletest/tests/session.test
@@ -23,11 +23,11 @@ class SessionTestCase extends DrupalWebTestCase {
* Tests for drupal_save_session() and drupal_session_regenerate().
*/
function testSessionSaveRegenerate() {
- $this->assertFalse(drupal_save_session(), 'drupal_save_session() correctly returns FALSE (inside of testing framework) when initially called with no arguments.', 'Session');
- $this->assertFalse(drupal_save_session(FALSE), 'drupal_save_session() correctly returns FALSE when called with FALSE.', 'Session');
- $this->assertFalse(drupal_save_session(), 'drupal_save_session() correctly returns FALSE when saving has been disabled.', 'Session');
- $this->assertTrue(drupal_save_session(TRUE), 'drupal_save_session() correctly returns TRUE when called with TRUE.', 'Session');
- $this->assertTrue(drupal_save_session(), 'drupal_save_session() correctly returns TRUE when saving has been enabled.', 'Session');
+ $this->assertFalse(drupal_save_session(), t('drupal_save_session() correctly returns FALSE (inside of testing framework) when initially called with no arguments.'), t('Session'));
+ $this->assertFalse(drupal_save_session(FALSE), t('drupal_save_session() correctly returns FALSE when called with FALSE.'), t('Session'));
+ $this->assertFalse(drupal_save_session(), t('drupal_save_session() correctly returns FALSE when saving has been disabled.'), t('Session'));
+ $this->assertTrue(drupal_save_session(TRUE), t('drupal_save_session() correctly returns TRUE when called with TRUE.'), t('Session'));
+ $this->assertTrue(drupal_save_session(), t('drupal_save_session() correctly returns TRUE when saving has been enabled.'), t('Session'));
// Test session hardening code from SA-2008-044.
$user = $this->drupalCreateUser(array('access content'));
@@ -37,7 +37,7 @@ class SessionTestCase extends DrupalWebTestCase {
// Make sure the session cookie is set as HttpOnly.
$this->drupalLogin($user);
- $this->assertTrue(preg_match('/HttpOnly/i', $this->drupalGetHeader('Set-Cookie', TRUE)), 'Session cookie is set as HttpOnly.');
+ $this->assertTrue(preg_match('/HttpOnly/i', $this->drupalGetHeader('Set-Cookie', TRUE)), t('Session cookie is set as HttpOnly.'));
$this->drupalLogout();
// Verify that the session is regenerated if a module calls exit
@@ -47,7 +47,7 @@ class SessionTestCase extends DrupalWebTestCase {
$this->drupalGet('session-test/id');
$matches = array();
preg_match('/\s*session_id:(.*)\n/', $this->drupalGetContent(), $matches);
- $this->assertTrue(!empty($matches[1]), 'Found session ID before logging in.');
+ $this->assertTrue(!empty($matches[1]) , t('Found session ID before logging in.'));
$original_session = $matches[1];
// We cannot use $this->drupalLogin($user); because we exit in
@@ -58,14 +58,14 @@ class SessionTestCase extends DrupalWebTestCase {
);
$this->drupalPost('user', $edit, t('Log in'));
$this->drupalGet('user');
- $pass = $this->assertText($user->name, 'Found name: ' . $user->name, 'User login');
+ $pass = $this->assertText($user->name, t('Found name: %name', array('%name' => $user->name)), t('User login'));
$this->_logged_in = $pass;
$this->drupalGet('session-test/id');
$matches = array();
preg_match('/\s*session_id:(.*)\n/', $this->drupalGetContent(), $matches);
- $this->assertTrue(!empty($matches[1]), 'Found session ID after logging in.');
- $this->assertTrue($matches[1] != $original_session, 'Session ID changed after login.');
+ $this->assertTrue(!empty($matches[1]) , t('Found session ID after logging in.'));
+ $this->assertTrue($matches[1] != $original_session, t('Session ID changed after login.'));
}
/**
@@ -81,48 +81,48 @@ class SessionTestCase extends DrupalWebTestCase {
$value_1 = $this->randomName();
$this->drupalGet('session-test/set/' . $value_1);
- $this->assertText($value_1, 'The session value was stored.', 'Session');
+ $this->assertText($value_1, t('The session value was stored.'), t('Session'));
$this->drupalGet('session-test/get');
- $this->assertText($value_1, 'Session correctly returned the stored data for an authenticated user.', 'Session');
+ $this->assertText($value_1, t('Session correctly returned the stored data for an authenticated user.'), t('Session'));
// Attempt to write over val_1. If drupal_save_session(FALSE) is working.
// properly, val_1 will still be set.
$value_2 = $this->randomName();
$this->drupalGet('session-test/no-set/' . $value_2);
- $this->assertText($value_2, 'The session value was correctly passed to session-test/no-set.', 'Session');
+ $this->assertText($value_2, t('The session value was correctly passed to session-test/no-set.'), t('Session'));
$this->drupalGet('session-test/get');
- $this->assertText($value_1, 'Session data is not saved for drupal_save_session(FALSE).', 'Session');
+ $this->assertText($value_1, t('Session data is not saved for drupal_save_session(FALSE).'), t('Session'));
// Switch browser cookie to anonymous user, then back to user 1.
$this->sessionReset();
$this->sessionReset($user->uid);
- $this->assertText($value_1, 'Session data persists through browser close.', 'Session');
+ $this->assertText($value_1, t('Session data persists through browser close.'), t('Session'));
// Logout the user and make sure the stored value no longer persists.
$this->drupalLogout();
$this->sessionReset();
$this->drupalGet('session-test/get');
- $this->assertNoText($value_1, "After logout, previous user's session data is not available.", 'Session');
+ $this->assertNoText($value_1, t("After logout, previous user's session data is not available."), t('Session'));
// Now try to store some data as an anonymous user.
$value_3 = $this->randomName();
$this->drupalGet('session-test/set/' . $value_3);
- $this->assertText($value_3, 'Session data stored for anonymous user.', 'Session');
+ $this->assertText($value_3, t('Session data stored for anonymous user.'), t('Session'));
$this->drupalGet('session-test/get');
- $this->assertText($value_3, 'Session correctly returned the stored data for an anonymous user.', 'Session');
+ $this->assertText($value_3, t('Session correctly returned the stored data for an anonymous user.'), t('Session'));
// Try to store data when drupal_save_session(FALSE).
$value_4 = $this->randomName();
$this->drupalGet('session-test/no-set/' . $value_4);
- $this->assertText($value_4, 'The session value was correctly passed to session-test/no-set.', 'Session');
+ $this->assertText($value_4, t('The session value was correctly passed to session-test/no-set.'), t('Session'));
$this->drupalGet('session-test/get');
- $this->assertText($value_3, 'Session data is not saved for drupal_save_session(FALSE).', 'Session');
+ $this->assertText($value_3, t('Session data is not saved for drupal_save_session(FALSE).'), t('Session'));
// Login, the data should persist.
$this->drupalLogin($user);
$this->sessionReset($user->uid);
$this->drupalGet('session-test/get');
- $this->assertNoText($value_1, 'Session has persisted for an authenticated user after logging out and then back in.', 'Session');
+ $this->assertNoText($value_1, t('Session has persisted for an authenticated user after logging out and then back in.'), t('Session'));
// Change session and create another user.
$user2 = $this->drupalCreateUser(array('access content'));
@@ -144,29 +144,29 @@ class SessionTestCase extends DrupalWebTestCase {
$this->drupalGet('');
$this->assertSessionCookie(FALSE);
$this->assertSessionEmpty(TRUE);
- $this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'MISS', 'Page was not cached.');
+ $this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'MISS', t('Page was not cached.'));
// Start a new session by setting a message.
$this->drupalGet('session-test/set-message');
$this->assertSessionCookie(TRUE);
- $this->assertTrue($this->drupalGetHeader('Set-Cookie'), 'New session was started.');
+ $this->assertTrue($this->drupalGetHeader('Set-Cookie'), t('New session was started.'));
// Display the message, during the same request the session is destroyed
// and the session cookie is unset.
$this->drupalGet('');
$this->assertSessionCookie(FALSE);
$this->assertSessionEmpty(FALSE);
- $this->assertFalse($this->drupalGetHeader('X-Drupal-Cache'), 'Caching was bypassed.');
- $this->assertText(t('This is a dummy message.'), 'Message was displayed.');
- $this->assertTrue(preg_match('/SESS\w+=deleted/', $this->drupalGetHeader('Set-Cookie')), 'Session cookie was deleted.');
+ $this->assertFalse($this->drupalGetHeader('X-Drupal-Cache'), t('Caching was bypassed.'));
+ $this->assertText(t('This is a dummy message.'), t('Message was displayed.'));
+ $this->assertTrue(preg_match('/SESS\w+=deleted/', $this->drupalGetHeader('Set-Cookie')), t('Session cookie was deleted.'));
// Verify that session was destroyed.
$this->drupalGet('');
$this->assertSessionCookie(FALSE);
$this->assertSessionEmpty(TRUE);
- $this->assertNoText(t('This is a dummy message.'), 'Message was not cached.');
- $this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'HIT', 'Page was cached.');
- $this->assertFalse($this->drupalGetHeader('Set-Cookie'), 'New session was not started.');
+ $this->assertNoText(t('This is a dummy message.'), t('Message was not cached.'));
+ $this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'HIT', t('Page was cached.'));
+ $this->assertFalse($this->drupalGetHeader('Set-Cookie'), t('New session was not started.'));
// Verify that no session is created if drupal_save_session(FALSE) is called.
$this->drupalGet('session-test/set-message-but-dont-save');
@@ -177,7 +177,7 @@ class SessionTestCase extends DrupalWebTestCase {
$this->drupalGet('');
$this->assertSessionCookie(FALSE);
$this->assertSessionEmpty(TRUE);
- $this->assertNoText(t('This is a dummy message.'), 'The message was not saved.');
+ $this->assertNoText(t('This is a dummy message.'), t('The message was not saved.'));
}
/**
@@ -195,7 +195,7 @@ class SessionTestCase extends DrupalWebTestCase {
$this->additionalCurlOptions[CURLOPT_COOKIEFILE] = $this->cookieFile;
$this->additionalCurlOptions[CURLOPT_COOKIESESSION] = TRUE;
$this->drupalGet('session-test/get');
- $this->assertResponse(200, 'Session test module is correctly enabled.', 'Session');
+ $this->assertResponse(200, t('Session test module is correctly enabled.'), t('Session'));
}
/**
@@ -203,10 +203,10 @@ class SessionTestCase extends DrupalWebTestCase {
*/
function assertSessionCookie($sent) {
if ($sent) {
- $this->assertNotNull($this->session_id, 'Session cookie was sent.');
+ $this->assertNotNull($this->session_id, t('Session cookie was sent.'));
}
else {
- $this->assertNull($this->session_id, 'Session cookie was not sent.');
+ $this->assertNull($this->session_id, t('Session cookie was not sent.'));
}
}
@@ -215,10 +215,10 @@ class SessionTestCase extends DrupalWebTestCase {
*/
function assertSessionEmpty($empty) {
if ($empty) {
- $this->assertIdentical($this->drupalGetHeader('X-Session-Empty'), '1', 'Session was empty.');
+ $this->assertIdentical($this->drupalGetHeader('X-Session-Empty'), '1', t('Session was empty.'));
}
else {
- $this->assertIdentical($this->drupalGetHeader('X-Session-Empty'), '0', 'Session was not empty.');
+ $this->assertIdentical($this->drupalGetHeader('X-Session-Empty'), '0', t('Session was not empty.'));
}
}
}
@@ -366,7 +366,7 @@ class SessionHttpsTestCase extends DrupalWebTestCase {
}
}
- // Test that session data saved before login is not available using the
+ // Test that session data saved before login is not available using the
// pre-login anonymous cookie.
$this->cookies = array();
$this->drupalGet('session-test/get', array('Cookie: ' . $anonymous_cookie));
diff --git a/modules/simpletest/tests/theme.test b/modules/simpletest/tests/theme.test
index c44495d75..1f6373723 100644
--- a/modules/simpletest/tests/theme.test
+++ b/modules/simpletest/tests/theme.test
@@ -32,25 +32,25 @@ class ThemeUnitTest extends DrupalWebTestCase {
variable_set('site_frontpage', 'nobody-home');
$args = array('node', '1', 'edit');
$suggestions = theme_get_suggestions($args, 'page');
- $this->assertEqual($suggestions, array('page__node', 'page__node__%', 'page__node__1', 'page__node__edit'), 'Found expected node edit page suggestions');
+ $this->assertEqual($suggestions, array('page__node', 'page__node__%', 'page__node__1', 'page__node__edit'), t('Found expected node edit page suggestions'));
// Check attack vectors.
$args = array('node', '\\1');
$suggestions = theme_get_suggestions($args, 'page');
- $this->assertEqual($suggestions, array('page__node', 'page__node__%', 'page__node__1'), 'Removed invalid \\ from suggestions');
+ $this->assertEqual($suggestions, array('page__node', 'page__node__%', 'page__node__1'), t('Removed invalid \\ from suggestions'));
$args = array('node', '1/');
$suggestions = theme_get_suggestions($args, 'page');
- $this->assertEqual($suggestions, array('page__node', 'page__node__%', 'page__node__1'), 'Removed invalid / from suggestions');
+ $this->assertEqual($suggestions, array('page__node', 'page__node__%', 'page__node__1'), t('Removed invalid / from suggestions'));
$args = array('node', "1\0");
$suggestions = theme_get_suggestions($args, 'page');
- $this->assertEqual($suggestions, array('page__node', 'page__node__%', 'page__node__1'), 'Removed invalid \\0 from suggestions');
+ $this->assertEqual($suggestions, array('page__node', 'page__node__%', 'page__node__1'), t('Removed invalid \\0 from suggestions'));
}
/**
- * Preprocess functions for the base hook should run even for suggestion implementations.
- */
+ * Preprocess functions for the base hook should run even for suggestion implementations.
+ */
function testPreprocessForSuggestions() {
$this->drupalGet('theme-test/suggestion');
- $this->assertText('test_theme_breadcrumb__suggestion: 1', 'Theme hook suggestion ran with data available from a preprocess function for the base hook.');
+ $this->assertText('test_theme_breadcrumb__suggestion: 1', t('Theme hook suggestion ran with data available from a preprocess function for the base hook.'));
}
/**
@@ -64,7 +64,7 @@ class ThemeUnitTest extends DrupalWebTestCase {
$suggestions = theme_get_suggestions(explode('/', $_GET['q']), 'page');
// Set it back to not annoy the batch runner.
$_GET['q'] = $q;
- $this->assertTrue(in_array('page__front', $suggestions), 'Front page template was suggested.');
+ $this->assertTrue(in_array('page__front', $suggestions), t('Front page template was suggested.'));
}
}
@@ -85,11 +85,11 @@ class ThemeTableUnitTest extends DrupalWebTestCase {
*/
function testThemeTableStickyHeaders() {
$header = array('one', 'two', 'three');
- $rows = array(array(1, 2, 3), array(4, 5, 6), array(7, 8, 9));
+ $rows = array(array(1,2,3), array(4,5,6), array(7,8,9));
$this->content = theme('table', array('header' => $header, 'rows' => $rows));
$js = drupal_add_js();
- $this->assertTrue(isset($js['misc/tableheader.js']), 'tableheader.js was included when $sticky = TRUE.');
- $this->assertRaw('sticky-enabled', 'Table has a class of sticky-enabled when $sticky = TRUE.');
+ $this->assertTrue(isset($js['misc/tableheader.js']), t('tableheader.js was included when $sticky = TRUE.'));
+ $this->assertRaw('sticky-enabled', t('Table has a class of sticky-enabled when $sticky = TRUE.'));
drupal_static_reset('drupal_add_js');
}
@@ -98,14 +98,14 @@ class ThemeTableUnitTest extends DrupalWebTestCase {
*/
function testThemeTableNoStickyHeaders() {
$header = array('one', 'two', 'three');
- $rows = array(array(1, 2, 3), array(4, 5, 6), array(7, 8, 9));
+ $rows = array(array(1,2,3), array(4,5,6), array(7,8,9));
$attributes = array();
$caption = NULL;
$colgroups = array();
$this->content = theme('table', array('header' => $header, 'rows' => $rows, 'attributes' => $attributes, 'caption' => $caption, 'colgroups' => $colgroups, 'sticky' => FALSE));
$js = drupal_add_js();
- $this->assertFalse(isset($js['misc/tableheader.js']), 'tableheader.js was not included because $sticky = FALSE.');
- $this->assertNoRaw('sticky-enabled', 'Table does not have a class of sticky-enabled because $sticky = FALSE.');
+ $this->assertFalse(isset($js['misc/tableheader.js']), t('tableheader.js was not included because $sticky = FALSE.'));
+ $this->assertNoRaw('sticky-enabled', t('Table does not have a class of sticky-enabled because $sticky = FALSE.'));
drupal_static_reset('drupal_add_js');
}
@@ -122,8 +122,8 @@ class ThemeTableUnitTest extends DrupalWebTestCase {
),
);
$this->content = theme('table', array('header' => $header, 'rows' => array(), 'empty' => t('No strings available.')));
- $this->assertRaw('<tr class="odd"><td colspan="3" class="empty message">No strings available.</td>', 'Correct colspan was set on empty message.');
- $this->assertRaw('<thead><tr><th>Header 1</th>', 'Table header was printed.');
+ $this->assertRaw('<tr class="odd"><td colspan="3" class="empty message">No strings available.</td>', t('Correct colspan was set on empty message.'));
+ $this->assertRaw('<thead><tr><th>Header 1</th>', t('Table header was printed.'));
}
}
@@ -178,7 +178,7 @@ class ThemeHookInitUnitTest extends DrupalWebTestCase {
*/
function testThemeInitializationHookInit() {
$this->drupalGet('theme-test/hook-init');
- $this->assertRaw('Themed output generated in hook_init()', 'Themed output generated in hook_init() correctly appears on the page.');
- $this->assertRaw('garland/style.css', "The default theme's CSS appears on the page when the theme system is initialized in hook_init().");
+ $this->assertRaw('Themed output generated in hook_init()', t('Themed output generated in hook_init() correctly appears on the page.'));
+ $this->assertRaw('garland/style.css', t("The default theme's CSS appears on the page when the theme system is initialized in hook_init()."));
}
}
diff --git a/modules/simpletest/tests/unicode.test b/modules/simpletest/tests/unicode.test
index e4fa1457b..cdae50955 100644
--- a/modules/simpletest/tests/unicode.test
+++ b/modules/simpletest/tests/unicode.test
@@ -35,13 +35,13 @@ class UnicodeUnitTest extends DrupalWebTestCase {
// mbstring was not detected on this installation, there is no way to test
// multibyte features. Treat that as an exception.
if ($multibyte == UNICODE_SINGLEBYTE) {
- $this->error('Unable to test Multibyte features: mbstring extension was not detected.');
+ $this->error(t('Unable to test Multibyte features: mbstring extension was not detected.'));
}
$multibyte = UNICODE_MULTIBYTE;
$this->extendedMode = TRUE;
- $this->pass('Testing in mbstring mode');
+ $this->pass(t('Testing in mbstring mode'));
$this->helperTestStrToLower();
$this->helperTestStrToUpper();
@@ -61,7 +61,7 @@ class UnicodeUnitTest extends DrupalWebTestCase {
$this->extendedMode = FALSE;
- $this->pass('Testing in emulated (best-effort) mode');
+ $this->pass(t('Testing in emulated (best-effort) mode'));
$this->helperTestStrToLower();
$this->helperTestStrToUpper();
@@ -81,7 +81,7 @@ class UnicodeUnitTest extends DrupalWebTestCase {
}
foreach ($testcase as $input => $output) {
- $this->assertEqual(drupal_strtolower($input), $output, $input . ' is lowercased as ' . $output);
+ $this->assertEqual(drupal_strtolower($input), $output, t('%input is lowercased as %output', array('%input' => $input, '%output' => $output)));
}
}
@@ -95,7 +95,7 @@ class UnicodeUnitTest extends DrupalWebTestCase {
}
foreach ($testcase as $input => $output) {
- $this->assertEqual(drupal_strtoupper($input), $output, $input . ' is uppercased as ' . $output);
+ $this->assertEqual(drupal_strtoupper($input), $output, t('%input is uppercased as %output', array('%input' => $input, '%output' => $output)));
}
}
@@ -111,7 +111,7 @@ class UnicodeUnitTest extends DrupalWebTestCase {
}
foreach ($testcase as $input => $output) {
- $this->assertEqual(drupal_ucfirst($input), $output, $input . ' is ucfirst-ed as ' . $output);
+ $this->assertEqual(drupal_ucfirst($input), $output, t('%input is ucfirst-ed as %output', array('%input' => $input, '%output' => $output)));
}
}
@@ -122,7 +122,7 @@ class UnicodeUnitTest extends DrupalWebTestCase {
);
foreach ($testcase as $input => $output) {
- $this->assertEqual(drupal_strlen($input), $output, $input . ' length is ' . $output);
+ $this->assertEqual(drupal_strlen($input), $output, t('%input length is %output', array('%input' => $input, '%output' => $output)));
}
}
@@ -182,7 +182,7 @@ class UnicodeUnitTest extends DrupalWebTestCase {
foreach ($testcase as $test) {
list($input, $start, $length, $output) = $test;
$result = drupal_substr($input, $start, $length);
- $this->assertEqual($result, $output, $input . ' substring at offset ' . $start . ' for ' . $length . ' characters is ' . $output . ' (got ' . $result . ')');
+ $this->assertEqual($result, $output, t('%input substring at offset %offset for %length characters is %output (got %result)', array('%input' => $input, '%offset' => $start, '%length' => $length, '%output' => $output, '%result' => $result)));
}
}
@@ -214,7 +214,7 @@ class UnicodeUnitTest extends DrupalWebTestCase {
'&euro;' => '€',
);
foreach ($testcase as $input => $output) {
- $this->assertEqual(decode_entities($input), $output, 'Make sure the decoded entity of ' . $input . ' is ' . $output);
+ $this->assertEqual(decode_entities($input), $output, t('Make sure the decoded entity of @input is @output', array('@input' => $input, '@output' => $output)));
}
}
@@ -244,7 +244,7 @@ class UnicodeUnitTest extends DrupalWebTestCase {
);
$exclude = array('<', '&', '"');
foreach ($testcase as $input => $output) {
- $this->assertIdentical(decode_entities($input, $exclude), $output, 'Make sure the decoded entity of ' . $input . ', excluding ' . implode(',', $exclude) . ', is ' . $output);
+ $this->assertIdentical(decode_entities($input, $exclude), $output, t('Make sure the decoded entity of %input, excluding %excludes, is %output', array('%input' => $input, '%excludes' => implode(',', $exclude), '%output' => $output)));
}
}
@@ -330,7 +330,7 @@ class UnicodeUnitTest extends DrupalWebTestCase {
foreach ($cases as $case) {
list($input, $max_length, $expected) = $case;
$output = truncate_utf8($input, $max_length, $wordsafe, $ellipsis);
- $this->assertEqual($output, $expected, $input . ' truncate to ' . $max_length . ' characters with ' . ($wordsafe ? 'word-safe' : 'not word-safe') . ', ' . ($ellipsis ? 'ellipsis' : 'not ellipsis') . ' is ' . $expected . ' (got ' . $output . ')');
+ $this->assertEqual($output, $expected, t('%input truncate to %length characters with %wordsafe, %ellipsis is %expected (got %output)', array('%input' => $input, '%length' => $max_length, '%output' => $output, '%expected' => $expected, '%wordsafe' => ($wordsafe ? 'word-safe' : 'not word-safe'), '%ellipsis' => ($ellipsis ? 'ellipsis' : 'not ellipsis'))));
}
}
}
diff --git a/modules/simpletest/tests/update.test b/modules/simpletest/tests/update.test
index 61e338c10..c4d382847 100644
--- a/modules/simpletest/tests/update.test
+++ b/modules/simpletest/tests/update.test
@@ -36,7 +36,7 @@ class UpdateDependencyOrderingTestCase extends DrupalWebTestCase {
'update_test_1_update_7002',
);
$actual_updates = array_keys(update_resolve_dependencies($starting_updates));
- $this->assertEqual($expected_updates, $actual_updates, 'Updates within a single module run in the correct order.');
+ $this->assertEqual($expected_updates, $actual_updates, t('Updates within a single module run in the correct order.'));
}
/**
@@ -50,9 +50,9 @@ class UpdateDependencyOrderingTestCase extends DrupalWebTestCase {
$update_order = array_keys(update_resolve_dependencies($starting_updates));
// Make sure that each dependency is satisfied.
$first_dependency_satisfied = array_search('update_test_2_update_7000', $update_order) < array_search('update_test_3_update_7000', $update_order);
- $this->assertTrue($first_dependency_satisfied, 'The dependency of the second module on the first module is respected by the update function order.');
+ $this->assertTrue($first_dependency_satisfied, t('The dependency of the second module on the first module is respected by the update function order.'));
$second_dependency_satisfied = array_search('update_test_3_update_7000', $update_order) < array_search('update_test_2_update_7001', $update_order);
- $this->assertTrue($second_dependency_satisfied, 'The dependency of the first module on the second module is respected by the update function order.');
+ $this->assertTrue($second_dependency_satisfied, t('The dependency of the first module on the second module is respected by the update function order.'));
}
}
@@ -80,9 +80,9 @@ class UpdateDependencyMissingTestCase extends DrupalWebTestCase {
'update_test_2' => 7000,
);
$update_graph = update_resolve_dependencies($starting_updates);
- $this->assertTrue($update_graph['update_test_2_update_7000']['allowed'], "The module's first update function is allowed to run, since it does not have any missing dependencies.");
- $this->assertFalse($update_graph['update_test_2_update_7001']['allowed'], "The module's second update function is not allowed to run, since it has a direct dependency on a missing update.");
- $this->assertFalse($update_graph['update_test_2_update_7002']['allowed'], "The module's third update function is not allowed to run, since it has an indirect dependency on a missing update.");
+ $this->assertTrue($update_graph['update_test_2_update_7000']['allowed'], t("The module's first update function is allowed to run, since it does not have any missing dependencies."));
+ $this->assertFalse($update_graph['update_test_2_update_7001']['allowed'], t("The module's second update function is not allowed to run, since it has a direct dependency on a missing update."));
+ $this->assertFalse($update_graph['update_test_2_update_7002']['allowed'], t("The module's third update function is not allowed to run, since it has an indirect dependency on a missing update."));
}
}
@@ -108,9 +108,9 @@ class UpdateDependencyHookInvocationTestCase extends DrupalWebTestCase {
*/
function testHookUpdateDependencies() {
$update_dependencies = update_retrieve_dependencies();
- $this->assertTrue($update_dependencies['system'][7000]['update_test_1'] == 7000, 'An update function that has a dependency on two separate modules has the first dependency recorded correctly.');
- $this->assertTrue($update_dependencies['system'][7000]['update_test_2'] == 7001, 'An update function that has a dependency on two separate modules has the second dependency recorded correctly.');
- $this->assertTrue($update_dependencies['system'][7001]['update_test_1'] == 7002, 'An update function that depends on more than one update from the same module only has the dependency on the higher-numbered update function recorded.');
+ $this->assertTrue($update_dependencies['system'][7000]['update_test_1'] == 7000, t('An update function that has a dependency on two separate modules has the first dependency recorded correctly.'));
+ $this->assertTrue($update_dependencies['system'][7000]['update_test_2'] == 7001, t('An update function that has a dependency on two separate modules has the second dependency recorded correctly.'));
+ $this->assertTrue($update_dependencies['system'][7001]['update_test_1'] == 7002, t('An update function that depends on more than one update from the same module only has the dependency on the higher-numbered update function recorded.'));
}
}
diff --git a/modules/simpletest/tests/upgrade/upgrade.poll.test b/modules/simpletest/tests/upgrade/upgrade.poll.test
index 24245e4e4..b1df28283 100644
--- a/modules/simpletest/tests/upgrade/upgrade.poll.test
+++ b/modules/simpletest/tests/upgrade/upgrade.poll.test
@@ -31,7 +31,7 @@ class PollUpgradePathTestCase extends UpgradePathTestCase {
* Test a successful upgrade.
*/
public function testPollUpgrade() {
- $this->assertTrue($this->performUpgrade(), 'The upgrade was completed successfully.');
+ $this->assertTrue($this->performUpgrade(), t('The upgrade was completed successfully.'));
// Check modules page for poll
$this->drupalGet('admin/modules');
@@ -43,24 +43,22 @@ class PollUpgradePathTestCase extends UpgradePathTestCase {
$nbchoices = ($i % 4) + 2;
for ($c = 0; $c < $nbchoices; $c++) {
- $this->assertText("Choice $c for poll $i", 'Choice text is displayed correctly on poll view');
+ $this->assertText("Choice $c for poll $i", t('Choice text is displayed correctly on poll view'));
}
// Now check that the votes are correct
$this->clickLink(t('Results'));
for ($c = 0; $c < $nbchoices; $c++) {
- $this->assertText("Choice $c for poll $i", 'Choice text is displayed correctly on result view');
+ $this->assertText("Choice $c for poll $i", t('Choice text is displayed correctly on result view'));
}
- $nbvotes = floor(($i % 4) + 5);
+ $nbvotes = floor (($i % 4) + 5);
$elements = $this->xpath("//div[@class='percent']");
for ($c = 0; $c < $nbchoices; $c++) {
$votes = floor($nbvotes / $nbchoices);
- if (($nbvotes % $nbchoices) > $c) {
- $votes++;
- }
- $this->assertTrue(preg_match("/$votes vote/", $elements[$c]), 'The number of votes is displayed correctly: expected ' . $votes . ', got ' . $elements[$c]);
+ if (($nbvotes % $nbchoices) > $c) $votes++;
+ $this->assertTrue(preg_match("/$votes vote/", $elements[$c]), t('The number of votes is displayed correctly: expected ' . $votes . ', got ' . $elements[$c]));
}
}
}
diff --git a/modules/simpletest/tests/upgrade/upgrade.test b/modules/simpletest/tests/upgrade/upgrade.test
index 1d134f278..d0a3bc885 100644
--- a/modules/simpletest/tests/upgrade/upgrade.test
+++ b/modules/simpletest/tests/upgrade/upgrade.test
@@ -197,8 +197,7 @@ abstract class UpgradePathTestCase extends DrupalWebTestCase {
}
// Since cache_bootstrap won't exist in a Drupal 6 site, ignore the
// exception if the above fails.
- catch (Exception $e) {
- }
+ catch (Exception $e) {}
}
/**
@@ -258,7 +257,7 @@ abstract class UpgradePathTestCase extends DrupalWebTestCase {
// Check if there still are pending updates.
$this->drupalGet($update_url, array('external' => TRUE));
$this->drupalPost(NULL, array(), t('Continue'));
- if (!$this->assertText(t('No pending updates.'), 'No pending updates at the end of the update process.')) {
+ if (!$this->assertText(t('No pending updates.'), t('No pending updates at the end of the update process.'))) {
return FALSE;
}
@@ -341,14 +340,14 @@ class BasicUpgradePath extends UpgradePathTestCase {
// Destroy a table that the upgrade process needs.
db_drop_table('access');
// Assert that the upgrade fails.
- $this->assertFalse($this->performUpgrade(FALSE), 'A failed upgrade should return messages.');
+ $this->assertFalse($this->performUpgrade(FALSE), t('A failed upgrade should return messages.'));
}
/**
* Test a successful upgrade.
*/
public function testBasicUpgrade() {
- $this->assertTrue($this->performUpgrade(), 'The upgrade was completed successfully.');
+ $this->assertTrue($this->performUpgrade(), t('The upgrade was completed successfully.'));
// Hit the frontpage.
$this->drupalGet('');
@@ -357,7 +356,7 @@ class BasicUpgradePath extends UpgradePathTestCase {
// Verify that we are still logged in.
$this->drupalGet('user');
$this->clickLink(t('Edit'));
- $this->assertEqual($this->getUrl(), url('user/1/edit', array('absolute' => TRUE)), 'We are still logged in as admin at the end of the upgrade.');
+ $this->assertEqual($this->getUrl(), url('user/1/edit', array('absolute' => TRUE)), t('We are still logged in as admin at the end of the upgrade.'));
// Logout and verify that we can login back in with our initial password.
$this->drupalLogout();
@@ -368,7 +367,7 @@ class BasicUpgradePath extends UpgradePathTestCase {
));
// Test that the site name is correctly displayed.
- $this->assertText('Drupal 6', 'The site name is correctly displayed.');
+ $this->assertText('Drupal 6', t('The site name is correctly displayed.'));
// Verify that the main admin sections are available.
$this->drupalGet('admin');
diff --git a/modules/simpletest/tests/xmlrpc.test b/modules/simpletest/tests/xmlrpc.test
index f057eac78..8ba943855 100644
--- a/modules/simpletest/tests/xmlrpc.test
+++ b/modules/simpletest/tests/xmlrpc.test
@@ -129,7 +129,7 @@ class XMLRPCValidator1IncTestCase extends DrupalWebTestCase {
$int_5 = mt_rand(-100, 100);
$bool_5 = (($int_5 % 2) == 0);
$string_5 = $this->randomName();
- $double_5 = (double) (mt_rand(-1000, 1000) / 100);
+ $double_5 = (double)(mt_rand(-1000, 1000) / 100);
$time_5 = REQUEST_TIME;
$base64_5 = $this->randomName(100);
$l_res_5 = xmlrpc_test_manyTypesTest($int_5, $bool_5, $string_5, $double_5, xmlrpc_date($time_5), $base64_5);
@@ -214,7 +214,7 @@ class XMLRPCMessagesTestCase extends DrupalWebTestCase {
$xml_message_l = xmlrpc_test_message_sized_in_kb($size);
$xml_message_r = xmlrpc($xml_url, 'messages.messageSizedInKB', $size);
- $this->assertEqual($xml_message_l, $xml_message_r, 'XML-RPC messages.messageSizedInKB of ' . $size . ' Kb size received');
+ $this->assertEqual($xml_message_l, $xml_message_r, t('XML-RPC messages.messageSizedInKB of %s Kb size received', array('%s' => $size)));
}
}
}
diff --git a/modules/statistics/statistics.test b/modules/statistics/statistics.test
index 89a136edc..31b13b95a 100644
--- a/modules/statistics/statistics.test
+++ b/modules/statistics/statistics.test
@@ -78,18 +78,18 @@ class StatisticsLoggingTestCase extends DrupalWebTestCase {
// Verify logging of an uncached page.
$this->drupalGet($path);
- $this->assertIdentical($this->drupalGetHeader('X-Drupal-Cache'), 'MISS', 'Testing an uncached page.');
+ $this->assertIdentical($this->drupalGetHeader('X-Drupal-Cache'), 'MISS', t('Testing an uncached page.'));
$log = db_query('SELECT * FROM {accesslog}')->fetchAll(PDO::FETCH_ASSOC);
- $this->assertTrue(is_array($log) && count($log) == 1, 'Page request was logged.');
+ $this->assertTrue(is_array($log) && count($log) == 1, t('Page request was logged.'));
$this->assertEqual(array_intersect_key($log[0], $expected), $expected);
$node_counter = statistics_get($this->node->nid);
$this->assertIdentical($node_counter['totalcount'], '1');
// Verify logging of a cached page.
$this->drupalGet($path);
- $this->assertIdentical($this->drupalGetHeader('X-Drupal-Cache'), 'HIT', 'Testing a cached page.');
+ $this->assertIdentical($this->drupalGetHeader('X-Drupal-Cache'), 'HIT', t('Testing a cached page.'));
$log = db_query('SELECT * FROM {accesslog}')->fetchAll(PDO::FETCH_ASSOC);
- $this->assertTrue(is_array($log) && count($log) == 2, 'Page request was logged.');
+ $this->assertTrue(is_array($log) && count($log) == 2, t('Page request was logged.'));
$this->assertEqual(array_intersect_key($log[1], $expected), $expected);
$node_counter = statistics_get($this->node->nid);
$this->assertIdentical($node_counter['totalcount'], '2');
@@ -113,9 +113,9 @@ class StatisticsReportsTestCase extends StatisticsTestCase {
*/
function testRecentHits() {
$this->drupalGet('admin/reports/hits');
- $this->assertText('test', 'Hit title found.');
- $this->assertText('node/1', 'Hit URL found.');
- $this->assertText('Anonymous', 'Hit user found.');
+ $this->assertText('test', t('Hit title found.'));
+ $this->assertText('node/1', t('Hit URL found.'));
+ $this->assertText('Anonymous', t('Hit user found.'));
}
/**
@@ -123,8 +123,8 @@ class StatisticsReportsTestCase extends StatisticsTestCase {
*/
function testTopPages() {
$this->drupalGet('admin/reports/pages');
- $this->assertText('test', 'Hit title found.');
- $this->assertText('node/1', 'Hit URL found.');
+ $this->assertText('test', t('Hit title found.'));
+ $this->assertText('node/1', t('Hit URL found.'));
}
/**
@@ -132,7 +132,7 @@ class StatisticsReportsTestCase extends StatisticsTestCase {
*/
function testTopReferrers() {
$this->drupalGet('admin/reports/referrers');
- $this->assertText('http://example.com', 'Hit referrer found.');
+ $this->assertText('http://example.com', t('Hit referrer found.'));
}
/**
@@ -140,9 +140,9 @@ class StatisticsReportsTestCase extends StatisticsTestCase {
*/
function testDetails() {
$this->drupalGet('admin/reports/access/1');
- $this->assertText('test', 'Hit title found.');
- $this->assertText('node/1', 'Hit URL found.');
- $this->assertText('Anonymous', 'Hit user found.');
+ $this->assertText('test', t('Hit title found.'));
+ $this->assertText('node/1', t('Hit URL found.'));
+ $this->assertText('Anonymous', t('Hit user found.'));
}
/**
@@ -151,8 +151,8 @@ class StatisticsReportsTestCase extends StatisticsTestCase {
function testAccessLogging() {
$this->drupalGet('admin/reports/referrers');
$this->drupalGet('admin/reports/hits');
- $this->assertText('Top referrers in the past 3 days', 'Hit title found.');
- $this->assertText('admin/reports/referrers', 'Hit URL found.');
+ $this->assertText('Top referrers in the past 3 days', t('Hit title found.'));
+ $this->assertText('admin/reports/referrers', t('Hit URL found.'));
}
/**
@@ -177,12 +177,12 @@ class StatisticsReportsTestCase extends StatisticsTestCase {
// Get some page and check if the block is displayed.
$this->drupalGet('user');
- $this->assertText('Popular content', 'Found the popular content block.');
- $this->assertText("Today's", 'Found today\'s popular content.');
- $this->assertText('All time', 'Found the alll time popular content.');
- $this->assertText('Last viewed', 'Found the last viewed popular content.');
+ $this->assertText('Popular content', t('Found the popular content block.'));
+ $this->assertText("Today's", t('Found today\'s popular content.'));
+ $this->assertText('All time', t('Found the alll time popular content.'));
+ $this->assertText('Last viewed', t('Found the last viewed popular content.'));
- $this->assertRaw(l($node->title, 'node/' . $node->nid), 'Found link to visited node.');
+ $this->assertRaw(l($node->title, 'node/' . $node->nid), t('Found link to visited node.'));
}
}
@@ -209,30 +209,30 @@ class StatisticsBlockVisitorsTestCase extends StatisticsTestCase {
// and that a 'block IP address' link is displayed.
$this->drupalLogin($this->blocking_user);
$this->drupalGet('admin/reports/visitors');
- $this->assertText($test_ip_address, 'IP address found.');
- $this->assertText(t('block IP address'), 'Block IP link displayed');
+ $this->assertText($test_ip_address, t('IP address found.'));
+ $this->assertText(t('block IP address'), t('Block IP link displayed'));
// Block the IP address.
$this->clickLink('block IP address');
- $this->assertText(t('IP address blocking'), 'IP blocking page displayed.');
+ $this->assertText(t('IP address blocking'), t('IP blocking page displayed.'));
$edit = array();
$edit['ip'] = $test_ip_address;
$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->assertNotEqual($ip, FALSE, 'IP address found in database');
- $this->assertRaw(t('The IP address %ip has been blocked.', array('%ip' => $edit['ip'])), 'IP address was blocked.');
+ $this->assertNotEqual($ip, FALSE, 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.'));
// Verify that the block/unblock link on the top visitors page has been
// altered.
$this->drupalGet('admin/reports/visitors');
- $this->assertText(t('unblock IP address'), 'Unblock IP address link displayed');
+ $this->assertText(t('unblock IP address'), t('Unblock IP address link displayed'));
// Unblock the IP address.
$this->clickLink('unblock IP address');
- $this->assertRaw(t('Are you sure you want to delete %ip?', array('%ip' => $test_ip_address)), 'IP address deletion confirmation found.');
+ $this->assertRaw(t('Are you sure you want to delete %ip?', array('%ip' => $test_ip_address)), t('IP address deletion confirmation found.'));
$edit = array();
$this->drupalPost('admin/config/people/ip-blocking/delete/1', NULL, t('Delete'));
- $this->assertRaw(t('The IP address %ip was deleted.', array('%ip' => $test_ip_address)), 'IP address deleted.');
+ $this->assertRaw(t('The IP address %ip was deleted.', array('%ip' => $test_ip_address)), t('IP address deleted.'));
}
}
@@ -262,32 +262,32 @@ class StatisticsAdminTestCase extends DrupalWebTestCase {
* Verifies that the statistics settings page works.
*/
function testStatisticsSettings() {
- $this->assertFalse(variable_get('statistics_enable_access_log', 0), 'Access log is disabled by default.');
- $this->assertFalse(variable_get('statistics_count_content_views', 0), 'Count content view log is disabled by default.');
+ $this->assertFalse(variable_get('statistics_enable_access_log', 0), t('Access log is disabled by default.'));
+ $this->assertFalse(variable_get('statistics_count_content_views', 0), t('Count content view log is disabled by default.'));
$this->drupalGet('admin/reports/pages');
- $this->assertRaw(t('No statistics available.'), 'Verifying text shown when no statistics is available.');
+ $this->assertRaw(t('No statistics available.'), t('Verifying text shown when no statistics is available.'));
// Enable access log and counter on content view.
$edit['statistics_enable_access_log'] = 1;
$edit['statistics_count_content_views'] = 1;
$this->drupalPost('admin/config/system/statistics', $edit, t('Save configuration'));
- $this->assertTrue(variable_get('statistics_enable_access_log'), 'Access log is enabled.');
- $this->assertTrue(variable_get('statistics_count_content_views'), 'Count content view log is enabled.');
+ $this->assertTrue(variable_get('statistics_enable_access_log'), t('Access log is enabled.'));
+ $this->assertTrue(variable_get('statistics_count_content_views'), t('Count content view log is enabled.'));
// Hit the node.
$this->drupalGet('node/' . $this->test_node->nid);
$this->drupalGet('admin/reports/pages');
- $this->assertText('node/1', 'Test node found.');
+ $this->assertText('node/1', t('Test node found.'));
// Hit the node again (the counter is incremented after the hit, so
// "1 read" will actually be shown when the node is hit the second time).
$this->drupalGet('node/' . $this->test_node->nid);
- $this->assertText('1 read', 'Node is read once.');
+ $this->assertText('1 read', t('Node is read once.'));
$this->drupalGet('node/' . $this->test_node->nid);
- $this->assertText('2 reads', 'Node is read 2 times.');
+ $this->assertText('2 reads', t('Node is read 2 times.'));
}
/**
@@ -336,10 +336,10 @@ class StatisticsAdminTestCase extends DrupalWebTestCase {
$this->drupalPost(NULL, NULL, t('Cancel account'));
// Confirm account cancellation request.
$this->drupalGet("user/$account->uid/cancel/confirm/$timestamp/" . user_pass_rehash($account->pass, $timestamp, $account->login));
- $this->assertFalse(user_load($account->uid, TRUE), 'User is not found in the database.');
+ $this->assertFalse(user_load($account->uid, TRUE), t('User is not found in the database.'));
$this->drupalGet('admin/reports/visitors');
- $this->assertNoText($account->name, 'Did not find user in visitor statistics.');
+ $this->assertNoText($account->name, t('Did not find user in visitor statistics.'));
}
/**
@@ -353,10 +353,10 @@ class StatisticsAdminTestCase extends DrupalWebTestCase {
$this->drupalGet('node/' . $this->test_node->nid);
$this->drupalGet('node/' . $this->test_node->nid);
- $this->assertText('1 read', 'Node is read once.');
+ $this->assertText('1 read', t('Node is read once.'));
$this->drupalGet('admin/reports/pages');
- $this->assertText('node/' . $this->test_node->nid, 'Hit URL found.');
+ $this->assertText('node/' . $this->test_node->nid, t('Hit URL found.'));
// statistics_cron will subtract the statistics_flush_accesslog_timer
// variable from REQUEST_TIME in the delete query, so wait two secs here to
@@ -365,14 +365,14 @@ class StatisticsAdminTestCase extends DrupalWebTestCase {
$this->cronRun();
$this->drupalGet('admin/reports/pages');
- $this->assertNoText('node/' . $this->test_node->nid, 'No hit URL found.');
+ $this->assertNoText('node/' . $this->test_node->nid, t('No hit URL found.'));
$result = db_select('node_counter', 'nc')
->fields('nc', array('daycount'))
->condition('nid', $this->test_node->nid, '=')
->execute()
->fetchField();
- $this->assertFalse($result, 'Daycounter is zero.');
+ $this->assertFalse($result, t('Daycounter is zero.'));
}
}
@@ -411,11 +411,11 @@ class StatisticsTokenReplaceTestCase extends StatisticsTestCase {
$tests['[node:last-view:short]'] = format_date($statistics['timestamp'], 'short');
// Test to make sure that we generated something for each token.
- $this->assertFalse(in_array(0, array_map('strlen', $tests)), 'No empty tokens generated.');
+ $this->assertFalse(in_array(0, array_map('strlen', $tests)), t('No empty tokens generated.'));
foreach ($tests as $input => $expected) {
$output = token_replace($input, array('node' => $node), array('language' => $language));
- $this->assertFalse(strcmp($output, $expected), 'Statistics token ' . $input . ' replaced.');
+ $this->assertFalse(strcmp($output, $expected), t('Statistics token %token replaced.', array('%token' => $input)));
}
}
}
diff --git a/modules/syslog/syslog.test b/modules/syslog/syslog.test
index 05bdd1e95..4f0950dd9 100644
--- a/modules/syslog/syslog.test
+++ b/modules/syslog/syslog.test
@@ -30,7 +30,7 @@ class SyslogTestCase extends DrupalWebTestCase {
$this->drupalGet('admin/config/development/logging');
if ($this->parse()) {
$field = $this->xpath('//option[@value=:value]', array(':value' => LOG_LOCAL6)); // Should be one field.
- $this->assertTrue($field[0]['selected'] == 'selected', 'Facility value saved.');
+ $this->assertTrue($field[0]['selected'] == 'selected', t('Facility value saved.'));
}
}
}
diff --git a/modules/system/system.test b/modules/system/system.test
index 7d5350153..1d665bf94 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, 'Tables matching "' . $base_table . '" found.');
+ return $this->assertTrue($tables, t('Tables matching "@base_table" found.', array('@base_table' => $base_table)));
}
- return $this->assertFalse($tables, 'Tables matching "' . $base_table . '" not found.');
+ return $this->assertFalse($tables, t('Tables matching "@base_table" not found.', array('@base_table' => $base_table)));
}
/**
@@ -49,7 +49,7 @@ class ModuleTestCase extends DrupalWebTestCase {
else {
$message = 'Module "@module" is not enabled.';
}
- $this->assertEqual(module_exists($module), $enabled, $message);
+ $this->assertEqual(module_exists($module), $enabled, t($message, array('@module' => $module)));
}
}
@@ -84,7 +84,7 @@ class ModuleTestCase extends DrupalWebTestCase {
->countQuery()
->execute()
->fetchField();
- $this->assertTrue($count > 0, 'watchdog table contains ' . $count . ' rows for ' . $message);
+ $this->assertTrue($count > 0, t('watchdog table contains @count rows for @message', array('@count' => $count, '@message' => $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.'), 'Modules status has been updated.');
+ $this->assertText(t('The configuration options have been saved.'), t('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'), 'hook_modules_installed fired.');
- $this->assertText(t('hook_modules_enabled fired for aggregator'), 'hook_modules_enabled fired.');
+ $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->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.'), 'Modules status has been updated.');
+ $this->assertText(t('The configuration options have been saved.'), t('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'), 'hook_modules_disabled fired.');
+ $this->assertText(t('hook_modules_disabled fired for aggregator'), t('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.'), 'Modules status has been updated.');
+ $this->assertText(t('The selected modules have been uninstalled.'), t('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'), 'hook_modules_uninstalled fired.');
+ $this->assertText(t('hook_modules_uninstalled fired for aggregator'), t('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.'), 'Modules status has been updated.');
+ $this->assertText(t('The configuration options have been saved.'), t('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, 'Entity information must not be NULL');
+ $this->assertNotNull($info, t('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'), 'Modules status has been updated.');
+ $this->assertText(t('Requirements 1 Test failed requirements'), t('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'), 'Dependecy required.');
+ $this->assertText(t('Some required modules must be enabled'), t('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.'), 'Modules status has been updated.');
+ $this->assertText(t('The configuration options have been saved.'), t('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'))), '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'))), t('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, 'Checkbox for the module is disabled.');
+ $this->assert(count($checkbox) == 1, t('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')), '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')), t('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'), 'Modules status has been updated.');
+ $this->assertText(t('Requirements 1 Test failed requirements'), t('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']", '', 'Field ' . $field_name . ' was disabled and checked.');
+ $this->assertFieldByXPath("//input[@name='$field_name' and @disabled='disabled' and @checked='checked']", '', t('Field @name was disabled and checked.', array('@name' => $field_name)));
}
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, 'IP address found in database.');
- $this->assertRaw(t('The IP address %ip has been blocked.', array('%ip' => $edit['ip'])), 'IP address was blocked.');
+ $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.'));
// 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, 'IP address found in database');
- $this->assertRaw(t('The IP address %ip has been blocked.', array('%ip' => $submit_ip)), 'IP address was blocked.');
+ $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.'));
// 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), 'Cron does not run when the cron threshold is not passed.');
+ $this->assertTrue($cron_last == variable_get('cron_last', NULL), t('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), 'Cron runs when the cron threshold is passed.');
+ $this->assertTrue($cron_last < variable_get('cron_last', NULL), t('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), 'Cron does not run when the cron threshold is disabled.');
+ $this->assertTrue($cron_last == variable_get('cron_last', NULL), t('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), 'Old temp file was created correctly.');
+ $this->assertTrue(file_exists($temp_old->uri), t('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), 'New temp file was created correctly.');
+ $this->assertTrue(file_exists($temp_new->uri), t('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), 'Old permanent file was created correctly.');
+ $this->assertTrue(file_exists($perm_old->uri), t('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), 'New permanent file was created correctly.');
+ $this->assertTrue(file_exists($perm_new->uri), t('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), '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.');
+ $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.'));
}
}
@@ -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, 'Fingerprinting meta tag generated correctly.', 'System');
+ $this->assertRaw($string, t('Fingerprinting meta tag generated correctly.'), t('System'));
}
}
@@ -626,7 +626,7 @@ class AccessDeniedTestCase extends DrupalWebTestCase {
function testAccessDenied() {
$this->drupalGet('admin');
- $this->assertText(t('Access denied'), 'Found the default 403 page');
+ $this->assertText(t('Access denied'), t('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, 'Found the custom 403 page');
+ $this->assertText($node->title, t('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, 'Found the custom 403 page');
- $this->assertText(t('User login'), 'Blocks are shown on the custom 403 page');
+ $this->assertText($node->title, t('Found the custom 403 page'));
+ $this->assertText(t('User login'), t('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'), 'Found the default 403 page');
+ $this->assertText(t('Access denied'), t('Found the default 403 page'));
$this->assertResponse(403);
- $this->assertText(t('User login'), 'Blocks are shown on the default 403 page');
+ $this->assertText(t('User login'), t('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'), 'Found the default 404 page');
+ $this->assertText(t('Page not found'), t('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, 'Found the custom 404 page');
+ $this->assertText($node->title, t('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, 'Found the site maintenance mode message.');
+ $this->assertRaw($admin_message, t('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, 'Site maintenance mode message not displayed.');
+ $this->assertNoRaw($admin_message, t('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, 'Found the site offline message.');
+ $this->assertRaw($offline_message, t('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'), 'Anonymous users can access user/password');
+ $this->assertText(t('Username or e-mail address'), t('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', 'Date should be identical, with GMT offset of -10 hours.');
+ $this->assertText('2007-01-31 21:00:00 -1000', t('Date should be identical, with GMT offset of -10 hours.'));
$this->drupalGet("node/$node2->nid");
- $this->assertText('2007-07-31 21:00:00 -1000', 'Date should be identical, with GMT offset of -10 hours.');
+ $this->assertText('2007-07-31 21:00:00 -1000', t('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', 'Date should be two hours ahead, with GMT offset of -8 hours.');
+ $this->assertText('2007-01-31 23:00:00 -0800', t('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', 'Date should be three hours ahead, with GMT offset of -7 hours.');
+ $this->assertText('2007-08-01 00:00:00 -0700', t('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)), 'Correct page redirection.');
+ $this->assertEqual($this->getUrl(), url('admin/config/regional/date-time', array('absolute' => TRUE)), t('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)), 'Correct page redirection.');
+ $this->assertEqual($this->getUrl(), url('admin/config/regional/date-time', array('absolute' => TRUE)), t('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)), 'Correct page redirection.');
+ $this->assertEqual($this->getUrl(), url('admin/config/regional/date-time/formats', array('absolute' => TRUE)), t('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)), 'Correct page redirection.');
+ $this->assertEqual($this->getUrl(), url('admin/config/regional/date-time/formats', array('absolute' => TRUE)), t('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)), 'Correct page redirection.');
+ $this->assertEqual($this->getUrl(), url('admin/config/regional/date-time/formats', array('absolute' => TRUE)), t('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, 'Tags in title converted to entities when $output is CHECK_PLAIN.');
+ $this->assertTrue(strpos(drupal_get_title(), '<em>') === FALSE, t('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, 'Tags in title are not converted to entities when $output is PASS_THROUGH.');
+ $this->assertTrue(strpos(drupal_get_title(), '<em>') !== FALSE, t('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.'), 'Path is the front page.');
+ $this->assertText(t('On front page.'), t('Path is the front page.'));
$this->drupalGet('node');
- $this->assertText(t('On front page.'), 'Path is the front page.');
+ $this->assertText(t('On front page.'), t('Path is the front page.'));
$this->drupalGet($this->node_path);
- $this->assertNoText(t('On front page.'), 'Path is not the front page.');
+ $this->assertNoText(t('On front page.'), t('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.'), 'The front page path has been saved.');
+ $this->assertText(t('The configuration options have been saved.'), t('The front page path has been saved.'));
$this->drupalGet('');
- $this->assertText(t('On front page.'), 'Path is the front page.');
+ $this->assertText(t('On front page.'), t('Path is the front page.'));
$this->drupalGet('node');
- $this->assertNoText(t('On front page.'), 'Path is not the front page.');
+ $this->assertNoText(t('On front page.'), t('Path is not the front page.'));
$this->drupalGet($this->node_path);
- $this->assertText(t('On front page.'), 'Path is the front page.');
+ $this->assertText(t('On front page.'), t('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.'), 'Block configuration set.');
+ $this->assertText(t('The block configuration has been saved.'), t('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.'), 'Block successfully moved to footer region.');
+ $this->assertText(t('The block settings have been updated.'), t('Block successfully moved to footer region.'));
// Confirm that the block is being displayed.
$this->drupalGet('node');
- $this->assertRaw('id="block-system-powered-by"', 'Block successfully being displayed on the page.');
+ $this->assertRaw('id="block-system-powered-by"', t('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"', 'Block no longer appears on page.');
+ $this->assertNoRaw('id="block-system-powered-by"', t('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.'), 'Modules status has been updated.');
+ $this->assertText(t('The configuration options have been saved.'), t('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.'), 'Modules status has been updated.');
+ $this->assertText(t('The configuration options have been saved.'), t('Modules status has been updated.'));
module_list(TRUE);
- $this->assertFalse(module_exists('block'), 'Block module disabled.');
+ $this->assertFalse(module_exists('block'), t('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', 'Admin interface still available.');
+ $this->assertField('site_name', t('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"', 'Content handled by another module');
- $this->assertText(t('Content to test main content fallback'), 'Main content still displayed.');
+ $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.'));
// 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'), 'Main content fallback properly triggers.');
+ $this->assertText(t('Content to test main content fallback'), t('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'), 'Main content not duplicated.');
+ $this->assertNoText(t('Content to test main content fallback'), t('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', 'User interface still available.');
+ $this->assertField('mail', t('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.'), 'Modules status has been updated.');
+ $this->assertText(t('The configuration options have been saved.'), t('Modules status has been updated.'));
module_list(TRUE);
- $this->assertTrue(module_exists('block'), 'Block module re-enabled.');
+ $this->assertTrue(module_exists('block'), t('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, 'Logo path successfully changed.');
+ $this->assertRaw($file->uri, t('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, 'Logo file successfully uploaded.');
+ $this->assertRaw($file->name, t('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', 'Administration theme used on an administration page.');
+ $this->assertRaw('themes/garland', t('Administration theme used on an administration page.'));
$this->drupalGet('node/' . $this->node->nid);
- $this->assertRaw('themes/stark', 'Site default theme used on node page.');
+ $this->assertRaw('themes/stark', t('Site default theme used on node page.'));
$this->drupalGet('node/add');
- $this->assertRaw('themes/garland', 'Administration theme used on the add content page.');
+ $this->assertRaw('themes/garland', t('Administration theme used on the add content page.'));
$this->drupalGet('node/' . $this->node->nid . '/edit');
- $this->assertRaw('themes/garland', 'Administration theme used on the edit content page.');
+ $this->assertRaw('themes/garland', t('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', 'Administration theme used on an administration page.');
+ $this->assertRaw('themes/garland', t('Administration theme used on an administration page.'));
$this->drupalGet('node/add');
- $this->assertRaw('themes/stark', 'Site default theme used on the add content page.');
+ $this->assertRaw('themes/stark', t('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', 'Site default theme used on administration page.');
+ $this->assertRaw('themes/garland', t('Site default theme used on administration page.'));
$this->drupalGet('node/add');
- $this->assertRaw('themes/garland', 'Site default theme used on the add content page.');
+ $this->assertRaw('themes/garland', t('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, 'Two items matched');
+ $this->assertEqual($this->queueScore($data, $new_items), 2, t('Two items matched'));
// Add two more items.
$queue1->createItem($data[2]);
$queue1->createItem($data[3]);
- $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');
+ $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'));
$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, 'Four items matched');
+ $this->assertEqual($this->queueScore($data, $new_items), 4, t('Four items matched'));
// There should be no duplicate items.
- $this->assertEqual($this->queueScore($new_items, $new_items), 4, 'Four items matched');
+ $this->assertEqual($this->queueScore($new_items, $new_items), 4, t('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(), 'Queue 1 is empty');
- $this->assertFalse($queue2->numberOfItems(), 'Queue 2 is empty');
+ $this->assertFalse($queue1->numberOfItems(), t('Queue 1 is empty'));
+ $this->assertFalse($queue2->numberOfItems(), t('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)), 'Token sanitized.');
+ $this->assertFalse(strcmp($generated['[node:title]'], check_plain($node->title)), t('Token sanitized.'));
$generated = token_generate('node', $raw_tokens, array('node' => $node), array('sanitize' => FALSE));
- $this->assertFalse(strcmp($generated['[node:title]'], $node->title), 'Unsanitized token generated properly.');
+ $this->assertFalse(strcmp($generated['[node:title]'], $node->title), t('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)), 'No empty tokens generated.');
+ $this->assertFalse(in_array(0, array_map('strlen', $tests)), t('No empty tokens generated.'));
foreach ($tests as $input => $expected) {
$output = token_replace($input, array(), array('language' => $language));
- $this->assertFalse(strcmp($output, $expected), 'Sanitized system site information token ' . $input . ' replaced.');
+ $this->assertFalse(strcmp($output, $expected), t('Sanitized system site information token %token replaced.', array('%token' => $input)));
}
// 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), 'Unsanitized system site information token ' . $input . ' replaced.');
+ $this->assertFalse(strcmp($output, $expected), t('Unsanitized system site information token %token replaced.', array('%token' => $input)));
}
}
@@ -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)), 'No empty tokens generated.');
+ $this->assertFalse(in_array(0, array_map('strlen', $tests)), t('No empty tokens generated.'));
foreach ($tests as $input => $expected) {
$output = token_replace($input, array('date' => $date), array('language' => $language));
- $this->assertFalse(strcmp($output, $expected), 'Date token ' . $input . ' replaced.');
+ $this->assertFalse(strcmp($output, $expected), t('Date token %token replaced.', array('%token' => $input)));
}
}
}
@@ -1620,15 +1620,15 @@ array_space[a b] = Value';
$parsed = drupal_parse_info_format($config);
- $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.');
+ $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.'));
}
}
@@ -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'), 'Block module is disabled.');
- $this->assertTrue(module_exists('dashboard'), 'Dashboard module is enabled.');
+ $this->assertFalse(module_exists('block'), t('Block module is disabled.'));
+ $this->assertTrue(module_exists('dashboard'), t('Dashboard module is enabled.'));
$this->drupalGet($this->update_url, array('external' => TRUE));
- $this->assertText(t('Unresolved dependency'), 'The update process cannot proceed when a module dependency is not enabled.');
+ $this->assertText(t('Unresolved dependency'), t('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'), 'Block module is enabled.');
+ $this->assertTrue(module_exists('block'), t('Block module is enabled.'));
module_disable(array('overlay'));
- $this->assertFalse(module_exists('overlay'), 'Overlay module is disabled.');
+ $this->assertFalse(module_exists('overlay'), t('Overlay module is disabled.'));
$this->drupalGet($this->update_url, array('external' => TRUE));
- $this->assertNoText(t('Unresolved dependency'), 'The update process can proceed when modules from the install profile are disabled.');
+ $this->assertNoText(t('Unresolved dependency'), t('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, 'Visiting update.php does not alter the information about themes stored in the database.');
+ $this->assertEqual($original_theme_data, $final_theme_data, t('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, 'Non-existent file not fetched.');
+ $this->assertFalse($retrieved_file, t('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, '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).');
+ $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).'));
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", '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).');
+ $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).'));
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'], 'Compact mode turns on.');
+ $this->assertTrue($this->cookies['Drupal.visitor.admin_compact_mode']['value'], t('Compact mode turns on.'));
$this->drupalGet('admin/compact/on');
- $this->assertTrue($this->cookies['Drupal.visitor.admin_compact_mode']['value'], 'Compact mode remains on after a repeat call.');
+ $this->assertTrue($this->cookies['Drupal.visitor.admin_compact_mode']['value'], t('Compact mode remains on after a repeat call.'));
$this->drupalGet('');
- $this->assertTrue($this->cookies['Drupal.visitor.admin_compact_mode']['value'], 'Compact mode persists on new requests.');
+ $this->assertTrue($this->cookies['Drupal.visitor.admin_compact_mode']['value'], t('Compact mode persists on new requests.'));
$this->drupalGet('admin/compact/off');
- $this->assertEqual($this->cookies['Drupal.visitor.admin_compact_mode']['value'], 'deleted', 'Compact mode turns off.');
+ $this->assertEqual($this->cookies['Drupal.visitor.admin_compact_mode']['value'], 'deleted', t('Compact mode turns off.'));
$this->drupalGet('admin/compact/off');
- $this->assertEqual($this->cookies['Drupal.visitor.admin_compact_mode']['value'], 'deleted', 'Compact mode remains off after a repeat call.');
+ $this->assertEqual($this->cookies['Drupal.visitor.admin_compact_mode']['value'], 'deleted', t('Compact mode remains off after a repeat call.'));
$this->drupalGet('');
- $this->assertTrue($this->cookies['Drupal.visitor.admin_compact_mode']['value'], 'Compact mode persists on new requests.');
+ $this->assertTrue($this->cookies['Drupal.visitor.admin_compact_mode']['value'], t('Compact mode persists on new requests.'));
}
}
diff --git a/modules/taxonomy/taxonomy.test b/modules/taxonomy/taxonomy.test
index 9083b7502..a7c922b7f 100644
--- a/modules/taxonomy/taxonomy.test
+++ b/modules/taxonomy/taxonomy.test
@@ -7,8 +7,8 @@
*/
/**
- * Class with common helper methods.
- */
+* Class with common helper methods.
+*/
class TaxonomyWebTestCase extends DrupalWebTestCase {
/**
@@ -41,8 +41,8 @@ class TaxonomyWebTestCase extends DrupalWebTestCase {
}
/**
- * Tests for the taxonomy vocabulary interface.
- */
+* Tests for the taxonomy vocabulary interface.
+*/
class TaxonomyVocabularyFunctionalTest extends TaxonomyWebTestCase {
public static function getInfo() {
@@ -75,22 +75,22 @@ class TaxonomyVocabularyFunctionalTest extends TaxonomyWebTestCase {
$edit['description'] = $this->randomName();
$edit['machine_name'] = $machine_name;
$this->drupalPost(NULL, $edit, t('Save'));
- $this->assertRaw(t('Created new vocabulary %name.', array('%name' => $edit['name'])), 'Vocabulary created successfully');
+ $this->assertRaw(t('Created new vocabulary %name.', array('%name' => $edit['name'])), t('Vocabulary created successfully'));
// Edit the vocabulary.
$this->drupalGet('admin/structure/taxonomy');
- $this->assertText($edit['name'], 'Vocabulary found in the vocabulary overview listing.');
+ $this->assertText($edit['name'], t('Vocabulary found in the vocabulary overview listing.'));
$this->clickLink(t('edit vocabulary'));
$edit = array();
$edit['name'] = $this->randomName();
$this->drupalPost(NULL, $edit, t('Save'));
$this->drupalGet('admin/structure/taxonomy');
- $this->assertText($edit['name'], 'Vocabulary found in the vocabulary overview listing.');
+ $this->assertText($edit['name'], t('Vocabulary found in the vocabulary overview listing.'));
// Try to submit a vocabulary with a duplicate machine name.
$edit['machine_name'] = $machine_name;
$this->drupalPost('admin/structure/taxonomy/add', $edit, t('Save'));
- $this->assertText(t('This machine-readable name is already in use by another vocabulary and must be unique.'), 'Duplicate machine name validation was successful');
+ $this->assertText(t('This machine-readable name is already in use by another vocabulary and must be unique.'), t('Duplicate machine name validation was successful'));
// Try to submit an invalid machine name.
$edit['machine_name'] = '!&^%';
@@ -122,7 +122,7 @@ class TaxonomyVocabularyFunctionalTest extends TaxonomyWebTestCase {
// Check that the weights are saved in the database correctly.
foreach ($vocabularies as $key => $vocabulary) {
- $this->assertEqual($new_vocabularies[$key]->weight, $vocabularies[$key]->weight, 'The vocabulary weight was changed.');
+ $this->assertEqual($new_vocabularies[$key]->weight, $vocabularies[$key]->weight, t('The vocabulary weight was changed.'));
}
}
@@ -136,10 +136,10 @@ class TaxonomyVocabularyFunctionalTest extends TaxonomyWebTestCase {
taxonomy_vocabulary_delete($key);
}
// Confirm that no vocabularies are found in the database.
- $this->assertFalse(taxonomy_get_vocabularies(), 'No vocabularies found in the database');
+ $this->assertFalse(taxonomy_get_vocabularies(), t('No vocabularies found in the database'));
$this->drupalGet('admin/structure/taxonomy');
// Check the default message for no vocabularies.
- $this->assertText(t('No vocabularies available.'), 'No vocabularies were found.');
+ $this->assertText(t('No vocabularies available.'), t('No vocabularies were found.'));
}
/**
@@ -152,26 +152,26 @@ class TaxonomyVocabularyFunctionalTest extends TaxonomyWebTestCase {
'machine_name' => drupal_strtolower($this->randomName()),
);
$this->drupalPost('admin/structure/taxonomy/add', $edit, t('Save'));
- $this->assertText(t('Created new vocabulary'), 'New vocabulary was created.');
+ $this->assertText(t('Created new vocabulary'), t('New vocabulary was created.'));
// Check the created vocabulary.
$vocabularies = taxonomy_get_vocabularies();
- $vid = $vocabularies[count($vocabularies) -1]->vid;
+ $vid = $vocabularies[count($vocabularies)-1]->vid;
entity_get_controller('taxonomy_vocabulary')->resetCache();
$vocabulary = taxonomy_vocabulary_load($vid);
- $this->assertTrue($vocabulary, 'Vocabulary found in database');
+ $this->assertTrue($vocabulary, t('Vocabulary found in database'));
// Delete the vocabulary.
$edit = array();
$this->drupalPost('admin/structure/taxonomy/' . $vocabulary->machine_name . '/edit', $edit, t('Delete'));
- $this->assertRaw(t('Are you sure you want to delete the vocabulary %name?', array('%name' => $vocabulary->name)), '[confirm deletion] Asks for confirmation.');
- $this->assertText(t('Deleting a vocabulary will delete all the terms in it. This action cannot be undone.'), '[confirm deletion] Inform that all terms will be deleted.');
+ $this->assertRaw(t('Are you sure you want to delete the vocabulary %name?', array('%name' => $vocabulary->name)), t('[confirm deletion] Asks for confirmation.'));
+ $this->assertText(t('Deleting a vocabulary will delete all the terms in it. This action cannot be undone.'), t('[confirm deletion] Inform that all terms will be deleted.'));
// Confirm deletion.
$this->drupalPost(NULL, NULL, t('Delete'));
- $this->assertRaw(t('Deleted vocabulary %name.', array('%name' => $vocabulary->name)), 'Vocabulary deleted');
+ $this->assertRaw(t('Deleted vocabulary %name.', array('%name' => $vocabulary->name)), t('Vocabulary deleted'));
entity_get_controller('taxonomy_vocabulary')->resetCache();
- $this->assertFalse(taxonomy_vocabulary_load($vid), 'Vocabulary is not found in the database');
+ $this->assertFalse(taxonomy_vocabulary_load($vid), t('Vocabulary is not found in the database'));
}
}
@@ -206,15 +206,15 @@ class TaxonomyVocabularyUnitTest extends TaxonomyWebTestCase {
$vid = count($vocabularies) + 1;
$vocabulary = taxonomy_vocabulary_load($vid);
// This should not return an object because no such vocabulary exists.
- $this->assertTrue(empty($vocabulary), 'No object loaded.');
+ $this->assertTrue(empty($vocabulary), t('No object loaded.'));
// Create a new vocabulary.
$this->createVocabulary();
// Load the vocabulary with the same $vid from earlier.
// This should return a vocabulary object since it now matches a real vid.
$vocabulary = taxonomy_vocabulary_load($vid);
- $this->assertTrue(!empty($vocabulary) && is_object($vocabulary), 'Vocabulary is an object');
- $this->assertTrue($vocabulary->vid == $vid, 'Valid vocabulary vid is the same as our previously invalid one.');
+ $this->assertTrue(!empty($vocabulary) && is_object($vocabulary), t('Vocabulary is an object'));
+ $this->assertTrue($vocabulary->vid == $vid, t('Valid vocabulary vid is the same as our previously invalid one.'));
}
/**
@@ -256,8 +256,8 @@ class TaxonomyVocabularyUnitTest extends TaxonomyWebTestCase {
*/
function testTaxonomyVocabularyLoadStaticReset() {
$original_vocabulary = taxonomy_vocabulary_load($this->vocabulary->vid);
- $this->assertTrue(is_object($original_vocabulary), 'Vocabulary loaded successfully');
- $this->assertEqual($this->vocabulary->name, $original_vocabulary->name, 'Vocabulary loaded successfully');
+ $this->assertTrue(is_object($original_vocabulary), t('Vocabulary loaded successfully'));
+ $this->assertEqual($this->vocabulary->name, $original_vocabulary->name, t('Vocabulary loaded successfully'));
// Change the name and description.
$vocabulary = $original_vocabulary;
@@ -273,7 +273,7 @@ class TaxonomyVocabularyUnitTest extends TaxonomyWebTestCase {
// Delete the vocabulary.
taxonomy_vocabulary_delete($this->vocabulary->vid);
$vocabularies = taxonomy_get_vocabularies();
- $this->assertTrue(!isset($vocabularies[$this->vocabulary->vid]), 'The vocabulary was deleted');
+ $this->assertTrue(!isset($vocabularies[$this->vocabulary->vid]), t('The vocabulary was deleted'));
}
/**
@@ -300,28 +300,28 @@ class TaxonomyVocabularyUnitTest extends TaxonomyWebTestCase {
// Fetch the names for all vocabularies, confirm that they are keyed by
// machine name.
$names = taxonomy_vocabulary_get_names();
- $this->assertEqual($names[$vocabulary1->machine_name]->name, $vocabulary1->name, 'Vocabulary 1 name found.');
+ $this->assertEqual($names[$vocabulary1->machine_name]->name, $vocabulary1->name, t('Vocabulary 1 name found.'));
// Fetch all of the vocabularies using taxonomy_get_vocabularies().
// Confirm that the vocabularies are ordered by weight.
$vocabularies = taxonomy_get_vocabularies();
- $this->assertEqual(array_shift($vocabularies)->vid, $vocabulary1->vid, 'Vocabulary was found in the vocabularies array.');
- $this->assertEqual(array_shift($vocabularies)->vid, $vocabulary2->vid, 'Vocabulary was found in the vocabularies array.');
- $this->assertEqual(array_shift($vocabularies)->vid, $vocabulary3->vid, 'Vocabulary was found in the vocabularies array.');
+ $this->assertEqual(array_shift($vocabularies)->vid, $vocabulary1->vid, t('Vocabulary was found in the vocabularies array.'));
+ $this->assertEqual(array_shift($vocabularies)->vid, $vocabulary2->vid, t('Vocabulary was found in the vocabularies array.'));
+ $this->assertEqual(array_shift($vocabularies)->vid, $vocabulary3->vid, t('Vocabulary was found in the vocabularies array.'));
// Fetch the vocabularies with taxonomy_vocabulary_load_multiple(), specifying IDs.
// Ensure they are returned in the same order as the original array.
$vocabularies = taxonomy_vocabulary_load_multiple(array($vocabulary3->vid, $vocabulary2->vid, $vocabulary1->vid));
- $this->assertEqual(array_shift($vocabularies)->vid, $vocabulary3->vid, 'Vocabulary loaded successfully by ID.');
- $this->assertEqual(array_shift($vocabularies)->vid, $vocabulary2->vid, 'Vocabulary loaded successfully by ID.');
- $this->assertEqual(array_shift($vocabularies)->vid, $vocabulary1->vid, 'Vocabulary loaded successfully by ID.');
+ $this->assertEqual(array_shift($vocabularies)->vid, $vocabulary3->vid, t('Vocabulary loaded successfully by ID.'));
+ $this->assertEqual(array_shift($vocabularies)->vid, $vocabulary2->vid, t('Vocabulary loaded successfully by ID.'));
+ $this->assertEqual(array_shift($vocabularies)->vid, $vocabulary1->vid, t('Vocabulary loaded successfully by ID.'));
// Fetch vocabulary 1 by name.
$vocabulary = current(taxonomy_vocabulary_load_multiple(array(), array('name' => $vocabulary1->name)));
- $this->assertTrue($vocabulary->vid == $vocabulary1->vid, 'Vocabulary loaded successfully by name.');
+ $this->assertTrue($vocabulary->vid == $vocabulary1->vid, t('Vocabulary loaded successfully by name.'));
// Fetch vocabulary 1 by name and ID.
- $this->assertTrue(current(taxonomy_vocabulary_load_multiple(array($vocabulary1->vid), array('name' => $vocabulary1->name)))->vid == $vocabulary1->vid, 'Vocabulary loaded successfully by name and ID.');
+ $this->assertTrue(current(taxonomy_vocabulary_load_multiple(array($vocabulary1->vid), array('name' => $vocabulary1->name)))->vid == $vocabulary1->vid, t('Vocabulary loaded successfully by name and ID.'));
}
}
@@ -405,21 +405,21 @@ class TaxonomyTermTestCase extends TaxonomyWebTestCase {
// Check the hierarchy.
$children = taxonomy_get_children($term1->tid);
$parents = taxonomy_get_parents($term2->tid);
- $this->assertTrue(isset($children[$term2->tid]), 'Child found correctly.');
- $this->assertTrue(isset($parents[$term1->tid]), 'Parent found correctly.');
+ $this->assertTrue(isset($children[$term2->tid]), t('Child found correctly.'));
+ $this->assertTrue(isset($parents[$term1->tid]), t('Parent found correctly.'));
// Load and save a term, confirming that parents are still set.
$term = taxonomy_term_load($term2->tid);
taxonomy_term_save($term);
$parents = taxonomy_get_parents($term2->tid);
- $this->assertTrue(isset($parents[$term1->tid]), 'Parent found correctly.');
+ $this->assertTrue(isset($parents[$term1->tid]), t('Parent found correctly.'));
// Create a third term and save this as a parent of term2.
$term3 = $this->createTerm($this->vocabulary);
$term2->parent = array($term1->tid, $term3->tid);
taxonomy_term_save($term2);
$parents = taxonomy_get_parents($term2->tid);
- $this->assertTrue(isset($parents[$term1->tid]) && isset($parents[$term3->tid]), 'Both parents found successfully.');
+ $this->assertTrue(isset($parents[$term1->tid]) && isset($parents[$term3->tid]), t('Both parents found successfully.'));
}
/**
@@ -437,26 +437,26 @@ class TaxonomyTermTestCase extends TaxonomyWebTestCase {
$langcode = LANGUAGE_NONE;
$edit["title"] = $this->randomName();
$edit["body[$langcode][0][value]"] = $this->randomName();
- $edit[$this->instance['field_name'] . '[' . $langcode . '][]'] = $term1->tid;
+ $edit[$this->instance['field_name'] . '[' . $langcode .'][]'] = $term1->tid;
$this->drupalPost('node/add/article', $edit, t('Save'));
// Check that the term is displayed when the node is viewed.
$node = $this->drupalGetNodeByTitle($edit["title"]);
$this->drupalGet('node/' . $node->nid);
- $this->assertText($term1->name, 'Term is displayed when viewing the node.');
+ $this->assertText($term1->name, t('Term is displayed when viewing the node.'));
// Edit the node with a different term.
$edit[$this->instance['field_name'] . '[' . $langcode . '][]'] = $term2->tid;
$this->drupalPost('node/' . $node->nid . '/edit', $edit, t('Save'));
$this->drupalGet('node/' . $node->nid);
- $this->assertText($term2->name, 'Term is displayed when viewing the node.');
+ $this->assertText($term2->name, t('Term is displayed when viewing the node.'));
//Preview the node
$this->drupalPost('node/' . $node->nid . '/edit', $edit, t('Preview'));
- $this->assertNoUniqueText($term2->name, 'Term is displayed when previewing the node.');
+ $this->assertNoUniqueText($term2->name, t('Term is displayed when previewing the node.'));
$this->drupalPost(NULL, NULL, t('Preview'));
- $this->assertNoUniqueText($term2->name, 'Term is displayed when previewing the node again.');
+ $this->assertNoUniqueText($term2->name, t('Term is displayed when previewing the node again.'));
}
/**
@@ -485,19 +485,19 @@ class TaxonomyTermTestCase extends TaxonomyWebTestCase {
// Preview and verify the terms appear but are not created.
$this->drupalPost('node/add/page', $edit, t('Preview'));
foreach ($terms as $term) {
- $this->assertText($term, 'The term appears on the node preview');
+ $this->assertText($term, t('The term appears on the node preview'));
}
$tree = taxonomy_get_tree($this->vocabulary->vid);
- $this->assertTrue(empty($tree), 'The terms are not created on preview.');
+ $this->assertTrue(empty($tree), t('The terms are not created on preview.'));
// taxonomy.module does not maintain its static caches.
drupal_static_reset();
// Save, creating the terms.
$this->drupalPost('node/add/page', $edit, t('Save'));
- $this->assertRaw(t('@type %title has been created.', array('@type' => t('Basic page'), '%title' => $edit["title"])), 'The node was created successfully');
+ $this->assertRaw(t('@type %title has been created.', array('@type' => t('Basic page'), '%title' => $edit["title"])), t('The node was created successfully'));
foreach ($terms as $term) {
- $this->assertText($term, 'The term was saved and appears on the node page');
+ $this->assertText($term, t('The term was saved and appears on the node page'));
}
// Get the created terms.
@@ -513,9 +513,9 @@ class TaxonomyTermTestCase extends TaxonomyWebTestCase {
$this->drupalGet('node/' . $node->nid);
foreach ($term_names as $term_name) {
- $this->assertText($term_name, 'The term ' . $term_name . ' appears on the node page after one term ' . $term1->name . ' was deleted');
+ $this->assertText($term_name, t('The term %name appears on the node page after one term %deleted was deleted', array('%name' => $term_name, '%deleted' => $term1->name)));
}
- $this->assertNoText($term1->name, 'The deleted term ' . $term1->name . ' does not appear on the node page.');
+ $this->assertNoText($term1->name, t('The deleted term %name does not appear on the node page.', array('%name' => $term1->name)));
}
/**
@@ -535,7 +535,7 @@ class TaxonomyTermTestCase extends TaxonomyWebTestCase {
$terms = taxonomy_get_term_by_name($edit['name']);
$term = reset($terms);
- $this->assertNotNull($term, 'Term found in database');
+ $this->assertNotNull($term, t('Term found in database'));
// Submitting a term takes us to the add page; we need the List page.
$this->drupalGet('admin/structure/taxonomy/' . $this->vocabulary->machine_name);
@@ -545,8 +545,8 @@ class TaxonomyTermTestCase extends TaxonomyWebTestCase {
// the first edit link found on the listing page is to our term.
$this->clickLink(t('edit'));
- $this->assertText($edit['name'], 'The randomly generated term name is present.');
- $this->assertText($edit['description[value]'], 'The randomly generated term description is present.');
+ $this->assertText($edit['name'], t('The randomly generated term name is present.'));
+ $this->assertText($edit['description[value]'], t('The randomly generated term description is present.'));
$edit = array(
'name' => $this->randomName(14),
@@ -558,13 +558,13 @@ class TaxonomyTermTestCase extends TaxonomyWebTestCase {
// Check that the term is still present at admin UI after edit.
$this->drupalGet('admin/structure/taxonomy/' . $this->vocabulary->machine_name);
- $this->assertText($edit['name'], 'The randomly generated term name is present.');
+ $this->assertText($edit['name'], t('The randomly generated term name is present.'));
$this->assertLink(t('edit'));
// View the term and check that it is correct.
$this->drupalGet('taxonomy/term/' . $term->tid);
- $this->assertText($edit['name'], 'The randomly generated term name is present.');
- $this->assertText($edit['description[value]'], 'The randomly generated term description is present.');
+ $this->assertText($edit['name'], t('The randomly generated term name is present.'));
+ $this->assertText($edit['description[value]'], t('The randomly generated term description is present.'));
// Check that the term feed page is working.
$this->drupalGet('taxonomy/term/' . $term->tid . '/feed');
@@ -575,7 +575,7 @@ class TaxonomyTermTestCase extends TaxonomyWebTestCase {
// Assert that the term no longer exists.
$this->drupalGet('taxonomy/term/' . $term->tid);
- $this->assertResponse(404, 'The taxonomy term page was not found');
+ $this->assertResponse(404, t('The taxonomy term page was not found'));
}
/**
@@ -619,9 +619,9 @@ class TaxonomyTermTestCase extends TaxonomyWebTestCase {
drupal_static_reset('taxonomy_get_treeparent');
drupal_static_reset('taxonomy_get_treeterms');
$terms = taxonomy_get_tree($this->vocabulary->vid);
- $this->assertEqual($terms[0]->tid, $term2->tid, 'Term 2 was moved above term 1.');
- $this->assertEqual($terms[1]->parents, array($term2->tid), 'Term 3 was made a child of term 2.');
- $this->assertEqual($terms[2]->tid, $term1->tid, 'Term 1 was moved below term 2.');
+ $this->assertEqual($terms[0]->tid, $term2->tid, t('Term 2 was moved above term 1.'));
+ $this->assertEqual($terms[1]->parents, array($term2->tid), t('Term 3 was made a child of term 2.'));
+ $this->assertEqual($terms[2]->tid, $term1->tid, t('Term 1 was moved below term 2.'));
$this->drupalPost('admin/structure/taxonomy/' . $this->vocabulary->machine_name, array(), t('Reset to alphabetical'));
// Submit confirmation form.
@@ -631,10 +631,10 @@ class TaxonomyTermTestCase extends TaxonomyWebTestCase {
drupal_static_reset('taxonomy_get_treeparent');
drupal_static_reset('taxonomy_get_treeterms');
$terms = taxonomy_get_tree($this->vocabulary->vid);
- $this->assertEqual($terms[0]->tid, $term1->tid, 'Term 1 was moved to back above term 2.');
- $this->assertEqual($terms[1]->tid, $term2->tid, 'Term 2 was moved to back below term 1.');
- $this->assertEqual($terms[2]->tid, $term3->tid, 'Term 3 is still below term 2.');
- $this->assertEqual($terms[2]->parents, array($term2->tid), 'Term 3 is still a child of term 2.');
+ $this->assertEqual($terms[0]->tid, $term1->tid, t('Term 1 was moved to back above term 2.'));
+ $this->assertEqual($terms[1]->tid, $term2->tid, t('Term 2 was moved to back below term 1.'));
+ $this->assertEqual($terms[2]->tid, $term3->tid, t('Term 3 is still below term 2.'));
+ $this->assertEqual($terms[2]->parents, array($term2->tid), t('Term 3 is still a child of term 2.').var_export($terms[1]->tid,1));
}
/**
@@ -645,19 +645,19 @@ class TaxonomyTermTestCase extends TaxonomyWebTestCase {
// Load the term with the exact name.
$terms = taxonomy_get_term_by_name($term->name);
- $this->assertTrue(isset($terms[$term->tid]), 'Term loaded using exact name.');
+ $this->assertTrue(isset($terms[$term->tid]), t('Term loaded using exact name.'));
// Load the term with space concatenated.
$terms = taxonomy_get_term_by_name(' ' . $term->name . ' ');
- $this->assertTrue(isset($terms[$term->tid]), 'Term loaded with extra whitespace.');
+ $this->assertTrue(isset($terms[$term->tid]), t('Term loaded with extra whitespace.'));
// Load the term with name uppercased.
$terms = taxonomy_get_term_by_name(strtoupper($term->name));
- $this->assertTrue(isset($terms[$term->tid]), 'Term loaded with uppercased name.');
+ $this->assertTrue(isset($terms[$term->tid]), t('Term loaded with uppercased name.'));
// Load the term with name lowercased.
$terms = taxonomy_get_term_by_name(strtolower($term->name));
- $this->assertTrue(isset($terms[$term->tid]), 'Term loaded with lowercased name.');
+ $this->assertTrue(isset($terms[$term->tid]), t('Term loaded with lowercased name.'));
// Try to load an invalid term name.
$terms = taxonomy_get_term_by_name('Banana');
@@ -705,12 +705,12 @@ class TaxonomyLoadMultipleUnitTest extends TaxonomyWebTestCase {
// Load the terms from the vocabulary.
$terms = taxonomy_term_load_multiple(NULL, array('vid' => $vocabulary->vid));
$count = count($terms);
- $this->assertTrue($count == 5, 'Correct number of terms were loaded. ' . $count . ' terms.');
+ $this->assertTrue($count == 5, t('Correct number of terms were loaded. !count terms.', array('!count' => $count)));
// Load the same terms again by tid.
$terms2 = taxonomy_term_load_multiple(array_keys($terms));
- $this->assertTrue($count == count($terms2), 'Five terms were loaded by tid');
- $this->assertEqual($terms, $terms2, 'Both arrays contain the same terms');
+ $this->assertTrue($count == count($terms2), t('Five terms were loaded by tid'));
+ $this->assertEqual($terms, $terms2, t('Both arrays contain the same terms'));
// Load the terms by tid, with a condition on vid.
$terms3 = taxonomy_term_load_multiple(array_keys($terms2), array('vid' => $vocabulary->vid));
@@ -724,15 +724,15 @@ class TaxonomyLoadMultipleUnitTest extends TaxonomyWebTestCase {
// Load terms from the vocabulary by vid.
$terms4 = taxonomy_term_load_multiple(NULL, array('vid' => $vocabulary->vid));
- $this->assertTrue(count($terms4 == 4), 'Correct number of terms were loaded.');
+ $this->assertTrue(count($terms4 == 4), t('Correct number of terms were loaded.'));
$this->assertFalse(isset($terms4[$deleted->tid]));
// Create a single term and load it by name.
$term = $this->createTerm($vocabulary);
$loaded_terms = taxonomy_term_load_multiple(array(), array('name' => $term->name));
- $this->assertEqual(count($loaded_terms), 1, 'One term was loaded');
+ $this->assertEqual(count($loaded_terms), 1, t('One term was loaded'));
$loaded_term = reset($loaded_terms);
- $this->assertEqual($term->tid, $loaded_term->tid, 'Term loaded by name successfully.');
+ $this->assertEqual($term->tid, $loaded_term->tid, t('Term loaded by name successfully.'));
}
}
@@ -768,7 +768,7 @@ class TaxonomyHooksTestCase extends TaxonomyWebTestCase {
$this->drupalPost('admin/structure/taxonomy/' . $vocabulary->machine_name . '/add', $edit, t('Save'));
$terms = taxonomy_get_term_by_name($edit['name']);
$term = reset($terms);
- $this->assertEqual($term->antonym, $edit['antonym'], 'Antonym was loaded into the term object');
+ $this->assertEqual($term->antonym, $edit['antonym'], t('Antonym was loaded into the term object'));
// Update the term with a different antonym.
$edit = array(
@@ -778,12 +778,12 @@ class TaxonomyHooksTestCase extends TaxonomyWebTestCase {
$this->drupalPost('taxonomy/term/' . $term->tid . '/edit', $edit, t('Save'));
taxonomy_terms_static_reset();
$term = taxonomy_term_load($term->tid);
- $this->assertEqual($edit['antonym'], $term->antonym, 'Antonym was successfully edited');
+ $this->assertEqual($edit['antonym'], $term->antonym, t('Antonym was successfully edited'));
// Delete the term.
taxonomy_term_delete($term->tid);
$antonym = db_query('SELECT tid FROM {taxonomy_term_antonym} WHERE tid = :tid', array(':tid' => $term->tid))->fetchField();
- $this->assertFalse($antonym, 'The antonym were deleted from the database.');
+ $this->assertFalse($antonym, t('The antonym were deleted from the database.'));
}
}
@@ -852,10 +852,10 @@ class TaxonomyTermFieldTestCase extends TaxonomyWebTestCase {
$entity->{$this->field_name}[$langcode][0]['tid'] = $term->tid;
try {
field_attach_validate('test_entity', $entity);
- $this->pass('Correct term does not cause validation error');
+ $this->pass(t('Correct term does not cause validation error'));
}
catch (FieldValidationException $e) {
- $this->fail('Correct term does not cause validation error');
+ $this->fail(t('Correct term does not cause validation error'));
}
$entity = field_test_create_stub_entity();
@@ -863,10 +863,10 @@ class TaxonomyTermFieldTestCase extends TaxonomyWebTestCase {
$entity->{$this->field_name}[$langcode][0]['tid'] = $bad_term->tid;
try {
field_attach_validate('test_entity', $entity);
- $this->fail('Wrong term causes validation error');
+ $this->fail(t('Wrong term causes validation error'));
}
catch (FieldValidationException $e) {
- $this->pass('Wrong term causes validation error');
+ $this->pass(t('Wrong term causes validation error'));
}
}
@@ -912,7 +912,7 @@ class TaxonomyTermFieldTestCase extends TaxonomyWebTestCase {
// Display creation form.
$langcode = LANGUAGE_NONE;
$this->drupalGet('test-entity/add/test-bundle');
- $this->assertFieldByName("{$this->field_name}[$langcode]", '', 'Widget is displayed');
+ $this->assertFieldByName("{$this->field_name}[$langcode]", '', t('Widget is displayed'));
// Submit with some value.
$edit = array(
@@ -921,7 +921,7 @@ class TaxonomyTermFieldTestCase extends TaxonomyWebTestCase {
$this->drupalPost(NULL, $edit, t('Save'));
preg_match('|test-entity/(\d+)/edit|', $this->url, $match);
$id = $match[1];
- $this->assertRaw(t('test_entity @id has been created.', array('@id' => $id)), 'Entity was created');
+ $this->assertRaw(t('test_entity @id has been created.', array('@id' => $id)), t('Entity was created'));
// Display the object.
$entity = field_test_entity_test_load($id);
@@ -929,7 +929,7 @@ class TaxonomyTermFieldTestCase extends TaxonomyWebTestCase {
field_attach_prepare_view($entity_type, $entities, 'full');
$entity->content = field_attach_view($entity_type, $entity, 'full');
$this->content = drupal_render($entity->content);
- $this->assertText($term->name, 'Term name is displayed');
+ $this->assertText($term->name, t('Term name is displayed'));
}
}
@@ -1014,10 +1014,10 @@ class TaxonomyTokenReplaceTestCase extends TaxonomyWebTestCase {
$tests['[term:node-count]'] = 0;
$tests['[term:parent:name]'] = '[term:parent:name]';
$tests['[term:vocabulary:name]'] = check_plain($this->vocabulary->name);
-
+
foreach ($tests as $input => $expected) {
$output = token_replace($input, array('term' => $term1), array('language' => $language));
- $this->assertFalse(strcmp($output, $expected), 'Sanitized taxonomy term token ' . $input . ' replaced.');
+ $this->assertFalse(strcmp($output, $expected), t('Sanitized taxonomy term token %token replaced.', array('%token' => $input)));
}
// Generate and test sanitized tokens for term2.
@@ -1031,11 +1031,11 @@ class TaxonomyTokenReplaceTestCase extends TaxonomyWebTestCase {
$tests['[term:vocabulary:name]'] = check_plain($this->vocabulary->name);
// Test to make sure that we generated something for each token.
- $this->assertFalse(in_array(0, array_map('strlen', $tests)), 'No empty tokens generated.');
+ $this->assertFalse(in_array(0, array_map('strlen', $tests)), t('No empty tokens generated.'));
foreach ($tests as $input => $expected) {
$output = token_replace($input, array('term' => $term2), array('language' => $language));
- $this->assertFalse(strcmp($output, $expected), 'Sanitized taxonomy term token ' . $input . ' replaced.');
+ $this->assertFalse(strcmp($output, $expected), t('Sanitized taxonomy term token %token replaced.', array('%token' => $input)));
}
// Generate and test unsanitized tokens.
@@ -1046,7 +1046,7 @@ class TaxonomyTokenReplaceTestCase extends TaxonomyWebTestCase {
foreach ($tests as $input => $expected) {
$output = token_replace($input, array('term' => $term2), array('language' => $language, 'sanitize' => FALSE));
- $this->assertFalse(strcmp($output, $expected), 'Unsanitized taxonomy term token ' . $input . ' replaced.');
+ $this->assertFalse(strcmp($output, $expected), t('Unsanitized taxonomy term token %token replaced.', array('%token' => $input)));
}
// Generate and test sanitized tokens.
@@ -1058,11 +1058,11 @@ class TaxonomyTokenReplaceTestCase extends TaxonomyWebTestCase {
$tests['[vocabulary:term-count]'] = 2;
// Test to make sure that we generated something for each token.
- $this->assertFalse(in_array(0, array_map('strlen', $tests)), 'No empty tokens generated.');
+ $this->assertFalse(in_array(0, array_map('strlen', $tests)), t('No empty tokens generated.'));
foreach ($tests as $input => $expected) {
$output = token_replace($input, array('vocabulary' => $this->vocabulary), array('language' => $language));
- $this->assertFalse(strcmp($output, $expected), 'Sanitized taxonomy vocabulary token ' . $input . ' replaced.');
+ $this->assertFalse(strcmp($output, $expected), t('Sanitized taxonomy vocabulary token %token replaced.', array('%token' => $input)));
}
// Generate and test unsanitized tokens.
@@ -1071,7 +1071,7 @@ class TaxonomyTokenReplaceTestCase extends TaxonomyWebTestCase {
foreach ($tests as $input => $expected) {
$output = token_replace($input, array('vocabulary' => $this->vocabulary), array('language' => $language, 'sanitize' => FALSE));
- $this->assertFalse(strcmp($output, $expected), 'Unsanitized taxonomy vocabulary token ' . $input . ' replaced.');
+ $this->assertFalse(strcmp($output, $expected), t('Unsanitized taxonomy vocabulary token %token replaced.', array('%token' => $input)));
}
}
}
diff --git a/modules/tracker/tracker.test b/modules/tracker/tracker.test
index 109a632ba..12dc9d48d 100644
--- a/modules/tracker/tracker.test
+++ b/modules/tracker/tracker.test
@@ -32,7 +32,7 @@ class TrackerTest extends DrupalWebTestCase {
$this->drupalLogin($this->user);
$unpublished = $this->drupalCreateNode(array(
- 'title' => $this->randomName(8),
+ 'title' =>$this->randomName(8),
'status' => 0,
));
$published = $this->drupalCreateNode(array(
@@ -41,9 +41,9 @@ class TrackerTest extends DrupalWebTestCase {
));
$this->drupalGet('tracker');
- $this->assertNoText($unpublished->title, 'Unpublished node do not show up in the tracker listing.');
- $this->assertText($published->title, 'Published node show up in the tracker listing.');
- $this->assertLink(t('My recent content'), 0, 'User tab shows up on the global tracker page.');
+ $this->assertNoText($unpublished->title, t('Unpublished node do not show up in the tracker listing.'));
+ $this->assertText($published->title, t('Published node show up in the tracker listing.'));
+ $this->assertLink(t('My recent content'), 0, t('User tab shows up on the global tracker page.'));
}
/**
@@ -79,10 +79,10 @@ class TrackerTest extends DrupalWebTestCase {
$this->drupalPost('comment/reply/' . $other_published_my_comment->nid, $comment, t('Save'));
$this->drupalGet('user/' . $this->user->uid . '/track');
- $this->assertNoText($unpublished->title, "Unpublished nodes do not show up in the users's tracker listing.");
- $this->assertText($my_published->title, "Published nodes show up in the user's tracker listing.");
- $this->assertNoText($other_published_no_comment->title, "Other user's nodes do not show up in the user's tracker listing.");
- $this->assertText($other_published_my_comment->title, "Nodes that the user has commented on appear in the user's tracker listing.");
+ $this->assertNoText($unpublished->title, t("Unpublished nodes do not show up in the users's tracker listing."));
+ $this->assertText($my_published->title, t("Published nodes show up in the user's tracker listing."));
+ $this->assertNoText($other_published_no_comment->title, t("Other user's nodes do not show up in the user's tracker listing."));
+ $this->assertText($other_published_my_comment->title, t("Nodes that the user has commented on appear in the user's tracker listing."));
// Verify that unpublished comments are removed from the tracker.
$admin_user = $this->drupalCreateUser(array('administer comments', 'access user profiles'));
@@ -105,19 +105,19 @@ class TrackerTest extends DrupalWebTestCase {
$node = $this->drupalCreateNode($edit);
$title = $edit['title'];
$this->drupalGet('tracker');
- $this->assertPattern('/' . $title . '.*new/', 'New nodes are flagged as such in the tracker listing.');
+ $this->assertPattern('/' . $title . '.*new/', t('New nodes are flagged as such in the tracker listing.'));
$this->drupalGet('node/' . $node->nid);
$this->drupalGet('tracker');
- $this->assertNoPattern('/' . $title . '.*new/', 'Visited nodes are not flagged as new.');
+ $this->assertNoPattern('/' . $title . '.*new/', t('Visited nodes are not flagged as new.'));
$this->drupalLogin($this->other_user);
$this->drupalGet('tracker');
- $this->assertPattern('/' . $title . '.*new/', 'For another user, new nodes are flagged as such in the tracker listing.');
+ $this->assertPattern('/' . $title . '.*new/', t('For another user, new nodes are flagged as such in the tracker listing.'));
$this->drupalGet('node/' . $node->nid);
$this->drupalGet('tracker');
- $this->assertNoPattern('/' . $title . '.*new/', 'For another user, visited nodes are not flagged as new.');
+ $this->assertNoPattern('/' . $title . '.*new/', t('For another user, visited nodes are not flagged as new.'));
}
/**
@@ -140,7 +140,7 @@ class TrackerTest extends DrupalWebTestCase {
$this->drupalLogin($this->other_user);
$this->drupalGet('tracker');
- $this->assertText('1 new', 'New comments are counted on the tracker listing pages.');
+ $this->assertText('1 new', t('New comments are counted on the tracker listing pages.'));
$this->drupalGet('node/' . $node->nid);
// Add another comment as other_user.
@@ -155,7 +155,7 @@ class TrackerTest extends DrupalWebTestCase {
$this->drupalLogin($this->user);
$this->drupalGet('tracker');
- $this->assertText('1 new', 'New comments are counted on the tracker listing pages.');
+ $this->assertText('1 new', t('New comments are counted on the tracker listing pages.'));
}
/**
@@ -200,10 +200,10 @@ class TrackerTest extends DrupalWebTestCase {
// Assert that all node titles are displayed.
foreach ($nodes as $i => $node) {
- $this->assertText($node->title, 'Node ' . $i . ' is displayed on the tracker listing pages.');
+ $this->assertText($node->title, t('Node @i is displayed on the tracker listing pages.', array('@i' => $i)));
}
- $this->assertText('1 new', 'New comment is counted on the tracker listing pages.');
- $this->assertText('updated', 'Node is listed as updated');
+ $this->assertText('1 new', t('New comment is counted on the tracker listing pages.'));
+ $this->assertText('updated', t('Node is listed as updated'));
// Fetch the site-wide tracker.
@@ -211,9 +211,9 @@ class TrackerTest extends DrupalWebTestCase {
// Assert that all node titles are displayed.
foreach ($nodes as $i => $node) {
- $this->assertText($node->title, 'Node ' . $i . ' is displayed on the tracker listing pages.');
+ $this->assertText($node->title, t('Node @i is displayed on the tracker listing pages.', array('@i' => $i)));
}
- $this->assertText('1 new', 'New comment is counted on the tracker listing pages.');
+ $this->assertText('1 new', t('New comment is counted on the tracker listing pages.'));
}
/**
@@ -230,7 +230,7 @@ class TrackerTest extends DrupalWebTestCase {
// Assert that the node is displayed.
$this->drupalGet('tracker');
- $this->assertText($node->title, 'Node is displayed on the tracker listing pages.');
+ $this->assertText($node->title, t('Node is displayed on the tracker listing pages.'));
// Unpublish the node and ensure that it's no longer displayed.
$edit = array(
@@ -240,6 +240,6 @@ class TrackerTest extends DrupalWebTestCase {
$this->drupalPost('admin/content', $edit, t('Update'));
$this->drupalGet('tracker');
- $this->assertText(t('No content available.'), 'Node is displayed on the tracker listing pages.');
+ $this->assertText(t('No content available.'), t('Node is displayed on the tracker listing pages.'));
}
}
diff --git a/modules/translation/translation.test b/modules/translation/translation.test
index 79a72853a..d72fd390a 100644
--- a/modules/translation/translation.test
+++ b/modules/translation/translation.test
@@ -35,7 +35,7 @@ class TranslationTestCase extends DrupalWebTestCase {
$edit = array();
$edit['language_content_type'] = 2;
$this->drupalPost('admin/structure/types/manage/page', $edit, t('Save content type'));
- $this->assertRaw(t('The content type %type has been updated.', array('%type' => 'Basic page')), 'Basic page content type has been updated.');
+ $this->assertRaw(t('The content type %type has been updated.', array('%type' => 'Basic page')), t('Basic page content type has been updated.'));
$this->drupalLogout();
$this->drupalLogin($translator);
@@ -54,7 +54,7 @@ class TranslationTestCase extends DrupalWebTestCase {
// with identical query string.
$languages = language_list();
$this->drupalGet('node/add/page', array('query' => array('translation' => $node->nid, 'target' => 'es')));
- $this->assertRaw(t('A translation of %title in %language already exists', array('%title' => $node_title, '%language' => $languages['es']->name)), 'Message regarding attempted duplicate translation is displayed.');
+ $this->assertRaw(t('A translation of %title in %language already exists', array('%title' => $node_title, '%language' => $languages['es']->name)), t('Message regarding attempted duplicate translation is displayed.'));
// Attempt a resubmission of the form - this emulates using the back button
// to return to the page then resubmitting the form without a refresh.
@@ -64,25 +64,25 @@ class TranslationTestCase extends DrupalWebTestCase {
$edit["body[$langcode][0][value]"] = $this->randomName();
$this->drupalPost('node/add/page', $edit, t('Save'), array('query' => array('translation' => $node->nid, 'language' => 'es')));
$duplicate = $this->drupalGetNodeByTitle($edit["title"]);
- $this->assertEqual($duplicate->tnid, 0, 'The node does not have a tnid.');
+ $this->assertEqual($duplicate->tnid, 0, t('The node does not have a tnid.'));
// Update original and mark translation as outdated.
$edit = array();
$edit["body[$node->language][0][value]"] = $this->randomName();
$edit['translation[retranslate]'] = TRUE;
$this->drupalPost('node/' . $node->nid . '/edit', $edit, t('Save'));
- $this->assertRaw(t('Basic page %title has been updated.', array('%title' => $node_title)), 'Original node updated.');
+ $this->assertRaw(t('Basic page %title has been updated.', array('%title' => $node_title)), t('Original node updated.'));
// Check to make sure that interface shows translation as outdated
$this->drupalGet('node/' . $node->nid . '/translate');
- $this->assertRaw('<span class="marker">' . t('outdated') . '</span>', 'Translation marked as outdated.');
+ $this->assertRaw('<span class="marker">' . t('outdated') . '</span>', t('Translation marked as outdated.'));
// Update translation and mark as updated.
$edit = array();
$edit["body[$node_translation->language][0][value]"] = $this->randomName();
$edit['translation[status]'] = FALSE;
$this->drupalPost('node/' . $node_translation->nid . '/edit', $edit, t('Save'));
- $this->assertRaw(t('Basic page %title has been updated.', array('%title' => $node_translation_title)), 'Translated node updated.');
+ $this->assertRaw(t('Basic page %title has been updated.', array('%title' => $node_translation_title)), t('Translated node updated.'));
}
/**
@@ -104,10 +104,10 @@ class TranslationTestCase extends DrupalWebTestCase {
// Make sure we're not using a stale list.
drupal_static_reset('language_list');
$languages = language_list('language');
- $this->assertTrue(array_key_exists($language_code, $languages), 'Language was installed successfully.');
+ $this->assertTrue(array_key_exists($language_code, $languages), t('Language was installed successfully.'));
if (array_key_exists($language_code, $languages)) {
- $this->assertRaw(t('The language %language has been created and can now be used. More information is available on the <a href="@locale-help">help screen</a>.', array('%language' => $languages[$language_code]->name, '@locale-help' => url('admin/help/locale'))), 'Language has been created.');
+ $this->assertRaw(t('The language %language has been created and can now be used. More information is available on the <a href="@locale-help">help screen</a>.', array('%language' => $languages[$language_code]->name, '@locale-help' => url('admin/help/locale'))), t('Language has been created.'));
}
}
elseif ($this->xpath('//input[@type="checkbox" and @name=:name and @checked="checked"]', array(':name' => 'enabled[' . $language_code . ']'))) {
@@ -118,7 +118,7 @@ class TranslationTestCase extends DrupalWebTestCase {
// It's installed but not enabled. Enable it.
$this->assertTrue(true, 'Language [' . $language_code . '] already installed.');
$this->drupalPost(NULL, array('enabled[' . $language_code . ']' => TRUE), t('Save configuration'));
- $this->assertRaw(t('Configuration saved.'), 'Language successfully enabled.');
+ $this->assertRaw(t('Configuration saved.'), t('Language successfully enabled.'));
}
}
@@ -136,11 +136,11 @@ class TranslationTestCase extends DrupalWebTestCase {
$edit["body[$langcode][0][value]"] = $body;
$edit['language'] = $language;
$this->drupalPost('node/add/page', $edit, t('Save'));
- $this->assertRaw(t('Basic page %title has been created.', array('%title' => $title)), 'Basic page created.');
+ $this->assertRaw(t('Basic page %title has been created.', array('%title' => $title)), t('Basic page created.'));
// Check to make sure the node was created.
$node = $this->drupalGetNodeByTitle($title);
- $this->assertTrue($node, 'Node found in database.');
+ $this->assertTrue($node, t('Node found in database.'));
return $node;
}
@@ -164,11 +164,11 @@ class TranslationTestCase extends DrupalWebTestCase {
$edit["title"] = $title;
$edit[$body_key] = $body;
$this->drupalPost(NULL, $edit, t('Save'));
- $this->assertRaw(t('Basic page %title has been created.', array('%title' => $title)), 'Translation created.');
+ $this->assertRaw(t('Basic page %title has been created.', array('%title' => $title)), t('Translation created.'));
// Check to make sure that translation was successful.
$node = $this->drupalGetNodeByTitle($title);
- $this->assertTrue($node, 'Node found in database.');
+ $this->assertTrue($node, t('Node found in database.'));
return $node;
}
diff --git a/modules/trigger/trigger.test b/modules/trigger/trigger.test
index b4d0490d7..6d60eda9e 100644
--- a/modules/trigger/trigger.test
+++ b/modules/trigger/trigger.test
@@ -78,10 +78,10 @@ class TriggerContentTestCase extends TriggerWebTestCase {
$edit[$info['property']] = !$info['expected'];
$this->drupalPost('node/add/page', $edit, t('Save'));
// Make sure the text we want appears.
- $this->assertRaw(t('!post %title has been created.', array('!post' => 'Basic page', '%title' => $edit["title"])), 'Make sure the Basic page has actually been created');
+ $this->assertRaw(t('!post %title has been created.', array('!post' => 'Basic page', '%title' => $edit["title"])), t('Make sure the Basic page has actually been created'));
// Action should have been fired.
$loaded_node = $this->drupalGetNodeByTitle($edit["title"]);
- $this->assertTrue($loaded_node->$info['property'] == $info['expected'], 'Make sure the ' . $info['name'] . ' action fired.');
+ $this->assertTrue($loaded_node->$info['property'] == $info['expected'], t('Make sure the @action action fired.', array('@action' => $info['name'])));
// Leave action assigned for next test
// There should be an error when the action is assigned to the trigger
@@ -90,13 +90,13 @@ class TriggerContentTestCase extends TriggerWebTestCase {
// This action already assigned in this test.
$edit = array('aid' => $hash);
$this->drupalPost('admin/structure/trigger/node', $edit, t('Assign'), array(), array(), 'trigger-node-presave-assign-form');
- $this->assertRaw(t('The action you chose is already assigned to that trigger.'), 'Check to make sure an error occurs when assigning an action to a trigger twice.');
+ $this->assertRaw(t('The action you chose is already assigned to that trigger.'), t('Check to make sure an error occurs when assigning an action to a trigger twice.'));
// The action should be able to be unassigned from a trigger.
$this->drupalPost('admin/structure/trigger/unassign/node/node_presave/' . $hash, array(), t('Unassign'));
- $this->assertRaw(t('Action %action has been unassigned.', array('%action' => ucfirst($info['name']))), 'Check to make sure the ' . $info['name'] . ' action can be unassigned from the trigger.');
+ $this->assertRaw(t('Action %action has been unassigned.', array('%action' => ucfirst($info['name']))), t('Check to make sure the @action action can be unassigned from the trigger.', array('@action' => $info['name'])));
$assigned = db_query("SELECT COUNT(*) FROM {trigger_assignments} WHERE aid IN (:keys)", array(':keys' => $content_actions))->fetchField();
- $this->assertFalse($assigned, 'Check to make sure unassign worked properly at the database level.');
+ $this->assertFalse($assigned, t('Check to make sure unassign worked properly at the database level.'));
}
}
@@ -128,7 +128,7 @@ class TriggerContentTestCase extends TriggerWebTestCase {
);
$this->drupalPost('admin/content', $edit, t('Update'));
$count = variable_get('trigger_test_generic_any_action', 0);
- $this->assertTrue($count == 2, 'Action was triggered 2 times. Actual: ' . $count);
+ $this->assertTrue($count == 2, t('Action was triggered 2 times. Actual: %count', array('%count' => $count)));
}
/**
@@ -238,11 +238,11 @@ class TriggerCronTestCase extends TriggerWebTestCase {
// Make sure the non-configurable action has fired.
$action_run = variable_get('trigger_test_system_cron_action', FALSE);
- $this->assertTrue($action_run, 'Check that the cron run triggered the test action.');
+ $this->assertTrue($action_run, t('Check that the cron run triggered the test action.'));
// Make sure that both configurable actions have fired.
$action_run = variable_get('trigger_test_system_cron_conf_action', 0) == 2;
- $this->assertTrue($action_run, 'Check that the cron run triggered both complex actions.');
+ $this->assertTrue($action_run, t('Check that the cron run triggered both complex actions.'));
}
}
@@ -298,7 +298,7 @@ class TriggerActionTestCase extends TriggerWebTestCase {
'@user_created' => isset($account->created) ? format_date($account->created, 'medium') : t('not yet created'),
)
);
- return trim($message);
+ return trim($message);
}
@@ -317,7 +317,7 @@ class TriggerActionTestCase extends TriggerWebTestCase {
$trigger_type = preg_replace('/_.*/', '', $trigger);
$this->drupalPost("admin/structure/trigger/$trigger_type", $edit, t('Assign'), array(), array(), $form_html_id);
$actions = trigger_get_assigned_actions($trigger);
- $this->assertTrue(!empty($actions[$action]), 'Simple action ' . $action . ' assigned to trigger ' . $trigger);
+ $this->assertTrue(!empty($actions[$action]), t('Simple action @action assigned to trigger @trigger', array('@action' => $action, '@trigger' => $trigger)));
}
/**
@@ -395,7 +395,8 @@ class TriggerActionTestCase extends TriggerWebTestCase {
*/
function assertSystemMessageTokenReplacement($trigger, $account) {
$expected = $this->generateTokenExpandedComparison($trigger, $account);
- $this->assertText($expected, 'Expected system message to contain token-replaced text "' . $expected . '" found in configured system message action');
+ $this->assertText($expected,
+ t('Expected system message to contain token-replaced text "@expected" found in configured system message action', array('@expected' => $expected )) );
}
@@ -414,7 +415,7 @@ class TriggerActionTestCase extends TriggerWebTestCase {
$expected = $this->generateTokenExpandedComparison($trigger, $account);
$this->assertMailString('subject', $expected, $email_depth);
$this->assertMailString('body', $expected, $email_depth);
- $this->assertMail('to', $account->mail, 'Mail sent to correct destination');
+ $this->assertMail('to', $account->mail, t('Mail sent to correct destination'));
}
}
@@ -510,7 +511,7 @@ class TriggerUserActionTestCase extends TriggerActionTestCase {
$this->drupalPost("node/{$node->nid}", array('comment_body[und][0][value]' => t("my comment"), 'subject' => t("my comment subject")), t('Save'));
// Posting a comment should have blocked this user.
$account = user_load($test_user->uid, TRUE);
- $this->assertTrue($account->status == 0, 'Account is blocked');
+ $this->assertTrue($account->status == 0, t('Account is blocked'));
$comment_author_uid = $account->uid;
// Now rehabilitate the comment author so it can be be blocked again when
// the comment is updated.
@@ -522,7 +523,7 @@ class TriggerUserActionTestCase extends TriggerActionTestCase {
// Our original comment will have been comment 1.
$this->drupalPost("comment/1/edit", array('comment_body[und][0][value]' => t("my comment, updated"), 'subject' => t("my comment subject")), t('Save'));
$comment_author_account = user_load($comment_author_uid, TRUE);
- $this->assertTrue($comment_author_account->status == 0, 'Comment author account (uid=' . $comment_author_uid . ') is blocked after update to comment');
+ $this->assertTrue($comment_author_account->status == 0, t('Comment author account (uid=@uid) is blocked after update to comment', array('@uid' => $comment_author_uid)));
// Verify that the comment was updated.
$test_user = $this->drupalCreateUser(array('administer actions', 'create article content', 'access comments', 'administer comments', 'post comments without approval', 'edit own comments'));
@@ -582,7 +583,7 @@ class TriggerOtherTestCase extends TriggerWebTestCase {
$this->drupalPost('admin/people/create', $edit, t('Create new account'));
// Verify that the action variable has been set.
- $this->assertTrue(variable_get($action_id, FALSE), 'Check that creating a user triggered the test action.');
+ $this->assertTrue(variable_get($action_id, FALSE), t('Check that creating a user triggered the test action.'));
// Reset the action variable.
variable_set($action_id, FALSE);
@@ -601,11 +602,11 @@ class TriggerOtherTestCase extends TriggerWebTestCase {
// Verify that the action has been assigned to the correct hook.
$actions = trigger_get_assigned_actions('user_login');
- $this->assertEqual(1, count($actions), 'One Action assigned to the hook');
- $this->assertEqual($actions[$aid]['label'], $action_edit['actions_label'], 'Correct action label found.');
+ $this->assertEqual(1, count($actions), t('One Action assigned to the hook'));
+ $this->assertEqual($actions[$aid]['label'], $action_edit['actions_label'], t('Correct action label found.'));
// User should get the configured message at login.
- $contact_user = $this->drupalCreateUser(array('access site-wide contact form'));
+ $contact_user = $this->drupalCreateUser(array('access site-wide contact form'));;
$this->drupalLogin($contact_user);
$this->assertText($action_edit['message']);
}
@@ -636,7 +637,7 @@ class TriggerOtherTestCase extends TriggerWebTestCase {
$this->drupalPost(NULL, $edit, t('Save'));
// Verify that the action variable has been set.
- $this->assertTrue(variable_get($action_id, FALSE), 'Check that creating a comment triggered the action.');
+ $this->assertTrue(variable_get($action_id, FALSE), t('Check that creating a comment triggered the action.'));
}
/**
@@ -672,7 +673,7 @@ class TriggerOtherTestCase extends TriggerWebTestCase {
taxonomy_term_save($term);
// Verify that the action variable has been set.
- $this->assertTrue(variable_get($action_id, FALSE), 'Check that creating a taxonomy term triggered the action.');
+ $this->assertTrue(variable_get($action_id, FALSE), t('Check that creating a taxonomy term triggered the action.'));
}
}
@@ -716,10 +717,10 @@ class TriggerOrphanedActionsTestCase extends DrupalWebTestCase {
$edit["title"] = '!SimpleTest test node! ' . $this->randomName(10);
$edit["body[$langcode][0][value]"] = '!SimpleTest test body! ' . $this->randomName(32) . ' ' . $this->randomName(32);
$this->drupalPost('node/add/page', $edit, t('Save'));
- $this->assertRaw(t('!post %title has been created.', array('!post' => 'Basic page', '%title' => $edit["title"])), 'Make sure the Basic page has actually been created');
+ $this->assertRaw(t('!post %title has been created.', array('!post' => 'Basic page', '%title' => $edit["title"])), t('Make sure the Basic page has actually been created'));
// Action should have been fired.
- $this->assertTrue(variable_get('trigger_test_generic_any_action', FALSE), 'Trigger test action successfully fired.');
+ $this->assertTrue(variable_get('trigger_test_generic_any_action', FALSE), t('Trigger test action successfully fired.'));
// Disable the module that provides the action and make sure the trigger
// doesn't white screen.
@@ -730,6 +731,6 @@ class TriggerOrphanedActionsTestCase extends DrupalWebTestCase {
// If the node body was updated successfully we have dealt with the
// unavailable action.
- $this->assertRaw(t('!post %title has been updated.', array('!post' => 'Basic page', '%title' => $edit["title"])), 'Make sure the Basic page can be updated with the missing trigger function.');
+ $this->assertRaw(t('!post %title has been updated.', array('!post' => 'Basic page', '%title' => $edit["title"])), t('Make sure the Basic page can be updated with the missing trigger function.'));
}
}
diff --git a/modules/update/update.test b/modules/update/update.test
index 3b554b98d..66f7907fe 100644
--- a/modules/update/update.test
+++ b/modules/update/update.test
@@ -45,7 +45,7 @@ class UpdateTestHelper extends DrupalWebTestCase {
*/
protected function standardTests() {
$this->assertRaw('<h3>' . t('Drupal core') . '</h3>');
- $this->assertRaw(l(t('Drupal'), 'http://example.com/project/drupal'), 'Link to the Drupal project appears.');
+ $this->assertRaw(l(t('Drupal'), 'http://example.com/project/drupal'), t('Link to the Drupal project appears.'));
$this->assertNoText(t('No available releases found'));
}
@@ -89,9 +89,9 @@ class UpdateCoreTestCase extends UpdateTestHelper {
$this->assertNoText(t('Up to date'));
$this->assertText(t('Update available'));
$this->assertNoText(t('Security update required!'));
- $this->assertRaw(l('7.1', 'http://example.com/drupal-7-1-release'), 'Link to release appears.');
- $this->assertRaw(l(t('Download'), 'http://example.com/drupal-7-1.tar.gz'), 'Link to download appears.');
- $this->assertRaw(l(t('Release notes'), 'http://example.com/drupal-7-1-release'), 'Link to release notes appears.');
+ $this->assertRaw(l('7.1', 'http://example.com/drupal-7-1-release'), t('Link to release appears.'));
+ $this->assertRaw(l(t('Download'), 'http://example.com/drupal-7-1.tar.gz'), t('Link to download appears.'));
+ $this->assertRaw(l(t('Release notes'), 'http://example.com/drupal-7-1-release'), t('Link to release notes appears.'));
}
/**
@@ -104,9 +104,9 @@ class UpdateCoreTestCase extends UpdateTestHelper {
$this->assertNoText(t('Up to date'));
$this->assertNoText(t('Update available'));
$this->assertText(t('Security update required!'));
- $this->assertRaw(l('7.2', 'http://example.com/drupal-7-2-release'), 'Link to release appears.');
- $this->assertRaw(l(t('Download'), 'http://example.com/drupal-7-2.tar.gz'), 'Link to download appears.');
- $this->assertRaw(l(t('Release notes'), 'http://example.com/drupal-7-2-release'), 'Link to release notes appears.');
+ $this->assertRaw(l('7.2', 'http://example.com/drupal-7-2-release'), t('Link to release appears.'));
+ $this->assertRaw(l(t('Download'), 'http://example.com/drupal-7-2.tar.gz'), t('Link to download appears.'));
+ $this->assertRaw(l(t('Release notes'), 'http://example.com/drupal-7-2-release'), t('Link to release notes appears.'));
}
/**
@@ -263,7 +263,7 @@ class UpdateTestContribCase extends UpdateTestHelper {
$this->assertText(t('Up to date'));
$this->assertRaw('<h3>' . t('Modules') . '</h3>');
$this->assertNoText(t('Update available'));
- $this->assertRaw(l(t('AAA Update test'), 'http://example.com/project/aaa_update_test'), 'Link to aaa_update_test project appears.');
+ $this->assertRaw(l(t('AAA Update test'), 'http://example.com/project/aaa_update_test'), t('Link to aaa_update_test project appears.'));
}
/**
@@ -324,10 +324,10 @@ class UpdateTestContribCase extends UpdateTestHelper {
$this->assertText(t('CCC Update test'));
// We want aaa_update_test included in the ccc_update_test project, not as
// its own project on the report.
- $this->assertNoRaw(l(t('AAA Update test'), 'http://example.com/project/aaa_update_test'), 'Link to aaa_update_test project does not appear.');
+ $this->assertNoRaw(l(t('AAA Update test'), 'http://example.com/project/aaa_update_test'), t('Link to aaa_update_test project does not appear.'));
// The other two should be listed as projects.
- $this->assertRaw(l(t('BBB Update test'), 'http://example.com/project/bbb_update_test'), 'Link to bbb_update_test project appears.');
- $this->assertRaw(l(t('CCC Update test'), 'http://example.com/project/ccc_update_test'), 'Link to bbb_update_test project appears.');
+ $this->assertRaw(l(t('BBB Update test'), 'http://example.com/project/bbb_update_test'), t('Link to bbb_update_test project appears.'));
+ $this->assertRaw(l(t('CCC Update test'), 'http://example.com/project/ccc_update_test'), t('Link to bbb_update_test project appears.'));
// We want to make sure we see the BBB project before the CCC project.
// Instead of just searching for 'BBB Update test' or something, we want
@@ -376,7 +376,7 @@ class UpdateTestContribCase extends UpdateTestHelper {
);
$this->refreshUpdateStatus($xml_mapping);
$this->assertText(t('Security update required!'));
- $this->assertRaw(l(t('Update test base theme'), 'http://example.com/project/update_test_basetheme'), 'Link to the Update test base theme project appears.');
+ $this->assertRaw(l(t('Update test base theme'), 'http://example.com/project/update_test_basetheme'), t('Link to the Update test base theme project appears.'));
}
/**
@@ -424,13 +424,13 @@ class UpdateTestContribCase extends UpdateTestHelper {
$this->assertNoText(t('Themes'));
if ($check_disabled) {
$this->assertText(t('Disabled themes'));
- $this->assertRaw($base_theme_project_link, 'Link to the Update test base theme project appears.');
- $this->assertRaw($sub_theme_project_link, 'Link to the Update test subtheme project appears.');
+ $this->assertRaw($base_theme_project_link, t('Link to the Update test base theme project appears.'));
+ $this->assertRaw($sub_theme_project_link, t('Link to the Update test subtheme project appears.'));
}
else {
$this->assertNoText(t('Disabled themes'));
- $this->assertNoRaw($base_theme_project_link, 'Link to the Update test base theme project does not appear.');
- $this->assertNoRaw($sub_theme_project_link, 'Link to the Update test subtheme project does not appear.');
+ $this->assertNoRaw($base_theme_project_link, t('Link to the Update test base theme project does not appear.'));
+ $this->assertNoRaw($sub_theme_project_link, t('Link to the Update test subtheme project does not appear.'));
}
}
}
@@ -486,9 +486,9 @@ class UpdateTestContribCase extends UpdateTestHelper {
$this->assertUniqueText(t('Failed to get available update data for one project.'));
// The other two should be listed as projects.
- $this->assertRaw(l(t('AAA Update test'), 'http://example.com/project/aaa_update_test'), 'Link to aaa_update_test project appears.');
- $this->assertNoRaw(l(t('BBB Update test'), 'http://example.com/project/bbb_update_test'), 'Link to bbb_update_test project does not appear.');
- $this->assertRaw(l(t('CCC Update test'), 'http://example.com/project/ccc_update_test'), 'Link to bbb_update_test project appears.');
+ $this->assertRaw(l(t('AAA Update test'), 'http://example.com/project/aaa_update_test'), t('Link to aaa_update_test project appears.'));
+ $this->assertNoRaw(l(t('BBB Update test'), 'http://example.com/project/bbb_update_test'), t('Link to bbb_update_test project does not appear.'));
+ $this->assertRaw(l(t('CCC Update test'), 'http://example.com/project/ccc_update_test'), t('Link to bbb_update_test project appears.'));
}
}
@@ -520,7 +520,7 @@ class UpdateTestUploadCase extends UpdateTestHelper {
);
// This also checks that the correct archive extensions are allowed.
$this->drupalPost('admin/modules/install', $edit, t('Install'));
- $this->assertText(t('Only files with the following extensions are allowed: @archive_extensions.', array('@archive_extensions' => archiver_get_extensions())), 'Only valid archives can be uploaded.');
+ $this->assertText(t('Only files with the following extensions are allowed: @archive_extensions.', array('@archive_extensions' => archiver_get_extensions())),'Only valid archives can be uploaded.');
// Check to ensure an existing module can't be reinstalled. Also checks that
// the archive was extracted since we can't know if the module is already
diff --git a/modules/user/user.test b/modules/user/user.test
index 26a1d964d..0fa3749af 100644
--- a/modules/user/user.test
+++ b/modules/user/user.test
@@ -17,7 +17,7 @@ class UserRegistrationTestCase extends DrupalWebTestCase {
// Set registration to administrator only.
variable_set('user_register', USER_REGISTER_ADMINISTRATORS_ONLY);
$this->drupalGet('user/register');
- $this->assertResponse(403, 'Registration page is inaccessible when only administrators can create accounts.');
+ $this->assertResponse(403, t('Registration page is inaccessible when only administrators can create accounts.'));
// Allow registration by site visitors without administrator approval.
variable_set('user_register', USER_REGISTER_VISITORS);
@@ -25,10 +25,10 @@ class UserRegistrationTestCase extends DrupalWebTestCase {
$edit['name'] = $name = $this->randomName();
$edit['mail'] = $mail = $edit['name'] . '@example.com';
$this->drupalPost('user/register', $edit, t('Create new account'));
- $this->assertText(t('A welcome message with further instructions has been sent to your e-mail address.'), 'User registered successfully.');
+ $this->assertText(t('A welcome message with further instructions has been sent to your e-mail address.'), t('User registered successfully.'));
$accounts = user_load_multiple(array(), array('name' => $name, 'mail' => $mail));
$new_user = reset($accounts);
- $this->assertTrue($new_user->status, 'New account is active after registration.');
+ $this->assertTrue($new_user->status, t('New account is active after registration.'));
// Allow registration by site visitors, but require administrator approval.
variable_set('user_register', USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL);
@@ -38,7 +38,7 @@ class UserRegistrationTestCase extends DrupalWebTestCase {
$this->drupalPost('user/register', $edit, t('Create new account'));
$accounts = user_load_multiple(array(), array('name' => $name, 'mail' => $mail));
$new_user = reset($accounts);
- $this->assertFalse($new_user->status, 'New account is blocked until approved by an administrator.');
+ $this->assertFalse($new_user->status, t('New account is blocked until approved by an administrator.'));
}
function testRegistrationWithoutEmailVerification() {
@@ -55,7 +55,7 @@ class UserRegistrationTestCase extends DrupalWebTestCase {
$edit['pass[pass1]'] = '99999.0';
$edit['pass[pass2]'] = '99999';
$this->drupalPost('user/register', $edit, t('Create new account'));
- $this->assertText(t('The specified passwords do not match.'), 'Typing mismatched passwords displays an error message.');
+ $this->assertText(t('The specified passwords do not match.'), t('Typing mismatched passwords displays an error message.'));
// Enter a correct password.
$edit['pass[pass1]'] = $new_pass = $this->randomName();
@@ -63,7 +63,7 @@ class UserRegistrationTestCase extends DrupalWebTestCase {
$this->drupalPost('user/register', $edit, t('Create new account'));
$accounts = user_load_multiple(array(), array('name' => $name, 'mail' => $mail));
$new_user = reset($accounts);
- $this->assertText(t('Registration successful. You are now logged in.'), 'Users are logged in after registering.');
+ $this->assertText(t('Registration successful. You are now logged in.'), t('Users are logged in after registering.'));
$this->drupalLogout();
// Allow registration by site visitors, but require administrator approval.
@@ -74,7 +74,7 @@ class UserRegistrationTestCase extends DrupalWebTestCase {
$edit['pass[pass1]'] = $pass = $this->randomName();
$edit['pass[pass2]'] = $pass;
$this->drupalPost('user/register', $edit, t('Create new account'));
- $this->assertText(t('Thank you for applying for an account. Your account is currently pending approval by the site administrator.'), 'Users are notified of pending approval');
+ $this->assertText(t('Thank you for applying for an account. Your account is currently pending approval by the site administrator.'), t('Users are notified of pending approval'));
// Try to login before administrator approval.
$auth = array(
@@ -82,7 +82,7 @@ class UserRegistrationTestCase extends DrupalWebTestCase {
'pass' => $pass,
);
$this->drupalPost('user/login', $auth, t('Log in'));
- $this->assertText(t('The username @name has not been activated or is blocked.', array('@name' => $name)), 'User cannot login yet.');
+ $this->assertText(t('The username @name has not been activated or is blocked.', array('@name' => $name)), t('User cannot login yet.'));
// Activate the new account.
$accounts = user_load_multiple(array(), array('name' => $name, 'mail' => $mail));
@@ -97,7 +97,7 @@ class UserRegistrationTestCase extends DrupalWebTestCase {
// Login after administrator approval.
$this->drupalPost('user/login', $auth, t('Log in'));
- $this->assertText(t('Member for'), 'User can log in after administrator approval.');
+ $this->assertText(t('Member for'), t('User can log in after administrator approval.'));
}
function testRegistrationDefaultValues() {
@@ -114,7 +114,7 @@ class UserRegistrationTestCase extends DrupalWebTestCase {
// Check that the account information fieldset's options are not displayed
// is a fieldset if there is not more than one fieldset in the form.
$this->drupalGet('user/register');
- $this->assertNoRaw('<fieldset id="edit-account"><legend>Account information</legend>', 'Account settings fieldset was hidden.');
+ $this->assertNoRaw('<fieldset id="edit-account"><legend>Account information</legend>', t('Account settings fieldset was hidden.'));
$edit = array();
$edit['name'] = $name = $this->randomName();
@@ -126,16 +126,16 @@ class UserRegistrationTestCase extends DrupalWebTestCase {
// Check user fields.
$accounts = user_load_multiple(array(), array('name' => $name, 'mail' => $mail));
$new_user = reset($accounts);
- $this->assertEqual($new_user->name, $name, 'Username matches.');
- $this->assertEqual($new_user->mail, $mail, 'E-mail address matches.');
- $this->assertEqual($new_user->theme, '', 'Correct theme field.');
- $this->assertEqual($new_user->signature, '', 'Correct signature field.');
- $this->assertTrue(($new_user->created > REQUEST_TIME - 20 ), 'Correct creation time.');
- $this->assertEqual($new_user->status, variable_get('user_register', USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL) == USER_REGISTER_VISITORS ? 1 : 0, 'Correct status field.');
- $this->assertEqual($new_user->timezone, variable_get('date_default_timezone'), 'Correct time zone field.');
- $this->assertEqual($new_user->language, '', 'Correct language field.');
- $this->assertEqual($new_user->picture, '', 'Correct picture field.');
- $this->assertEqual($new_user->init, $mail, 'Correct init field.');
+ $this->assertEqual($new_user->name, $name, t('Username matches.'));
+ $this->assertEqual($new_user->mail, $mail, t('E-mail address matches.'));
+ $this->assertEqual($new_user->theme, '', t('Correct theme field.'));
+ $this->assertEqual($new_user->signature, '', t('Correct signature field.'));
+ $this->assertTrue(($new_user->created > REQUEST_TIME - 20 ), t('Correct creation time.'));
+ $this->assertEqual($new_user->status, variable_get('user_register', USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL) == USER_REGISTER_VISITORS ? 1 : 0, t('Correct status field.'));
+ $this->assertEqual($new_user->timezone, variable_get('date_default_timezone'), t('Correct time zone field.'));
+ $this->assertEqual($new_user->language, '', t('Correct language field.'));
+ $this->assertEqual($new_user->picture, '', t('Correct picture field.'));
+ $this->assertEqual($new_user->init, $mail, t('Correct init field.'));
}
}
@@ -340,18 +340,18 @@ class UserCancelTestCase extends DrupalWebTestCase {
// Attempt to cancel account.
$this->drupalGet('user/' . $account->uid . '/edit');
- $this->assertNoRaw(t('Cancel account'), 'No cancel account button displayed.');
+ $this->assertNoRaw(t('Cancel account'), t('No cancel account button displayed.'));
// Attempt bogus account cancellation request confirmation.
$timestamp = $account->login;
$this->drupalGet("user/$account->uid/cancel/confirm/$timestamp/" . user_pass_rehash($account->pass, $timestamp, $account->login));
- $this->assertResponse(403, 'Bogus cancelling request rejected.');
+ $this->assertResponse(403, t('Bogus cancelling request rejected.'));
$account = user_load($account->uid);
- $this->assertTrue($account->status == 1, 'User account was not canceled.');
+ $this->assertTrue($account->status == 1, t('User account was not canceled.'));
// Confirm user's content has not been altered.
$test_node = node_load($node->nid, NULL, TRUE);
- $this->assertTrue(($test_node->uid == $account->uid && $test_node->status == 1), 'Node of the user has not been altered.');
+ $this->assertTrue(($test_node->uid == $account->uid && $test_node->status == 1), t('Node of the user has not been altered.'));
}
/**
@@ -389,7 +389,7 @@ class UserCancelTestCase extends DrupalWebTestCase {
// Verify that uid 1's account was not cancelled.
$user1 = user_load(1, TRUE);
- $this->assertEqual($user1->status, 1, 'User #1 still exists and is not blocked.');
+ $this->assertEqual($user1->status, 1, t('User #1 still exists and is not blocked.'));
}
/**
@@ -413,25 +413,25 @@ class UserCancelTestCase extends DrupalWebTestCase {
// Confirm account cancellation.
$timestamp = time();
$this->drupalPost(NULL, NULL, t('Cancel account'));
- $this->assertText(t('A confirmation request to cancel your account has been sent to your e-mail address.'), 'Account cancellation request mailed message displayed.');
+ $this->assertText(t('A confirmation request to cancel your account has been sent to your e-mail address.'), t('Account cancellation request mailed message displayed.'));
// Attempt bogus account cancellation request confirmation.
$bogus_timestamp = $timestamp + 60;
$this->drupalGet("user/$account->uid/cancel/confirm/$bogus_timestamp/" . user_pass_rehash($account->pass, $bogus_timestamp, $account->login));
- $this->assertText(t('You have tried to use an account cancellation link that has expired. Please request a new one using the form below.'), 'Bogus cancelling request rejected.');
+ $this->assertText(t('You have tried to use an account cancellation link that has expired. Please request a new one using the form below.'), t('Bogus cancelling request rejected.'));
$account = user_load($account->uid);
- $this->assertTrue($account->status == 1, 'User account was not canceled.');
+ $this->assertTrue($account->status == 1, t('User account was not canceled.'));
// Attempt expired account cancellation request confirmation.
$bogus_timestamp = $timestamp - 86400 - 60;
$this->drupalGet("user/$account->uid/cancel/confirm/$bogus_timestamp/" . user_pass_rehash($account->pass, $bogus_timestamp, $account->login));
- $this->assertText(t('You have tried to use an account cancellation link that has expired. Please request a new one using the form below.'), 'Expired cancel account request rejected.');
+ $this->assertText(t('You have tried to use an account cancellation link that has expired. Please request a new one using the form below.'), t('Expired cancel account request rejected.'));
$accounts = user_load_multiple(array($account->uid), array('status' => 1));
- $this->assertTrue(reset($accounts), 'User account was not canceled.');
+ $this->assertTrue(reset($accounts), t('User account was not canceled.'));
// Confirm user's content has not been altered.
$test_node = node_load($node->nid, NULL, TRUE);
- $this->assertTrue(($test_node->uid == $account->uid && $test_node->status == 1), 'Node of the user has not been altered.');
+ $this->assertTrue(($test_node->uid == $account->uid && $test_node->status == 1), t('Node of the user has not been altered.'));
}
/**
@@ -450,23 +450,23 @@ class UserCancelTestCase extends DrupalWebTestCase {
// Attempt to cancel account.
$this->drupalGet('user/' . $account->uid . '/edit');
$this->drupalPost(NULL, NULL, t('Cancel account'));
- $this->assertText(t('Are you sure you want to cancel your account?'), 'Confirmation form to cancel account displayed.');
- $this->assertText(t('Your account will be blocked and you will no longer be able to log in. All of your content will remain attributed to your user name.'), 'Informs that all content will be remain as is.');
- $this->assertNoText(t('Select the method to cancel the account above.'), 'Does not allow user to select account cancellation method.');
+ $this->assertText(t('Are you sure you want to cancel your account?'), t('Confirmation form to cancel account displayed.'));
+ $this->assertText(t('Your account will be blocked and you will no longer be able to log in. All of your content will remain attributed to your user name.'), t('Informs that all content will be remain as is.'));
+ $this->assertNoText(t('Select the method to cancel the account above.'), t('Does not allow user to select account cancellation method.'));
// Confirm account cancellation.
$timestamp = time();
$this->drupalPost(NULL, NULL, t('Cancel account'));
- $this->assertText(t('A confirmation request to cancel your account has been sent to your e-mail address.'), 'Account cancellation request mailed message displayed.');
+ $this->assertText(t('A confirmation request to cancel your account has been sent to your e-mail address.'), t('Account cancellation request mailed message displayed.'));
// Confirm account cancellation request.
$this->drupalGet("user/$account->uid/cancel/confirm/$timestamp/" . user_pass_rehash($account->pass, $timestamp, $account->login));
$account = user_load($account->uid, TRUE);
- $this->assertTrue($account->status == 0, 'User has been blocked.');
+ $this->assertTrue($account->status == 0, t('User has been blocked.'));
// Confirm user is logged out.
- $this->assertNoText($account->name, 'Logged out.');
+ $this->assertNoText($account->name, t('Logged out.'));
}
/**
@@ -490,27 +490,27 @@ class UserCancelTestCase extends DrupalWebTestCase {
// Attempt to cancel account.
$this->drupalGet('user/' . $account->uid . '/edit');
$this->drupalPost(NULL, NULL, t('Cancel account'));
- $this->assertText(t('Are you sure you want to cancel your account?'), 'Confirmation form to cancel account displayed.');
- $this->assertText(t('Your account will be blocked and you will no longer be able to log in. All of your content will be hidden from everyone but administrators.'), 'Informs that all content will be unpublished.');
+ $this->assertText(t('Are you sure you want to cancel your account?'), t('Confirmation form to cancel account displayed.'));
+ $this->assertText(t('Your account will be blocked and you will no longer be able to log in. All of your content will be hidden from everyone but administrators.'), t('Informs that all content will be unpublished.'));
// Confirm account cancellation.
$timestamp = time();
$this->drupalPost(NULL, NULL, t('Cancel account'));
- $this->assertText(t('A confirmation request to cancel your account has been sent to your e-mail address.'), 'Account cancellation request mailed message displayed.');
+ $this->assertText(t('A confirmation request to cancel your account has been sent to your e-mail address.'), t('Account cancellation request mailed message displayed.'));
// Confirm account cancellation request.
$this->drupalGet("user/$account->uid/cancel/confirm/$timestamp/" . user_pass_rehash($account->pass, $timestamp, $account->login));
$account = user_load($account->uid, TRUE);
- $this->assertTrue($account->status == 0, 'User has been blocked.');
+ $this->assertTrue($account->status == 0, t('User has been blocked.'));
// Confirm user's content has been unpublished.
$test_node = node_load($node->nid, NULL, TRUE);
- $this->assertTrue($test_node->status == 0, 'Node of the user has been unpublished.');
+ $this->assertTrue($test_node->status == 0, t('Node of the user has been unpublished.'));
$test_node = node_load($node->nid, $node->vid, TRUE);
- $this->assertTrue($test_node->status == 0, 'Node revision of the user has been unpublished.');
+ $this->assertTrue($test_node->status == 0, t('Node revision of the user has been unpublished.'));
// Confirm user is logged out.
- $this->assertNoText($account->name, 'Logged out.');
+ $this->assertNoText($account->name, t('Logged out.'));
}
/**
@@ -540,28 +540,28 @@ class UserCancelTestCase extends DrupalWebTestCase {
// Attempt to cancel account.
$this->drupalGet('user/' . $account->uid . '/edit');
$this->drupalPost(NULL, NULL, t('Cancel account'));
- $this->assertText(t('Are you sure you want to cancel your account?'), 'Confirmation form to cancel account displayed.');
- $this->assertRaw(t('Your account will be removed and all account information deleted. All of your content will be assigned to the %anonymous-name user.', array('%anonymous-name' => variable_get('anonymous', t('Anonymous')))), 'Informs that all content will be attributed to anonymous account.');
+ $this->assertText(t('Are you sure you want to cancel your account?'), t('Confirmation form to cancel account displayed.'));
+ $this->assertRaw(t('Your account will be removed and all account information deleted. All of your content will be assigned to the %anonymous-name user.', array('%anonymous-name' => variable_get('anonymous', t('Anonymous')))), t('Informs that all content will be attributed to anonymous account.'));
// Confirm account cancellation.
$timestamp = time();
$this->drupalPost(NULL, NULL, t('Cancel account'));
- $this->assertText(t('A confirmation request to cancel your account has been sent to your e-mail address.'), 'Account cancellation request mailed message displayed.');
+ $this->assertText(t('A confirmation request to cancel your account has been sent to your e-mail address.'), t('Account cancellation request mailed message displayed.'));
// Confirm account cancellation request.
$this->drupalGet("user/$account->uid/cancel/confirm/$timestamp/" . user_pass_rehash($account->pass, $timestamp, $account->login));
- $this->assertFalse(user_load($account->uid, TRUE), 'User is not found in the database.');
+ $this->assertFalse(user_load($account->uid, TRUE), t('User is not found in the database.'));
// Confirm that user's content has been attributed to anonymous user.
$test_node = node_load($node->nid, NULL, TRUE);
- $this->assertTrue(($test_node->uid == 0 && $test_node->status == 1), 'Node of the user has been attributed to anonymous user.');
+ $this->assertTrue(($test_node->uid == 0 && $test_node->status == 1), t('Node of the user has been attributed to anonymous user.'));
$test_node = node_load($revision_node->nid, $revision, TRUE);
- $this->assertTrue(($test_node->revision_uid == 0 && $test_node->status == 1), 'Node revision of the user has been attributed to anonymous user.');
+ $this->assertTrue(($test_node->revision_uid == 0 && $test_node->status == 1), t('Node revision of the user has been attributed to anonymous user.'));
$test_node = node_load($revision_node->nid, NULL, TRUE);
- $this->assertTrue(($test_node->uid != 0 && $test_node->status == 1), "Current revision of the user's node was not attributed to anonymous user.");
+ $this->assertTrue(($test_node->uid != 0 && $test_node->status == 1), t("Current revision of the user's node was not attributed to anonymous user."));
// Confirm that user is logged out.
- $this->assertNoText($account->name, 'Logged out.');
+ $this->assertNoText($account->name, t('Logged out.'));
}
/**
@@ -590,7 +590,7 @@ class UserCancelTestCase extends DrupalWebTestCase {
$this->assertText(t('Your comment has been posted.'));
$comments = comment_load_multiple(array(), array('subject' => $edit['subject']));
$comment = reset($comments);
- $this->assertTrue($comment->cid, 'Comment found.');
+ $this->assertTrue($comment->cid, t('Comment found.'));
// Create a node with two revisions, the initial one belonging to the
// cancelling user.
@@ -604,26 +604,26 @@ class UserCancelTestCase extends DrupalWebTestCase {
// Attempt to cancel account.
$this->drupalGet('user/' . $account->uid . '/edit');
$this->drupalPost(NULL, NULL, t('Cancel account'));
- $this->assertText(t('Are you sure you want to cancel your account?'), 'Confirmation form to cancel account displayed.');
- $this->assertText(t('Your account will be removed and all account information deleted. All of your content will also be deleted.'), 'Informs that all content will be deleted.');
+ $this->assertText(t('Are you sure you want to cancel your account?'), t('Confirmation form to cancel account displayed.'));
+ $this->assertText(t('Your account will be removed and all account information deleted. All of your content will also be deleted.'), t('Informs that all content will be deleted.'));
// Confirm account cancellation.
$timestamp = time();
$this->drupalPost(NULL, NULL, t('Cancel account'));
- $this->assertText(t('A confirmation request to cancel your account has been sent to your e-mail address.'), 'Account cancellation request mailed message displayed.');
+ $this->assertText(t('A confirmation request to cancel your account has been sent to your e-mail address.'), t('Account cancellation request mailed message displayed.'));
// Confirm account cancellation request.
$this->drupalGet("user/$account->uid/cancel/confirm/$timestamp/" . user_pass_rehash($account->pass, $timestamp, $account->login));
- $this->assertFalse(user_load($account->uid, TRUE), 'User is not found in the database.');
+ $this->assertFalse(user_load($account->uid, TRUE), t('User is not found in the database.'));
// Confirm that user's content has been deleted.
- $this->assertFalse(node_load($node->nid, NULL, TRUE), 'Node of the user has been deleted.');
- $this->assertFalse(node_load($node->nid, $revision, TRUE), 'Node revision of the user has been deleted.');
- $this->assertTrue(node_load($revision_node->nid, NULL, TRUE), "Current revision of the user's node was not deleted.");
- $this->assertFalse(comment_load($comment->cid), 'Comment of the user has been deleted.');
+ $this->assertFalse(node_load($node->nid, NULL, TRUE), t('Node of the user has been deleted.'));
+ $this->assertFalse(node_load($node->nid, $revision, TRUE), t('Node revision of the user has been deleted.'));
+ $this->assertTrue(node_load($revision_node->nid, NULL, TRUE), t("Current revision of the user's node was not deleted."));
+ $this->assertFalse(comment_load($comment->cid), t('Comment of the user has been deleted.'));
// Confirm that user is logged out.
- $this->assertNoText($account->name, 'Logged out.');
+ $this->assertNoText($account->name, t('Logged out.'));
}
/**
@@ -642,13 +642,13 @@ class UserCancelTestCase extends DrupalWebTestCase {
// Delete regular user.
$this->drupalGet('user/' . $account->uid . '/edit');
$this->drupalPost(NULL, NULL, t('Cancel account'));
- $this->assertRaw(t('Are you sure you want to cancel the account %name?', array('%name' => $account->name)), 'Confirmation form to cancel account displayed.');
- $this->assertText(t('Select the method to cancel the account above.'), 'Allows to select account cancellation method.');
+ $this->assertRaw(t('Are you sure you want to cancel the account %name?', array('%name' => $account->name)), t('Confirmation form to cancel account displayed.'));
+ $this->assertText(t('Select the method to cancel the account above.'), t('Allows to select account cancellation method.'));
// Confirm deletion.
$this->drupalPost(NULL, NULL, t('Cancel account'));
- $this->assertRaw(t('%name has been deleted.', array('%name' => $account->name)), 'User deleted.');
- $this->assertFalse(user_load($account->uid), 'User is not found in the database.');
+ $this->assertRaw(t('%name has been deleted.', array('%name' => $account->name)), t('User deleted.'));
+ $this->assertFalse(user_load($account->uid), t('User is not found in the database.'));
}
/**
@@ -680,10 +680,10 @@ class UserCancelTestCase extends DrupalWebTestCase {
// Also try to cancel uid 1.
$edit['accounts[1]'] = TRUE;
$this->drupalPost('admin/people', $edit, t('Update'));
- $this->assertText(t('Are you sure you want to cancel these user accounts?'), 'Confirmation form to cancel accounts displayed.');
- $this->assertText(t('When cancelling these accounts'), 'Allows to select account cancellation method.');
- $this->assertText(t('Require e-mail confirmation to cancel account.'), 'Allows to send confirmation mail.');
- $this->assertText(t('Notify user when account is canceled.'), 'Allows to send notification mail.');
+ $this->assertText(t('Are you sure you want to cancel these user accounts?'), t('Confirmation form to cancel accounts displayed.'));
+ $this->assertText(t('When cancelling these accounts'), t('Allows to select account cancellation method.'));
+ $this->assertText(t('Require e-mail confirmation to cancel account.'), t('Allows to send confirmation mail.'));
+ $this->assertText(t('Notify user when account is canceled.'), t('Allows to send notification mail.'));
// Confirm deletion.
$this->drupalPost(NULL, NULL, t('Cancel accounts'));
@@ -692,16 +692,16 @@ class UserCancelTestCase extends DrupalWebTestCase {
$status = $status && (strpos($this->content, t('%name has been deleted.', array('%name' => $account->name))) !== FALSE);
$status = $status && !user_load($account->uid, TRUE);
}
- $this->assertTrue($status, 'Users deleted and not found in the database.');
+ $this->assertTrue($status, t('Users deleted and not found in the database.'));
// Ensure that admin account was not cancelled.
- $this->assertText(t('A confirmation request to cancel your account has been sent to your e-mail address.'), 'Account cancellation request mailed message displayed.');
+ $this->assertText(t('A confirmation request to cancel your account has been sent to your e-mail address.'), t('Account cancellation request mailed message displayed.'));
$admin_user = user_load($admin_user->uid);
- $this->assertTrue($admin_user->status == 1, 'Administrative user is found in the database and enabled.');
+ $this->assertTrue($admin_user->status == 1, t('Administrative user is found in the database and enabled.'));
// Verify that uid 1's account was not cancelled.
$user1 = user_load(1, TRUE);
- $this->assertEqual($user1->status, 1, 'User #1 still exists and is not blocked.');
+ $this->assertEqual($user1->status, 1, t('User #1 still exists and is not blocked.'));
}
}
@@ -743,7 +743,7 @@ class UserPictureTestCase extends DrupalWebTestCase {
// Try to upload a file that is not an image for the user picture.
$not_an_image = current($this->drupalGetTestFiles('html'));
$this->saveUserPicture($not_an_image);
- $this->assertRaw(t('Only JPEG, PNG and GIF images are allowed.'), 'Non-image files are not accepted.');
+ $this->assertRaw(t('Only JPEG, PNG and GIF images are allowed.'), t('Non-image files are not accepted.'));
}
/**
@@ -769,13 +769,13 @@ class UserPictureTestCase extends DrupalWebTestCase {
// Check that the image was resized and is being displayed on the
// user's profile page.
$text = t('The image was resized to fit within the maximum allowed dimensions of %dimensions pixels.', array('%dimensions' => $test_dim));
- $this->assertRaw($text, 'Image was resized.');
+ $this->assertRaw($text, t('Image was resized.'));
$alt = t("@user's picture", array('@user' => format_username($this->user)));
$style = variable_get('user_picture_style', '');
- $this->assertRaw(image_style_url($style, $pic_path), "Image is displayed in user's edit page");
+ $this->assertRaw(image_style_url($style, $pic_path), t("Image is displayed in user's edit page"));
// Check if file is located in proper directory.
- $this->assertTrue(is_file($pic_path), "File is located in proper directory");
+ $this->assertTrue(is_file($pic_path), t("File is located in proper directory"));
}
}
@@ -806,12 +806,12 @@ class UserPictureTestCase extends DrupalWebTestCase {
// Test that the upload failed and that the correct reason was cited.
$text = t('The specified file %filename could not be uploaded.', array('%filename' => $image->filename));
- $this->assertRaw($text, 'Upload failed.');
+ $this->assertRaw($text, t('Upload failed.'));
$text = t('The file is %filesize exceeding the maximum file size of %maxsize.', array('%filesize' => format_size(filesize($image->uri)), '%maxsize' => format_size($test_size * 1024)));
- $this->assertRaw($text, 'File size cited as reason for failure.');
+ $this->assertRaw($text, t('File size cited as reason for failure.'));
// Check if file is not uploaded.
- $this->assertFalse(is_file($pic_path), 'File was not uploaded.');
+ $this->assertFalse(is_file($pic_path), t('File was not uploaded.'));
}
}
@@ -838,12 +838,12 @@ class UserPictureTestCase extends DrupalWebTestCase {
// Test that the upload failed and that the correct reason was cited.
$text = t('The specified file %filename could not be uploaded.', array('%filename' => $image->filename));
- $this->assertRaw($text, 'Upload failed.');
+ $this->assertRaw($text, t('Upload failed.'));
$text = t('The image is too large; the maximum dimensions are %dimensions pixels.', array('%dimensions' => $test_dim));
- $this->assertRaw($text, 'Checking response on invalid image (dimensions).');
+ $this->assertRaw($text, t('Checking response on invalid image (dimensions).'));
// Check if file is not uploaded.
- $this->assertFalse(is_file($pic_path), 'File was not uploaded.');
+ $this->assertFalse(is_file($pic_path), t('File was not uploaded.'));
}
}
@@ -871,12 +871,12 @@ class UserPictureTestCase extends DrupalWebTestCase {
// Test that the upload failed and that the correct reason was cited.
$text = t('The specified file %filename could not be uploaded.', array('%filename' => $image->filename));
- $this->assertRaw($text, 'Upload failed.');
+ $this->assertRaw($text, t('Upload failed.'));
$text = t('The file is %filesize exceeding the maximum file size of %maxsize.', array('%filesize' => format_size(filesize($image->uri)), '%maxsize' => format_size($test_size * 1024)));
- $this->assertRaw($text, 'File size cited as reason for failure.');
+ $this->assertRaw($text, t('File size cited as reason for failure.'));
// Check if file is not uploaded.
- $this->assertFalse(is_file($pic_path), 'File was not uploaded.');
+ $this->assertFalse(is_file($pic_path), t('File was not uploaded.'));
}
}
@@ -902,17 +902,17 @@ class UserPictureTestCase extends DrupalWebTestCase {
// Check if image is displayed in user's profile page.
$this->drupalGet('user');
- $this->assertRaw(file_uri_target($pic_path), "Image is displayed in user's profile page");
+ $this->assertRaw(file_uri_target($pic_path), t("Image is displayed in user's profile page"));
// Check if file is located in proper directory.
- $this->assertTrue(is_file($pic_path), 'File is located in proper directory');
+ $this->assertTrue(is_file($pic_path), t('File is located in proper directory'));
// Set new picture dimensions.
$test_dim = ($info['width'] + 5) . 'x' . ($info['height'] + 5);
variable_set('user_picture_dimensions', $test_dim);
$pic_path2 = $this->saveUserPicture($image);
- $this->assertNotEqual($pic_path, $pic_path2, 'Filename of second picture is different.');
+ $this->assertNotEqual($pic_path, $pic_path2, t('Filename of second picture is different.'));
}
}
@@ -959,24 +959,24 @@ class UserPermissionsTestCase extends DrupalWebTestCase {
$account = $this->admin_user;
// Add a permission.
- $this->assertFalse(user_access('administer nodes', $account), 'User does not have "administer nodes" permission.');
+ $this->assertFalse(user_access('administer nodes', $account), t('User does not have "administer nodes" permission.'));
$edit = array();
$edit[$rid . '[administer nodes]'] = TRUE;
$this->drupalPost('admin/people/permissions', $edit, t('Save permissions'));
- $this->assertText(t('The changes have been saved.'), 'Successful save message displayed.');
+ $this->assertText(t('The changes have been saved.'), t('Successful save message displayed.'));
drupal_static_reset('user_access');
drupal_static_reset('user_role_permissions');
- $this->assertTrue(user_access('administer nodes', $account), 'User now has "administer nodes" permission.');
+ $this->assertTrue(user_access('administer nodes', $account), t('User now has "administer nodes" permission.'));
// Remove a permission.
- $this->assertTrue(user_access('access user profiles', $account), 'User has "access user profiles" permission.');
+ $this->assertTrue(user_access('access user profiles', $account), t('User has "access user profiles" permission.'));
$edit = array();
$edit[$rid . '[access user profiles]'] = FALSE;
$this->drupalPost('admin/people/permissions', $edit, t('Save permissions'));
- $this->assertText(t('The changes have been saved.'), 'Successful save message displayed.');
+ $this->assertText(t('The changes have been saved.'), t('Successful save message displayed.'));
drupal_static_reset('user_access');
drupal_static_reset('user_role_permissions');
- $this->assertFalse(user_access('access user profiles', $account), 'User no longer has "access user profiles" permission.');
+ $this->assertFalse(user_access('access user profiles', $account), t('User no longer has "access user profiles" permission.'));
}
/**
@@ -996,7 +996,7 @@ class UserPermissionsTestCase extends DrupalWebTestCase {
$edit = array();
$edit['modules[Core][aggregator][enable]'] = TRUE;
$this->drupalPost('admin/modules', $edit, t('Save configuration'));
- $this->assertTrue(user_access('administer news feeds', $this->admin_user), 'The permission was automatically assigned to the administrator role');
+ $this->assertTrue(user_access('administer news feeds', $this->admin_user), t('The permission was automatically assigned to the administrator role'));
}
/**
@@ -1007,9 +1007,9 @@ class UserPermissionsTestCase extends DrupalWebTestCase {
$account = $this->admin_user;
// Verify current permissions.
- $this->assertFalse(user_access('administer nodes', $account), 'User does not have "administer nodes" permission.');
- $this->assertTrue(user_access('access user profiles', $account), 'User has "access user profiles" permission.');
- $this->assertTrue(user_access('administer site configuration', $account), 'User has "administer site configuration" permission.');
+ $this->assertFalse(user_access('administer nodes', $account), t('User does not have "administer nodes" permission.'));
+ $this->assertTrue(user_access('access user profiles', $account), t('User has "access user profiles" permission.'));
+ $this->assertTrue(user_access('administer site configuration', $account), t('User has "administer site configuration" permission.'));
// Change permissions.
$permissions = array(
@@ -1019,9 +1019,9 @@ class UserPermissionsTestCase extends DrupalWebTestCase {
user_role_change_permissions($rid, $permissions);
// Verify proper permission changes.
- $this->assertTrue(user_access('administer nodes', $account), 'User now has "administer nodes" permission.');
- $this->assertFalse(user_access('access user profiles', $account), 'User no longer has "access user profiles" permission.');
- $this->assertTrue(user_access('administer site configuration', $account), 'User still has "administer site configuration" permission.');
+ $this->assertTrue(user_access('administer nodes', $account), t('User now has "administer nodes" permission.'));
+ $this->assertFalse(user_access('access user profiles', $account), t('User no longer has "access user profiles" permission.'));
+ $this->assertTrue(user_access('administer site configuration', $account), t('User still has "administer site configuration" permission.'));
}
}
@@ -1047,14 +1047,14 @@ class UserAdminTestCase extends DrupalWebTestCase {
$admin_user = $this->drupalCreateUser(array('administer users'));
$this->drupalLogin($admin_user);
$this->drupalGet('admin/people');
- $this->assertText($user_a->name, 'Found user A on admin users page');
- $this->assertText($user_b->name, 'Found user B on admin users page');
- $this->assertText($user_c->name, 'Found user C on admin users page');
- $this->assertText($admin_user->name, 'Found Admin user on admin users page');
+ $this->assertText($user_a->name, t('Found user A on admin users page'));
+ $this->assertText($user_b->name, t('Found user B on admin users page'));
+ $this->assertText($user_c->name, t('Found user C on admin users page'));
+ $this->assertText($admin_user->name, t('Found Admin user on admin users page'));
// Test for existence of edit link in table.
$link = l(t('edit'), "user/$user_a->uid/edit", array('query' => array('destination' => 'admin/people')));
- $this->assertRaw($link, 'Found user A edit link on admin users page');
+ $this->assertRaw($link, t('Found user A edit link on admin users page'));
// Filter the users by permission 'administer taxonomy'.
$edit = array();
@@ -1062,18 +1062,18 @@ class UserAdminTestCase extends DrupalWebTestCase {
$this->drupalPost('admin/people', $edit, t('Filter'));
// Check if the correct users show up.
- $this->assertNoText($user_a->name, 'User A not on filtered by perm admin users page');
- $this->assertText($user_b->name, 'Found user B on filtered by perm admin users page');
- $this->assertText($user_c->name, 'Found user C on filtered by perm admin users page');
+ $this->assertNoText($user_a->name, t('User A not on filtered by perm admin users page'));
+ $this->assertText($user_b->name, t('Found user B on filtered by perm admin users page'));
+ $this->assertText($user_c->name, t('Found user C on filtered by perm admin users page'));
// Filter the users by role. Grab the system-generated role name for User C.
$edit['role'] = max(array_flip($user_c->roles));
$this->drupalPost('admin/people', $edit, t('Refine'));
// Check if the correct users show up when filtered by role.
- $this->assertNoText($user_a->name, 'User A not on filtered by role on admin users page');
- $this->assertNoText($user_b->name, 'User B not on filtered by role on admin users page');
- $this->assertText($user_c->name, 'User C on filtered by role on admin users page');
+ $this->assertNoText($user_a->name, t('User A not on filtered by role on admin users page'));
+ $this->assertNoText($user_b->name, t('User B not on filtered by role on admin users page'));
+ $this->assertText($user_c->name, t('User C on filtered by role on admin users page'));
// Test blocking of a user.
$account = user_load($user_c->uid);
@@ -1124,26 +1124,26 @@ class UserTimeZoneFunctionalTest extends DrupalWebTestCase {
// Confirm date format and time zone.
$this->drupalGet("node/$node1->nid");
- $this->assertText('2007-03-09 21:00 PST', 'Date should be PST.');
+ $this->assertText('2007-03-09 21:00 PST', t('Date should be PST.'));
$this->drupalGet("node/$node2->nid");
- $this->assertText('2007-03-11 01:00 PST', 'Date should be PST.');
+ $this->assertText('2007-03-11 01:00 PST', t('Date should be PST.'));
$this->drupalGet("node/$node3->nid");
- $this->assertText('2007-03-20 21:00 PDT', 'Date should be PDT.');
+ $this->assertText('2007-03-20 21:00 PDT', t('Date should be PDT.'));
// Change user time zone to Santiago time.
$edit = array();
$edit['mail'] = $web_user->mail;
$edit['timezone'] = 'America/Santiago';
$this->drupalPost("user/$web_user->uid/edit", $edit, t('Save'));
- $this->assertText(t('The changes have been saved.'), 'Time zone changed to Santiago time.');
+ $this->assertText(t('The changes have been saved.'), t('Time zone changed to Santiago time.'));
// Confirm date format and time zone.
$this->drupalGet("node/$node1->nid");
- $this->assertText('2007-03-10 02:00 CLST', 'Date should be Chile summer time; five hours ahead of PST.');
+ $this->assertText('2007-03-10 02:00 CLST', t('Date should be Chile summer time; five hours ahead of PST.'));
$this->drupalGet("node/$node2->nid");
- $this->assertText('2007-03-11 05:00 CLT', 'Date should be Chile time; four hours ahead of PST');
+ $this->assertText('2007-03-11 05:00 CLT', t('Date should be Chile time; four hours ahead of PST'));
$this->drupalGet("node/$node3->nid");
- $this->assertText('2007-03-21 00:00 CLT', 'Date should be Chile time; three hours ahead of PDT.');
+ $this->assertText('2007-03-21 00:00 CLT', t('Date should be Chile time; three hours ahead of PDT.'));
}
}
@@ -1174,16 +1174,16 @@ class UserAutocompleteTestCase extends DrupalWebTestCase {
// Check access from unprivileged user, should be denied.
$this->drupalLogin($this->unprivileged_user);
$this->drupalGet('user/autocomplete/' . $this->unprivileged_user->name[0]);
- $this->assertResponse(403, 'Autocompletion access denied to user without permission.');
+ $this->assertResponse(403, t('Autocompletion access denied to user without permission.'));
// Check access from privileged user.
$this->drupalLogout();
$this->drupalLogin($this->privileged_user);
$this->drupalGet('user/autocomplete/' . $this->unprivileged_user->name[0]);
- $this->assertResponse(200, 'Autocompletion access allowed.');
+ $this->assertResponse(200, t('Autocompletion access allowed.'));
// Using first letter of the user's name, make sure the user's full name is in the results.
- $this->assertRaw($this->unprivileged_user->name, 'User name found in autocompletion results.');
+ $this->assertRaw($this->unprivileged_user->name, t('User name found in autocompletion results.'));
}
}
@@ -1211,16 +1211,16 @@ class UserBlocksUnitTests extends DrupalWebTestCase {
$edit['name'] = $user->name;
$edit['pass'] = $user->pass_raw;
$this->drupalPost('admin/people/permissions', $edit, t('Log in'));
- $this->assertNoText(t('User login'), 'Logged in.');
+ $this->assertNoText(t('User login'), t('Logged in.'));
// Check that we are still on the same page.
- $this->assertEqual(url('admin/people/permissions', array('absolute' => TRUE)), $this->getUrl(), 'Still on the same page after login for access denied page');
+ $this->assertEqual(url('admin/people/permissions', array('absolute' => TRUE)), $this->getUrl(), t('Still on the same page after login for access denied page'));
// Now, log out and repeat with a non-403 page.
$this->drupalLogout();
$this->drupalPost('filter/tips', $edit, t('Log in'));
- $this->assertNoText(t('User login'), 'Logged in.');
- $this->assertPattern('!<title.*?' . t('Compose tips') . '.*?</title>!', 'Still on the same page after login for allowed page');
+ $this->assertNoText(t('User login'), t('Logged in.'));
+ $this->assertPattern('!<title.*?' . t('Compose tips') . '.*?</title>!', t('Still on the same page after login for allowed page'));
}
/**
@@ -1231,12 +1231,12 @@ class UserBlocksUnitTests extends DrupalWebTestCase {
$user1 = $this->drupalCreateUser(array());
$user2 = $this->drupalCreateUser(array());
$user3 = $this->drupalCreateUser(array());
- $this->assertEqual(db_query("SELECT COUNT(*) FROM {sessions}")->fetchField(), 0, 'Sessions table is empty.');
+ $this->assertEqual(db_query("SELECT COUNT(*) FROM {sessions}")->fetchField(), 0, t('Sessions table is empty.'));
// Insert a user with two sessions.
$this->insertSession(array('uid' => $user1->uid));
$this->insertSession(array('uid' => $user1->uid));
- $this->assertEqual(db_query("SELECT COUNT(*) FROM {sessions} WHERE uid = :uid", array(':uid' => $user1->uid))->fetchField(), 2, 'Duplicate user session has been inserted.');
+ $this->assertEqual(db_query("SELECT COUNT(*) FROM {sessions} WHERE uid = :uid", array(':uid' => $user1->uid))->fetchField(), 2, t('Duplicate user session has been inserted.'));
// Insert a user with only one session.
$this->insertSession(array('uid' => $user2->uid, 'timestamp' => REQUEST_TIME + 1));
@@ -1251,11 +1251,11 @@ class UserBlocksUnitTests extends DrupalWebTestCase {
// Test block output.
$block = user_block_view('online');
$this->drupalSetContent($block['content']);
- $this->assertRaw(t('2 users'), 'Correct number of online users (2 users).');
- $this->assertText($user1->name, 'Active user 1 found in online list.');
- $this->assertText($user2->name, 'Active user 2 found in online list.');
- $this->assertNoText($user3->name, "Inactive user not found in online list.");
- $this->assertTrue(strpos($this->drupalGetContent(), $user1->name) > strpos($this->drupalGetContent(), $user2->name), 'Online users are ordered correctly.');
+ $this->assertRaw(t('2 users'), t('Correct number of online users (2 users).'));
+ $this->assertText($user1->name, t('Active user 1 found in online list.'));
+ $this->assertText($user2->name, t('Active user 2 found in online list.'));
+ $this->assertNoText($user3->name, t("Inactive user not found in online list."));
+ $this->assertTrue(strpos($this->drupalGetContent(), $user1->name) > strpos($this->drupalGetContent(), $user2->name), t('Online users are ordered correctly.'));
}
/**
@@ -1271,7 +1271,7 @@ class UserBlocksUnitTests extends DrupalWebTestCase {
db_insert('sessions')
->fields($fields)
->execute();
- $this->assertEqual(db_query("SELECT COUNT(*) FROM {sessions} WHERE uid = :uid AND sid = :sid AND timestamp = :timestamp", array(':uid' => $fields['uid'], ':sid' => $fields['sid'], ':timestamp' => $fields['timestamp']))->fetchField(), 1, 'Session record inserted.');
+ $this->assertEqual(db_query("SELECT COUNT(*) FROM {sessions} WHERE uid = :uid AND sid = :sid AND timestamp = :timestamp", array(':uid' => $fields['uid'], ':sid' => $fields['sid'], ':timestamp' => $fields['timestamp']))->fetchField(), 1, t('Session record inserted.'));
}
}
@@ -1307,14 +1307,14 @@ class UserSaveTestCase extends DrupalWebTestCase {
'status' => 1,
);
$user_by_return = user_save(drupal_anonymous_user(), $user);
- $this->assertTrue($user_by_return, 'Loading user by return of user_save().');
+ $this->assertTrue($user_by_return, t('Loading user by return of user_save().'));
// Test if created user exists.
$user_by_uid = user_load($test_uid);
- $this->assertTrue($user_by_uid, 'Loading user by uid.');
+ $this->assertTrue($user_by_uid, t('Loading user by uid.'));
$user_by_name = user_load_by_name($test_name);
- $this->assertTrue($user_by_name, 'Loading user by name.');
+ $this->assertTrue($user_by_name, t('Loading user by name.'));
}
}
@@ -1402,12 +1402,12 @@ class UserEditTestCase extends DrupalWebTestCase {
$edit['pass[pass1]'] = '';
$edit['pass[pass2]'] = $this->randomName();
$this->drupalPost("user/$user1->uid/edit", $edit, t('Save'));
- $this->assertText(t("The specified passwords do not match."), 'Typing mismatched passwords displays an error message.');
+ $this->assertText(t("The specified passwords do not match."), t('Typing mismatched passwords displays an error message.'));
$edit['pass[pass1]'] = $this->randomName();
$edit['pass[pass2]'] = '';
$this->drupalPost("user/$user1->uid/edit", $edit, t('Save'));
- $this->assertText(t("The specified passwords do not match."), 'Typing mismatched passwords displays an error message.');
+ $this->assertText(t("The specified passwords do not match."), t('Typing mismatched passwords displays an error message.'));
// Test that the error message appears when attempting to change the mail or
// pass without the current password.
@@ -1590,36 +1590,36 @@ class UserRoleAdminTestCase extends DrupalWebTestCase {
$role_name = '123';
$edit = array('name' => $role_name);
$this->drupalPost('admin/people/permissions/roles', $edit, t('Add role'));
- $this->assertText(t('The role has been added.'), 'The role has been added.');
+ $this->assertText(t('The role has been added.'), t('The role has been added.'));
$role = user_role_load_by_name($role_name);
- $this->assertTrue(is_object($role), 'The role was successfully retrieved from the database.');
+ $this->assertTrue(is_object($role), t('The role was successfully retrieved from the database.'));
// Try adding a duplicate role.
$this->drupalPost(NULL, $edit, t('Add role'));
- $this->assertRaw(t('The role name %name already exists. Choose another role name.', array('%name' => $role_name)), 'Duplicate role warning displayed.');
+ $this->assertRaw(t('The role name %name already exists. Choose another role name.', array('%name' => $role_name)), t('Duplicate role warning displayed.'));
// Test renaming a role.
$old_name = $role_name;
$role_name = '456';
$edit = array('name' => $role_name);
$this->drupalPost("admin/people/permissions/roles/edit/{$role->rid}", $edit, t('Save role'));
- $this->assertText(t('The role has been renamed.'), 'The role has been renamed.');
- $this->assertFalse(user_role_load_by_name($old_name), 'The role can no longer be retrieved from the database using its old name.');
- $this->assertTrue(is_object(user_role_load_by_name($role_name)), 'The role can be retrieved from the database using its new name.');
+ $this->assertText(t('The role has been renamed.'), t('The role has been renamed.'));
+ $this->assertFalse(user_role_load_by_name($old_name), t('The role can no longer be retrieved from the database using its old name.'));
+ $this->assertTrue(is_object(user_role_load_by_name($role_name)), t('The role can be retrieved from the database using its new name.'));
// Test deleting a role.
$this->drupalPost("admin/people/permissions/roles/edit/{$role->rid}", NULL, t('Delete role'));
$this->drupalPost(NULL, NULL, t('Delete'));
- $this->assertText(t('The role has been deleted.'), 'The role has been deleted');
- $this->assertNoLinkByHref("admin/people/permissions/roles/edit/{$role->rid}", 'Role edit link removed.');
- $this->assertFalse(user_role_load_by_name($role_name), 'A deleted role can no longer be loaded.');
+ $this->assertText(t('The role has been deleted.'), t('The role has been deleted'));
+ $this->assertNoLinkByHref("admin/people/permissions/roles/edit/{$role->rid}", t('Role edit link removed.'));
+ $this->assertFalse(user_role_load_by_name($role_name), t('A deleted role can no longer be loaded.'));
// Make sure that the system-defined roles cannot be edited via the user
// interface.
$this->drupalGet('admin/people/permissions/roles/edit/' . DRUPAL_ANONYMOUS_RID);
- $this->assertResponse(403, 'Access denied when trying to edit the built-in anonymous role.');
+ $this->assertResponse(403, t('Access denied when trying to edit the built-in anonymous role.'));
$this->drupalGet('admin/people/permissions/roles/edit/' . DRUPAL_AUTHENTICATED_RID);
- $this->assertResponse(403, 'Access denied when trying to edit the built-in authenticated role.');
+ $this->assertResponse(403, t('Access denied when trying to edit the built-in authenticated role.'));
}
}
@@ -1669,11 +1669,11 @@ class UserTokenReplaceTestCase extends DrupalWebTestCase {
$tests['[current-user:name]'] = check_plain($user->name);
// Test to make sure that we generated something for each token.
- $this->assertFalse(in_array(0, array_map('strlen', $tests)), 'No empty tokens generated.');
+ $this->assertFalse(in_array(0, array_map('strlen', $tests)), t('No empty tokens generated.'));
foreach ($tests as $input => $expected) {
$output = token_replace($input, array('user' => $account), array('language' => $language));
- $this->assertFalse(strcmp($output, $expected), 'Sanitized user token ' . $input . ' replaced.');
+ $this->assertFalse(strcmp($output, $expected), t('Sanitized user token %token replaced.', array('%token' => $input)));
}
// Generate and test unsanitized tokens.
@@ -1683,7 +1683,7 @@ class UserTokenReplaceTestCase extends DrupalWebTestCase {
foreach ($tests as $input => $expected) {
$output = token_replace($input, array('user' => $account), array('language' => $language, 'sanitize' => FALSE));
- $this->assertFalse(strcmp($output, $expected), 'Unsanitized user token ' . $input . ' replaced.');
+ $this->assertFalse(strcmp($output, $expected), t('Unsanitized user token %token replaced.', array('%token' => $input)));
}
}
}
@@ -1744,20 +1744,20 @@ class UserRolesAssignmentTestCase extends DrupalWebTestCase {
* Tests that a user can be assigned a role and that the role can be removed
* again.
*/
- function testAssignAndRemoveRole() {
+ function testAssignAndRemoveRole() {
$rid = $this->drupalCreateRole(array('administer content types'));
$account = $this->drupalCreateUser();
// Assign the role to the user.
$this->drupalPost('user/' . $account->uid . '/edit', array("roles[$rid]" => $rid), t('Save'));
$this->assertText(t('The changes have been saved.'));
- $this->assertFieldChecked('edit-roles-' . $rid, 'Role is assigned.');
+ $this->assertFieldChecked('edit-roles-' . $rid, t('Role is assigned.'));
$this->userLoadAndCheckRoleAssigned($account, $rid);
// Remove the role from the user.
$this->drupalPost('user/' . $account->uid . '/edit', array("roles[$rid]" => FALSE), t('Save'));
$this->assertText(t('The changes have been saved.'));
- $this->assertNoFieldChecked('edit-roles-' . $rid, 'Role is removed from user.');
+ $this->assertNoFieldChecked('edit-roles-' . $rid, t('Role is removed from user.'));
$this->userLoadAndCheckRoleAssigned($account, $rid, FALSE);
}
@@ -1781,13 +1781,13 @@ class UserRolesAssignmentTestCase extends DrupalWebTestCase {
$account = user_load_by_name($edit['name']);
$this->drupalGet('user/' . $account->uid . '/edit');
- $this->assertFieldChecked('edit-roles-' . $rid, 'Role is assigned.');
+ $this->assertFieldChecked('edit-roles-' . $rid, t('Role is assigned.'));
$this->userLoadAndCheckRoleAssigned($account, $rid);
// Remove the role again.
$this->drupalPost('user/' . $account->uid . '/edit', array("roles[$rid]" => FALSE), t('Save'));
$this->assertText(t('The changes have been saved.'));
- $this->assertNoFieldChecked('edit-roles-' . $rid, 'Role is removed from user.');
+ $this->assertNoFieldChecked('edit-roles-' . $rid, t('Role is removed from user.'));
$this->userLoadAndCheckRoleAssigned($account, $rid, FALSE);
}
@@ -1801,10 +1801,10 @@ class UserRolesAssignmentTestCase extends DrupalWebTestCase {
private function userLoadAndCheckRoleAssigned($account, $rid, $is_assigned = TRUE) {
$account = user_load($account->uid, TRUE);
if ($is_assigned) {
- $this->assertTrue(array_key_exists($rid, $account->roles), 'The role is present in the user object.');
+ $this->assertTrue(array_key_exists($rid, $account->roles), t('The role is present in the user object.'));
}
else {
- $this->assertFalse(array_key_exists($rid, $account->roles), 'The role is not present in the user object.');
+ $this->assertFalse(array_key_exists($rid, $account->roles), t('The role is not present in the user object.'));
}
}
}