summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAngie Byron2010-08-05 23:26:36 (GMT)
committerAngie Byron2010-08-05 23:26:36 (GMT)
commitcacd044a6398df92de68c5aea31987ac0fff507a (patch)
tree41305d208c037ae0aad0c68fb23beb66715f145a
parentefbf061c8142c201967389eac42e8284dfa9aff9 (diff)
#500866 by boombatower, solotandem: Remove t() from assertion messages in SimpleTest, so translators do not get 1000s of bogus strings.
-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, 3710 insertions, 3734 deletions
diff --git a/modules/aggregator/aggregator.test b/modules/aggregator/aggregator.test
index 160f8ba..eb0343a 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'])), t('The feed !name has been added.', array('!name' => $edit['title'])));
+ $this->assertRaw(t('The feed %name has been added.', array('%name' => $edit['title'])), 'The feed ' . $edit['title'] . ' has been added.');
$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), t('The feed found in database.'));
+ $this->assertTrue(!empty($feed), '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)), t('Feed deleted successfully.'));
+ $this->assertRaw(t('The feed %title has been deleted.', array('%title' => $feed->title)), '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, t('!url is reachable.', array('!url' => $feed->url)));
+ $this->assertResponse(200, $feed->url . ' is reachable.');
// 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, t('Total items in feed equal to the total items in database (!val1 != !val2)', array('!val1' => $expected_count, '!val2' => $feed->item_count)));
+ $this->assertEqual($expected_count, $feed->item_count, 'Total items in feed equal to the total items in database (' . $expected_count . ' != ' . $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)), t('Feed items removed.'));
+ $this->assertRaw(t('The news items from %title have been removed.', array('%title' => $feed->title)), '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)), t('Directed to correct url.'));
- $this->assertTrue($this->uniqueFeed($feed->title, $feed->url), t('The feed is unique.'));
+ $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.');
// Check feed source.
$this->drupalGet('aggregator/sources/' . $feed->fid);
- $this->assertResponse(200, t('Feed source exists.'));
- $this->assertText($feed->title, t('Page title'));
+ $this->assertResponse(200, 'Feed source exists.');
+ $this->assertText($feed->title, 'Page title');
$this->drupalGet('aggregator/sources/' . $feed->fid . '/categorize');
- $this->assertResponse(200, t('Feed categorization page exists.'));
+ $this->assertResponse(200, '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'])), t('The category %title has been added.', array('%title' => $category_1['title'])));
+ $this->assertRaw(t('The category %title has been added.', array('%title' => $category_1['title'])), 'The category ' . $category_1['title'] . ' has been added.');
$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'])), t('The category %title has been added.', array('%title' => $category_2['title'])));
+ $this->assertRaw(t('The category %title has been added.', array('%title' => $category_2['title'])), 'The category ' . $category_2['title'] . ' has been added.');
// 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, t('Feed has 2 categories'));
+ $this->assertEqual(count($db_feed->categories), 2, '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'])), t('The feed %name has been updated.', array('%name' => $edit['title'])));
+ $this->assertRaw(t('The feed %name has been updated.', array('%name' => $edit['title'])), 'The feed ' . $edit['title'] . ' has been updated.');
// Check feed data.
$this->assertEqual($this->getUrl(), url('admin/config/services/aggregator/', array('absolute' => TRUE)));
- $this->assertTrue($this->uniqueFeed($edit['title'], $edit['url']), t('The feed is unique.'));
+ $this->assertTrue($this->uniqueFeed($edit['title'], $edit['url']), 'The feed is unique.');
// Check feed source.
$this->drupalGet('aggregator/sources/' . $feed->fid);
- $this->assertResponse(200, t('Feed source exists.'));
- $this->assertText($edit['title'], t('Page title'));
+ $this->assertResponse(200, 'Feed source exists.');
+ $this->assertText($edit['title'], '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, t('Deleted feed source does not exists.'));
+ $this->assertResponse(404, '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, t('Feed not found in database'));
+ $this->assertFalse($result, 'Feed not found in database');
}
}
@@ -455,10 +455,10 @@ class UpdateFeedItemTestCase extends AggregatorTestCase {
);
$this->drupalGet($edit['url']);
- $this->assertResponse(array(200), t('URL !url is accessible', array('!url' => $edit['url'])));
+ $this->assertResponse(array(200), 'URL ' . $edit['url'] . ' is accessible');
$this->drupalPost('admin/config/services/aggregator/add/feed', $edit, t('Save'));
- $this->assertRaw(t('The feed %name has been added.', array('%name' => $edit['title'])), t('The feed !name has been added.', array('!name' => $edit['title'])));
+ $this->assertRaw(t('The feed %name has been added.', array('%name' => $edit['title'])), 'The feed ' . $edit['title'] . ' has been added.');
$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, t('Publish timestamp of feed item was not updated (!before === !after)', array('!before' => $before, '!after' => $after)));
+ $this->assertTrue($before === $after, 'Publish timestamp of feed item was not updated (' . $before . ' === ' . $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'])), t('The category %title has been added.', array('%title' => $edit['title'])));
+ $this->assertRaw(t('The category %title has been added.', array('%title' => $edit['title'])), 'The category ' . $edit['title'] . ' has been added.');
$category = db_query("SELECT * FROM {aggregator_category} WHERE title = :title", array(':title' => $edit['title']))->fetch();
- $this->assertTrue(!empty($category), t('The category found in database.'));
+ $this->assertTrue(!empty($category), '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), t('The menu link associated with the category found in database.'));
+ $this->assertTrue(!empty($menu_link), '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), t('The category found in the feed.'));
+ $this->assertTrue(!empty($feed->categories), '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, t('Total items in feed equal to the total categorized feed items in database'));
+ $this->assertEqual($feed->item_count, $categorized_count, '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.', 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.'));
+ $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.');
}
/**
@@ -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.'), t('Error if no fields are filled.'));
+ $this->assertRaw(t('You must <em>either</em> upload a file or enter a URL.'), '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.'), t('Error if both fields are filled.'));
+ $this->assertRaw(t('You must <em>either</em> upload a file or enter a URL.'), '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.'), t('Error if the URL is invalid.'));
+ $this->assertText(t('This URL is not valid.'), 'Error if the URL is invalid.');
$after = db_query('SELECT COUNT(*) FROM {aggregator_feed}')->fetchField();
- $this->assertEqual($before, $after, t('No feeds were added during the three last form submissions.'));
+ $this->assertEqual($before, $after, '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.'), t('Attempting to upload invalid XML.'));
+ $this->assertText(t('No new feed has been added.'), '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.'), t('Attempting to load empty OPML from remote URL.'));
+ $this->assertText(t('No new feed has been added.'), 'Attempting to load empty OPML from remote URL.');
$after = db_query('SELECT COUNT(*) FROM {aggregator_feed}')->fetchField();
- $this->assertEqual($before, $after, t('No feeds were added during the two last form submissions.'));
+ $this->assertEqual($before, $after, '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'])), 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'));
+ $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');
$after = db_query('SELECT COUNT(*) FROM {aggregator_feed}')->fetchField();
- $this->assertEqual($after, 2, t('Verifying that two distinct feeds were added.'));
+ $this->assertEqual($after, 2, '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'], 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.'));
+ $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.');
}
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.'), t('Block successfully moved to %region_name region.', array( '%region_name' => $region)));
+ $this->assertText(t('The block settings have been updated.'), 'Block successfully moved to ' . $region . ' region.');
// Confirm that the block is now being displayed on pages.
$this->drupalGet('node');
- $this->assertText(t($block['title']), t('Feed block is displayed on the page.'));
+ $this->assertText(t($block['title']), '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]), t('Link to href %href found.', array('%href' => $href)));
+ $this->assert(isset($links[0]), 'Link to href ' . $href . ' found.');
// Visit that page.
$this->drupalGet($href);
$correct_titles = $this->xpath('//h1[normalize-space(text())=:title]', array(':title' => $feed->title));
- $this->assertFalse(empty($correct_titles), t('Aggregator feed page is available and has the correct title.'));
+ $this->assertFalse(empty($correct_titles), '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, t('Feed %name exists.', array('%name' => $feed->title)));
+ $this->assertResponse(200, 'Feed ' . $feed->title . ' exists.');
$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, t('Feed %name exists.', array('%name' => $feed->title)));
+ $this->assertResponse(200, 'Feed ' . $feed->title . ' exists.');
$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 86584df..7cb70aa 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'), t('Add block link is present on block overview page for default theme.'));
+ $this->assertRaw(l('Add block', 'admin/structure/block/add'), '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'), t('Add block link is present on block overview page for non-default theme.'));
+ $this->assertRaw(l('Add block', 'admin/structure/block/list/seven/add'), '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]), t('The hidden region @region is not available for @theme.', array('@region' => $hidden_region, '@theme' => $key)));
+ $this->assertFalse(isset($elements[0]), 'The hidden region ' . $hidden_region . ' is not available for ' . $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.'), t('Custom block successfully created.'));
+ $this->assertText(t('The block has been created.'), '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, t('Custom block found in database'));
+ $this->assertNotNull($bid, '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'), t('Custom block configure link found.'));
- $this->assertRaw(l(t('delete'), 'admin/structure/block/manage/block/' . $bid . '/delete'), t('Custom block delete link found.'));
+ $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.');
// 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'])), t('Custom block successfully deleted.'));
- $this->assertNoText(t($custom_block['title']), t('Custom block no longer appears on page.'));
+ $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.');
$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, t('Table block_role being cleaned.'));
+ $this->assertFalse($count, '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>', t('Custom block successfully being displayed using Full HTML.'));
+ $this->assertRaw('<h1>Full HTML</h1>', '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.'), t('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.'), '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>', t('Custom block successfully being displayed using Full HTML.'));
+ $this->assertRaw('<h1>Full HTML</h1>', '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, t('Block was displayed on the front page.'));
+ $this->assertText($title, 'Block was displayed on the front page.');
$this->drupalGet('user');
- $this->assertNoText($title, t('Block was not displayed according to block visibility rules.'));
+ $this->assertNoText($title, 'Block was not displayed according to block visibility rules.');
$this->drupalGet('USER/' . $this->admin_user->uid);
- $this->assertNoText($title, t('Block was not displayed according to block visibility rules regardless of path case.'));
+ $this->assertNoText($title, '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, t('Block was not displayed to anonymous users.'));
+ $this->assertNoText($title, '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.'), t('Block title set.'));
+ $this->assertText(t('The block configuration has been saved.'), '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, t('Block found in database'));
+ $this->assertNotNull($bid, '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.'), t('Block successfully move to disabled region.'));
- $this->assertNoText(t($block['title']), t('Block no longer appears on page.'));
+ $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.');
// Confirm that the regions xpath is not availble
$xpath = $this->buildXPathQuery('//div[@id=:id]/*', array(':id' => 'block-block-' . $bid));
- $this->assertNoFieldByXPath($xpath, FALSE, t('Custom block found in no regions.'));
+ $this->assertNoFieldByXPath($xpath, FALSE, '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.'), t('Block successfully move to first sidebar region.'));
+ $this->assertText(t('The block settings have been updated.'), '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.'), t('Block title set.'));
+ $this->assertText(t('The block configuration has been saved.'), '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.'), t('Block successfully moved to %region_name region.', array( '%region_name' => $region)));
+ $this->assertText(t('The block settings have been updated.'), 'Block successfully moved to ' . $region . ' region.');
// Confirm that the block is being displayed.
$this->drupalGet('node');
- $this->assertText(t($block['title']), t('Block successfully being displayed on the page.'));
+ $this->assertText(t($block['title']), '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, t('Custom block found in %region_name region.', array('%region_name' => $region)));
+ $this->assertFieldByXPath($xpath, FALSE, 'Custom block found in ' . $region . ' region.');
}
/**
@@ -262,14 +262,14 @@ class BlockTestCase extends DrupalWebTestCase {
*/
function testBlockRehash() {
module_enable(array('block_test'));
- $this->assertTrue(module_exists('block_test'), t('Test block module enabled.'));
+ $this->assertTrue(module_exists('block_test'), '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, t('Test block cache mode defaults to DRUPAL_CACHE_PER_ROLE.'));
+ $this->assertEqual($current_caching, DRUPAL_CACHE_PER_ROLE, '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, t("Test block's database entry updated to DRUPAL_NO_CACHE."));
+ $this->assertEqual($current_caching, DRUPAL_NO_CACHE, "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, t('Only the default theme and the admin theme have blocks.'));
+ $this->assertFalse($count, '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, t('Block %name matched', array('%name' => $block->module . '-' . $block->delta)));
+ $this->assertEqual($blocks[$block->module][$block->delta], $block, 'Block ' . $block->module . '-' . $block->delta . ' matched');
}
}
}
@@ -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, t('The block admin page for a disabled theme can not be accessed'));
+ $this->assertResponse(403, '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, t('The block admin page for the admin theme can be accessed'));
+ $this->assertResponse(200, '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, t('Block content displays.'));
+ $this->assertText($current_content, '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, t('Block is served from the cache.'));
+ $this->assertText($old_content, '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, t('Block cache clear removes stale cache data.'));
- $this->assertText($current_content, t('Fresh block content is displayed after clearing the cache.'));
+ $this->assertNoText($old_content, 'Block cache clear removes stale cache data.');
+ $this->assertText($current_content, '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, t('Anonymous user does not see content cached per-role for normal user.'));
+ $this->assertNoText($old_content, 'Anonymous user does not see content cached per-role for normal user.');
$this->drupalLogin($this->normal_user_alt);
$this->drupalGet('');
- $this->assertText($old_content, t('User with the same roles sees per-role cached content.'));
+ $this->assertText($old_content, 'User with the same roles sees per-role cached content.');
$this->drupalLogin($this->admin_user);
$this->drupalGet('');
- $this->assertNoText($old_content, t('Admin user does not see content cached per-role for normal user.'));
+ $this->assertNoText($old_content, 'Admin user does not see content cached per-role for normal user.');
$this->drupalLogin($this->normal_user);
$this->drupalGet('');
- $this->assertText($old_content, t('Block is served from the per-role cache.'));
+ $this->assertText($old_content, '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, t('Block content displays.'));
+ $this->assertText($current_content, '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, t('Block content served from global cache.'));
+ $this->assertText($old_content, '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, t('Block content displays.'));
+ $this->assertText($current_content, '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, t('DRUPAL_NO_CACHE prevents blocks from being cached.'));
+ $this->assertText($current_content, '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, t('Block content displays.'));
+ $this->assertText($current_content, 'Block content displays.');
$old_content = $current_content;
$current_content = $this->randomName();
variable_set('block_test_content', $current_content);
$this->drupalGet('');
- $this->assertText($old_content, t('Block is served from per-user cache.'));
+ $this->assertText($old_content, 'Block is served from per-user cache.');
$this->drupalLogin($this->normal_user_alt);
$this->drupalGet('');
- $this->assertText($current_content, t('Per-user block cache is not served for other users.'));
+ $this->assertText($current_content, 'Per-user block cache is not served for other users.');
$this->drupalLogin($this->normal_user);
$this->drupalGet('');
- $this->assertText($old_content, t('Per-user block cache is persistent.'));
+ $this->assertText($old_content, '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, t('Block content displays on the node page.'));
+ $this->assertText($current_content, '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, t('Block content cached for the node page does not show up for the user page.'));
+ $this->assertNoText($old_content, 'Block content cached for the node page does not show up for the user page.');
$this->drupalGet('node');
- $this->assertText($old_content, t('Block content cached for the node page.'));
+ $this->assertText($old_content, '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(t('Unable to set cache mode to %mode. Current mode: %current_mode', array('%mode' => $cache_mode, '%current_mode' => $current_mode)));
+ $this->fail('Unable to set cache mode to ' . $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', t('HTML id for test block is valid.'));
+ $this->assertRaw('block-block-test-test-html-id', 'HTML id for test block is valid.');
}
}
diff --git a/modules/blog/blog.test b/modules/blog/blog.test
index 500a9d7..be0e89f 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', 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'));
+ $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');
}
/**
@@ -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', 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'));
+ $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');
}
/**
@@ -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, t('Number of recent blog posts changed.'));
+ $this->assertEqual(variable_get('blog_block_count', 10), 5, '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'), t('Blog help node was displayed'));
- $this->assertText(t('Blog'), t('Blog help node was displayed'));
+ $this->assertTitle(t('Blog | Drupal'), 'Blog help node was displayed');
+ $this->assertText(t('Blog'), 'Blog help node was displayed');
}
// Verify the blog block was displayed.
$this->drupalGet('');
$this->assertResponse(200);
- $this->assertText(t('Recent blog posts'), t('Blog block was displayed'));
+ $this->assertText(t('Recent blog posts'), 'Blog block was displayed');
// View blog node.
$this->drupalGet('node/' . $node->nid);
$this->assertResponse(200);
- $this->assertTitle($node->title . ' | Drupal', t('Blog node was displayed'));
+ $this->assertTitle($node->title . ' | Drupal', '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)), t('Breadcrumbs were displayed'));
+ $this->assertRaw(theme('breadcrumb', array('breadcrumb' => $breadcrumb)), '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', t('Blog edit node was displayed'));
+ $this->assertTitle('Edit Blog entry ' . $node->title . ' | Drupal', '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"])), t('Blog node was edited'));
+ $this->assertRaw(t('Blog entry %title has been updated.', array('%title' => $edit["title"])), '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"])), t('Blog node was deleted'));
+ $this->assertRaw(t('Blog entry %title has been deleted.', array('%title' => $edit["title"])), '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'), t('View recent blog entries link was displayed'));
+ $this->assertText(t('View recent blog entries'), '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))), t('View recent blog entries link target was correct'));
+ $this->assertTitle(t("@name's blog | Drupal", array('@name' => format_username($user))), 'View recent blog entries link target was correct');
// Confirm a blog page was displayed.
$this->drupalGet('blog');
$this->assertResponse(200);
- $this->assertTitle('Blogs | Drupal', t('Blog page was displayed'));
- $this->assertText(t('Home'), t('Breadcrumbs were displayed'));
+ $this->assertTitle('Blogs | Drupal', 'Blog page was displayed');
+ $this->assertText(t('Home'), '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))), t('User blog node was displayed'));
+ $this->assertTitle(t("@name's blog | Drupal", array('@name' => format_username($user))), 'User blog node was displayed');
// Confirm a blog feed was displayed.
$this->drupalGet('blog/feed');
- $this->assertTitle(t('Drupal blogs'), t('Blog feed was displayed'));
+ $this->assertTitle(t('Drupal blogs'), '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))), t('User blog feed was displayed'));
+ $this->assertTitle(t("@name's blog", array('@name' => format_username($user))), 'User blog feed was displayed');
}
}
diff --git a/modules/book/book.test b/modules/book/book.test
index a544617..685a6fc 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), t('Node ' . $number . ' outline confirmed.'));
+ $this->assertPattern($this->generateOutlinePattern($nodes), 'Node ' . $number . ' outline confirmed.');
}
else {
- $this->pass(t('Node ' . $number . ' doesn\'t have outline.'));
+ $this->pass('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')))), t('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')))), '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')))), t('Up page link found.'));
+ $this->assertRaw(l('up', 'node/' . $up->nid, array('attributes' => array('class' => array('page-up'), 'title' => t('Go to parent page')))), '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')))), t('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')))), '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, t('The breadcrumb is correctly displayed on the page.'));
+ $this->assertIdentical($expected_breadcrumb, $got_breadcrumb, 'The breadcrumb is correctly displayed on the page.');
// Check printer friendly version.
$this->drupalGet('book/export/html/' . $node->nid);
- $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.'));
+ $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.');
$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), t('Book node found in database.'));
+ $this->assertNotNull(($node === FALSE ? NULL : $node), '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, 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.'));
+ $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.');
}
-
+
// Make sure we can't export an unsupported format.
$this->drupalGet('book/export/foobar/' . $this->book->nid);
- $this->assertResponse('404', t('Unsupported export format returned "not found".'));
-
+ $this->assertResponse('404', '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'), t('Anonymous user is not shown link to printer-friendly version.'));
-
+ $this->assertNoLink(t('Printer-friendly version'), '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', t('Anonymous user properly forbidden.'));
+ $this->assertResponse('403', '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.'), t('Block configuration set.'));
+ $this->assertText(t('The block configuration has been saved.'), '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.'), t('Block successfully move to footer region.'));
+ $this->assertText(t('The block settings have been updated.'), 'Block successfully move to footer region.');
}
}
diff --git a/modules/comment/comment.test b/modules/comment/comment.test
index 54a39bf..55882c2 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', '', t('Subject field not found.'));
+ $this->assertNoFieldByName('subject', '', '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'), t('Save button not found.'));
+ $this->assertNoFieldByName('op', t('Save'), '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'), t('Preview button found.'));
- $this->assertFieldByName('op', t('Save'), t('Save button found.'));
+ $this->assertFieldByName('op', t('Preview'), 'Preview button found.');
+ $this->assertFieldByName('op', t('Save'), 'Save button found.');
$this->drupalPost(NULL, $edit, t('Save'));
break;
case DRUPAL_DISABLED:
- $this->assertNoFieldByName('op', t('Preview'), t('Preview button not found.'));
- $this->assertFieldByName('op', t('Save'), t('Save button found.'));
+ $this->assertNoFieldByName('op', t('Preview'), 'Preview button not found.');
+ $this->assertFieldByName('op', t('Save'), '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])), t('Comment id found.'));
+ $this->assertTrue((!empty($match) && !empty($match[1])), '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.'), t('Comment deleted.'));
+ $this->assertText(t('The comment and all its replies have been deleted.'), 'Comment deleted.');
}
/**
@@ -196,7 +196,7 @@ class CommentHelperCase extends DrupalWebTestCase {
*/
function setCommentSettings($name, $value, $message) {
variable_set($name . '_article', $value);
- $this->assertTrue(TRUE, t($message)); // Display status message.
+ $this->assertTrue(TRUE, $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)), t('Operation "' . $operation . '" was performed on comment.'));
+ $this->assertRaw(t('Deleted @count comments.', array('@count' => 1)), 'Operation "' . $operation . '" was performed on comment.');
}
else {
- $this->assertText(t('The update has been performed.'), t('Operation "' . $operation . '" was performed on comment.'));
+ $this->assertText(t('The update has been performed.'), '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), t('Comment found.'));
+ $this->assertTrue($this->commentExists($comment), '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), t('Comment found.'));
+ $this->assertTrue($this->commentExists($comment), 'Comment found.');
// Check comment display.
$this->drupalGet('node/' . $this->node->nid . '/' . $comment->id);
- $this->assertText($subject_text, t('Individual comment subject found.'));
- $this->assertText($comment_text, t('Individual comment body found.'));
+ $this->assertText($subject_text, 'Individual comment subject found.');
+ $this->assertText($comment_text, '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, t('Individual comment-reply subject found.'));
- $this->assertText($comment_text, t('Individual comment-reply body found.'));
+ $this->assertText($subject_text, 'Individual comment-reply subject found.');
+ $this->assertText($comment_text, 'Individual comment-reply body found.');
$reply = $this->postComment(NULL, $this->randomName(), '', TRUE);
$reply_loaded = comment_load($reply->id);
- $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.'));
+ $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.');
// Second reply to comment #3 creating comment #4.
$this->drupalGet('comment/reply/' . $this->node->nid . '/' . $comment->id);
- $this->assertText($subject_text, t('Individual comment-reply subject found.'));
- $this->assertText($comment_text, t('Individual comment-reply body found.'));
+ $this->assertText($subject_text, 'Individual comment-reply subject found.');
+ $this->assertText($comment_text, '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), t('Second reply found.'));
- $this->assertEqual(rtrim($comment_loaded->thread, '/') . '.01/', $reply_loaded->thread, t('Thread of second reply grows correctly.'));
+ $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.');
// Edit reply.
$this->drupalGet('comment/' . $reply->id . '/edit');
$reply = $this->postComment(NULL, $this->randomName(), $this->randomName(), TRUE);
- $this->assertTrue($this->commentExists($reply, TRUE), t('Modified reply found.'));
+ $this->assertTrue($this->commentExists($reply, TRUE), 'Modified reply found.');
// Correct link count
$this->drupalGet('node');
- $this->assertRaw('4 comments', t('Link to the 4 comments exist.'));
+ $this->assertRaw('4 comments', '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), t('Page one exists. %s'));
+ $this->assertTrue($this->commentExists($comment_new_page), 'Page one exists. %s');
$this->drupalGet('node/' . $this->node->nid, array('query' => array('page' => 1)));
- $this->assertTrue($this->commentExists($reply, TRUE), t('Page two exists. %s'));
+ $this->assertTrue($this->commentExists($reply, TRUE), '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, t('Article node created.'));
+ $this->assertTrue($this->node, 'Article node created.');
$this->drupalGet('comment/reply/' . $this->node->nid);
- $this->assertText('This discussion is closed', t('Posting to node with comments disabled'));
- $this->assertNoField('edit-comment', t('Comment body field found.'));
+ $this->assertText('This discussion is closed', 'Posting to node with comments disabled');
+ $this->assertNoField('edit-comment', '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, t('Article node created.'));
+ $this->assertTrue($this->node, 'Article node created.');
$this->drupalGet('comment/reply/' . $this->node->nid);
- $this->assertText('This discussion is closed', t('Posting to node with comments read-only'));
- $this->assertNoField('edit-comment', t('Comment body field found.'));
+ $this->assertText('This discussion is closed', 'Posting to node with comments read-only');
+ $this->assertNoField('edit-comment', '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, t('Article node created.'));
+ $this->assertTrue($this->node, 'Article node created.');
$this->drupalGet('comment/reply/' . $this->node->nid);
- $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.'));
+ $this->assertNoText('This discussion is closed', 'Posting to node with comments enabled');
+ $this->assertField('edit-comment-body-' . $langcode . '-0-value', '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), t('Comment not found.'));
- $this->assertFalse($this->commentExists($reply, TRUE), t('Reply not found.'));
+ $this->assertFalse($this->commentExists($comment), 'Comment not found.');
+ $this->assertFalse($this->commentExists($reply, TRUE), '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), t('Form comment found.'));
+ $this->assertTrue($this->commentExists($form_comment), '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'), 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->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.');
// Check that the title and body fields are displayed with the correct values.
- $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('subject', $edit['subject'], 'Subject field displayed.');
+ $this->assertFieldByName('comment_body[' . $langcode . '][0][value]', $edit['comment_body[' . $langcode . '][0][value]'], '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'), 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.'));
+ $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.');
// Check that the title and body fields are displayed with the correct values.
- $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.'));
+ $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.');
}
}
@@ -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), t('Anonymous comment without contact info found.'));
+ $this->assertTrue($this->commentExists($anonymous_comment1), '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), t('Modified reply found.'));
+ $this->assertTrue($this->commentExists($edited_comment, FALSE), 'Modified reply found.');
$this->drupalLogout();
// Post anonymous comment with contact info (optional).
$this->drupalGet('comment/reply/' . $this->node->nid);
- $this->assertTrue($this->commentContactInfoAvailable(), t('Contact information available.'));
+ $this->assertTrue($this->commentContactInfoAvailable(), 'Contact information available.');
$anonymous_comment2 = $this->postComment($this->node, $this->randomName(), $this->randomName());
- $this->assertTrue($this->commentExists($anonymous_comment2), t('Anonymous comment with contact info (optional) found.'));
+ $this->assertTrue($this->commentExists($anonymous_comment2), '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(), t('Contact information available.'));
+ $this->assertTrue($this->commentContactInfoAvailable(), 'Contact information available.');
$anonymous_comment3 = $this->postComment($this->node, $this->randomName(), $this->randomName(), TRUE);
- $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.'));
+ $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.');
// 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), t('Anonymous comment with contact info (required) found.'));
+ $this->assertTrue($this->commentExists($anonymous_comment3), '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, 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."));
+ $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.");
// Unpublish comment.
$this->performCommentOperation($anonymous_comment3, 'unpublish');
$this->drupalGet('admin/content/comment/approval');
- $this->assertRaw('comments[' . $anonymous_comment3->id . ']', t('Comment was unpublished.'));
+ $this->assertRaw('comments[' . $anonymous_comment3->id . ']', 'Comment was unpublished.');
// Publish comment.
$this->performCommentOperation($anonymous_comment3, 'publish', TRUE);
$this->drupalGet('admin/content/comment');
- $this->assertRaw('comments[' . $anonymous_comment3->id . ']', t('Comment was published.'));
+ $this->assertRaw('comments[' . $anonymous_comment3->id . ']', 'Comment was published.');
// Delete comment.
$this->performCommentOperation($anonymous_comment3, 'delete');
$this->drupalGet('admin/content/comment');
- $this->assertNoRaw('comments[' . $anonymous_comment3->id . ']', t('Comment was deleted.'));
+ $this->assertNoRaw('comments[' . $anonymous_comment3->id . ']', '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"([^>]*?)>/', t('Comments were not displayed.'));
- $this->assertNoLink('Add new comment', t('Link to add comment was found.'));
+ $this->assertNoPattern('/<div ([^>]*?)id="comments"([^>]*?)>/', 'Comments were not displayed.');
+ $this->assertNoLink('Add new comment', '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', t('Error attempting to post comment.'));
- $this->assertNoFieldByName('subject', '', t('Subject field not found.'));
- $this->assertNoFieldByName('comment[value]', '', t('Comment field not found.'));
+ $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.');
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"([^>]*?)>/', 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.'));
+ $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.');
}
}
@@ -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'), 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.'));
+ $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.');
// Check the second page.
$this->drupalGet('node/' . $node->nid, array('query' => array('page' => 1)));
- $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.'));
+ $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.');
// Check the third page.
$this->drupalGet('node/' . $node->nid, array('query' => array('page' => 2)));
- $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.'));
+ $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.');
// 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), t('In flat mode, reply does not appear on page 1.'));
+ $this->assertFalse($this->commentExists($reply, TRUE), '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), 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.'));
+ $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.');
// 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), t('In threaded mode where # replies > # comments per page, the newest reply does not appear on page 1.'));
+ $this->assertFalse($this->commentExists($reply2, TRUE), '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, t('Comment order: expected @expected, returned @returned.', array('@expected' => implode(',', $expected_cids), '@returned' => implode(',', $result_order))));
+ return $this->assertIdentical($expected_cids, $result_order, 'Comment order: 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, t('Flat mode, @new replies: expected page @expected, returned page @returned.', array('@new' => $new_replies, '@expected' => $expected_page, '@returned' => $returned_page)));
+ $this->assertIdentical($expected_page, $returned_page, 'Flat mode, ' . $new_replies . ' replies: expected page ' . $expected_page . ', returned page ' . $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, t('Threaded mode, @new replies: expected page @expected, returned page @returned.', array('@new' => $new_replies, '@expected' => $expected_page, '@returned' => $returned_page)));
+ $this->assertEqual($expected_page, $returned_page, 'Threaded mode, ' . $new_replies . ' replies: expected page ' . $expected_page . ', returned page ' . $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.'), t('Comment requires approval.'));
+ $this->assertText(t('Your comment has been queued for review by site administrators and will be published after approval.'), '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), t('Anonymous comment was not published.'));
+ $this->assertFalse($this->commentExists($anonymous_comment4), '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), t('Anonymous comment visible.'));
+ $this->assertTrue($this->commentExists($anonymous_comment4), '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)), t('Two unapproved comments waiting for approval.'));
+ $this->assertText(t('Unapproved comments (@count)', array('@count' => 2)), '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)), t('All comments were approved.'));
+ $this->assertText(t('Unapproved comments (@count)', array('@count' => 0)), '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?'), t('Confirmation required.'));
+ $this->assertText(t('Are you sure you want to delete these comments and all their children?'), 'Confirmation required.');
$this->drupalPost(NULL, $edit, t('Delete comments'));
- $this->assertText(t('No comments available.'), t('All comments were deleted.'));
+ $this->assertText(t('No comments available.'), '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.'), t('Comment requires approval.'));
+ $this->assertText(t('Your comment has been queued for review by site administrators and will be published after approval.'), '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), t('Anonymous comment was not published.'));
+ $this->assertFalse($this->commentExists($anonymous_comment4), 'Anonymous comment was not published.');
// Approve comment.
$this->drupalLogin($this->admin_user);
$this->drupalGet('comment/1/approve');
- $this->assertResponse(403, t('Forged comment approval was denied.'));
+ $this->assertResponse(403, 'Forged comment approval was denied.');
$this->drupalGet('comment/1/approve', array('query' => array('token' => 'forged')));
- $this->assertResponse(403, t('Forged comment approval was denied.'));
+ $this->assertResponse(403, '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), t('Anonymous comment visible.'));
+ $this->assertTrue($this->commentExists($anonymous_comment4), '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.'), t('Block saved to first sidebar region.'));
+ $this->assertText(t('The block settings have been updated.'), '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.'), t('Block saved.'));
+ $this->assertText(t('The block configuration has been saved.'), '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'], t('Block was not found.'));
+ $this->assertNoText($block['title'], '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'], t('Block was found.'));
+ $this->assertText($block['title'], 'Block was found.');
// Test the only the 2 latest comments are shown and in the proper order.
- $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.'));
+ $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.');
// 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.'), t('Block saved.'));
+ $this->assertText(t('The block configuration has been saved.'), '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, 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.'));
+ $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.');
// Test that links to comments work when comments are across pages.
$this->setCommentsPerPage(1);
$this->drupalGet('');
$this->clickLink($comment1->subject);
- $this->assertText($comment1->subject, t('Comment link goes to correct page.'));
+ $this->assertText($comment1->subject, 'Comment link goes to correct page.');
$this->drupalGet('');
$this->clickLink($comment2->subject);
- $this->assertText($comment2->subject, t('Comment link goes to correct page.'));
+ $this->assertText($comment2->subject, 'Comment link goes to correct page.');
$this->clickLink($comment4->subject);
- $this->assertText($comment4->subject, t('Comment link goes to correct page.'));
+ $this->assertText($comment4->subject, '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"', t('Canonical URL was found in the HTML head'));
+ $this->assertRaw('<link rel="canonical"', '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, t('Comments as part of RSS feed.'));
+ $this->assertRaw($raw, '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, t('Hidden comments is not a part of RSS feed.'));
+ $this->assertNoRaw($raw, '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), t('Comment found.'));
+ $this->assertTrue($this->commentExists($comment), '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']), t('Comment content was emptied before being built.'));
+ $this->assertFalse(isset($built_content['test_property']), '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)), t('No empty tokens generated.'));
+ $this->assertFalse(in_array(0, array_map('strlen', $tests)), 'No empty tokens generated.');
foreach ($tests as $input => $expected) {
$output = token_replace($input, array('comment' => $comment), array('language' => $language));
- $this->assertFalse(strcmp($output, $expected), t('Sanitized comment token %token replaced.', array('%token' => $input)));
+ $this->assertFalse(strcmp($output, $expected), 'Sanitized comment token ' . $input . ' replaced.');
}
// 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), t('Unsanitized comment token %token replaced.', array('%token' => $input)));
+ $this->assertFalse(strcmp($output, $expected), 'Unsanitized comment token ' . $input . ' replaced.');
}
// 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), t('Node comment token %token replaced.', array('%token' => $input)));
+ $this->assertFalse(strcmp($output, $expected), 'Node comment token ' . $input . ' replaced.');
}
}
}
diff --git a/modules/contact/contact.test b/modules/contact/contact.test
index 80a157b..0402094 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.'), t('Setting successfully saved.'));
+ $this->assertText(t('The configuration options have been saved.'), '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)), t('Caught invalid recipient (' . $invalid_recipient . ').'));
+ $this->assertRaw(t('%recipient is an invalid e-mail address.', array('%recipient' => $invalid_recipient)), 'Caught invalid recipient (' . $invalid_recipient . ').');
}
// Test validation of empty category and recipients fields.
$this->addCategory($category = '', '', '', TRUE);
- $this->assertText(t('Category field is required.'), t('Caught empty category field'));
- $this->assertText(t('Recipients field is required.'), t('Caught empty recipients field.'));
+ $this->assertText(t('Category field is required.'), 'Caught empty category field');
+ $this->assertText(t('Recipients field is required.'), '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)), t('Category successfully saved.'));
+ $this->assertRaw(t('Category %category has been saved.', array('%category' => $category)), 'Category successfully saved.');
// Make sure the newly created category is included in the list of categories.
- $this->assertNoUniqueText($category, t('New category included in categories list.'));
+ $this->assertNoUniqueText($category, '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)), t('Category successfully saved.'));
+ $this->assertRaw(t('Category %category has been saved.', array('%category' => $category)), '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'), 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->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->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)), t('Category successfully saved.'));
+ $this->assertRaw(t('Category %category has been saved.', array('%category' => $category)), '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)), t('Category successfully saved.'));
+ $this->assertRaw(t('Category %category has been saved.', array('%category' => $category)), '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)), t('Category not saved.'));
- $this->assertRaw(t('A contact form with category %category already exists.', array('%category' => $category)), t('Duplicate category error found.'));
+ $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.');
// 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', t('Flood table emptied.'));
+ $this->assertIdentical($num_records_after, '0', '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, t('Access denied to anonymous user without permission.'));
+ $this->assertResponse(403, '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, t('Access granted to anonymous user with permission.'));
+ $this->assertResponse(200, '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.'), t('Name required.'));
+ $this->assertText(t('Your name field is required.'), '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.'), t('E-mail required.'));
+ $this->assertText(t('Your e-mail address field is required.'), '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.'), t('Valid e-mail required.'));
+ $this->assertText(t('You must enter a valid e-mail address.'), 'Valid e-mail required.');
$this->submitContact($this->randomName(16), $recipients[0], '', $categories[0], $this->randomName(64));
- $this->assertText(t('Subject field is required.'), t('Subject required.'));
+ $this->assertText(t('Subject field is required.'), 'Subject required.');
$this->submitContact($this->randomName(16), $recipients[0], $this->randomName(16), $categories[0], '');
- $this->assertText(t('Message field is required.'), t('Message required.'));
+ $this->assertText(t('Message field is required.'), '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 -'), t('Without selected categories the visitor is asked to chose a category.'));
+ $this->assertRaw(t('- Please choose -'), '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.'), t('Valid category required.'));
+ $this->assertText(t('You must select a valid category.'), '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.'), t('Message sent.'));
+ $this->assertText(t('Your message has been sent.'), 'Message sent.');
}
// Submit contact form one over limit.
$this->drupalGet('contact');
- $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.'));
+ $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.');
// 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, 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'));
+ $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');
// 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, 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'));
+ $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');
// 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, t('No auto-reply e-mail was sent to the sender for category "no-autoreply".'), t('Contact'));
+ $this->assertEqual(count($captured_emails), 0, 'No auto-reply e-mail was sent to the sender for category "no-autoreply".', '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)), t('Category deleted sucessfully.'));
+ $this->assertRaw(t('Category %category has been deleted.', array('%category' => $category_name)), '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.'), t('Setting successfully saved.'));
+ $this->assertText(t('The configuration options have been saved.'), '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 6d9a21e..3b69614 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, t('Admin has access to the dashboard.'));
- $this->assertRaw($custom_block['title'], t('Admin has access to a dashboard block.'));
+ $this->assertResponse(200, 'Admin has access to the dashboard.');
+ $this->assertRaw($custom_block['title'], '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, t('Non-admin has no access to the dashboard.'));
- $this->assertNoText($custom_block['title'], t('Non-admin has no access to a dashboard block.'));
+ $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.');
}
}
diff --git a/modules/dblog/dblog.test b/modules/dblog/dblog.test
index 92f0dd4..c26c632 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, t('[Cache] Row limit variable of @count equals row limit of @limit', array('@count' => $current_limit, '@limit' => $row_limit)));
+ $this->assertTrue($current_limit == $row_limit, '[Cache] Row limit variable of ' . $current_limit . ' equals row limit of ' . $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, t('[Variable table] Row limit variable of @count equals row limit of @limit', array('@count' => $current_limit, '@limit' => $row_limit)));
+ $this->assertTrue($current_limit == $row_limit, '[Variable table] Row limit variable of ' . $current_limit . ' equals row limit of ' . $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, t('Dblog row count of @count exceeds row limit of @limit', array('@count' => $count, '@limit' => $row_limit)));
+ $this->assertTrue($count > $row_limit, 'Dblog row count of ' . $count . ' exceeds row limit of ' . $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, t('Dblog row count of @count equals row limit of @limit plus one', array('@count' => $count, '@limit' => $row_limit)));
+ $this->assertTrue($count == $row_limit + 1, 'Dblog row count of ' . $count . ' equals row limit of ' . $row_limit . ' plus one');
}
/**
@@ -125,35 +125,35 @@ class DBLogTestCase extends DrupalWebTestCase {
$this->drupalGet('admin/help/dblog');
$this->assertResponse($response);
if ($response == 200) {
- $this->assertText(t('Database logging'), t('DBLog help was displayed'));
+ $this->assertText(t('Database logging'), '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'), t('DBLog report was displayed'));
+ $this->assertText(t('Recent log entries'), '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'), t('DBLog page-not-found report was displayed'));
+ $this->assertText(t('Top ' . $quote . 'page not found' . $quote . ' errors'), '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'), t('DBLog access-denied report was displayed'));
+ $this->assertText(t('Top ' . $quote . 'access denied' . $quote . ' errors'), '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'), t('DBLog event node was displayed'));
+ $this->assertText(t('Details'), '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, t('User @name was loaded', array('@name' => $name)));
+ $this->assertTrue($user != NULL, 'User ' . $name . ' was loaded');
$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, t('DBLog contains @count records for @name', array('@count' => $count_before, '@name' => $user->name)));
+ $this->assertTrue($count_before > 0, 'DBLog contains ' . $count_before . ' records for ' . $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, t('DBLog event details was found: [delete user]'));
+ $this->assertRaw($message, 'DBLog event details was found: [delete user]');
break;
}
}
}
- $this->assertTrue($link, t('DBLog event was recorded: [delete user]'));
+ $this->assertTrue($link, '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, t('DBLog event was recorded: [page not found]'));
+ $this->assertText($not_found_url, '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, t('Node @title was loaded', array('@title' => $title)));
+ $this->assertTrue($node != NULL, 'Node ' . $title . ' was loaded');
// 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'), t('DBLog event was recorded: [access denied]'));
+ $this->assertText(t('admin/reports/dblog'), '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)), t('DBLog event was recorded: [page not found]'));
+ $this->assertText(t('node/@nid', array('@nid' => $node->nid)), '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(), t('dblog_watchdog() added an entry to the dblog :count', array(':count' => $count)));
+ $this->assertEqual($count + 1, db_query('SELECT COUNT(*) FROM {watchdog}')->fetchField(), 'dblog_watchdog() added an entry to the dblog ' . $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, t('DBLog contains :count records after a clear.', array(':count' => $count)));
+ $this->assertEqual($count, 0, 'DBLog contains ' . $count . ' records after a clear.');
}
/**
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 6af10a0..ac35684 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'], t("Value $delta is inserted correctly"));
+ $this->assertEqual($rows[$delta][$this->field_name . '_value'], $value['value'], "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'], t("Value $delta is updated correctly"));
+ $this->assertEqual($rows[$delta][$this->field_name . '_value'], $value['value'], "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'], t("Update with no field_name entry leaves value $delta untouched"));
+ $this->assertEqual($rows[$delta][$this->field_name . '_value'], $value['value'], "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, t("Update with an empty field_name entry empties the field."));
+ $this->assertEqual(count($rows), 0, "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(t('Cannot update field schema with data.'));
+ $this->fail('Cannot update field schema with data.');
}
catch (FieldException $e) {
- $this->pass(t('Cannot update field schema with data.'));
+ $this->pass('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'), 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"));
+ $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");
}
// 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"), t("Index on value created in $table"));
+ $this->assertTrue(Database::getConnection()->schema()->indexExists($table, "{$field_name}_value"), "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"), 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"));
+ $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");
}
// 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', t("Index changes performed without dropping the tables"));
+ $this->assertEqual($entity->{$field_name}[LANGUAGE_NONE][0]['value'], 'field data', "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']), t('The storage type is SQL.'));
+ $this->assertTrue(array_key_exists('sql', $field['storage']['details']), '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]), 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.'));
+ $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.');
// 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, 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)));
+ $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 . '.');
}
}
}
diff --git a/modules/field/modules/list/tests/list.test b/modules/field/modules/list/tests/list.test
index 13d2005..2491e93 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]), 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'));
+ $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');
// 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]), 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'));
+ $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');
// 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]), 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'));
+ $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');
// 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]), 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'));
+ $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');
}
}
/**
-* 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", t('Form validation failed.'));
+ $this->assertText("keys must be integers", '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", t('Form validation failed.'));
+ $this->assertText("each key must be a valid integer or decimal", '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", t('Form validation failed.'));
+ $this->assertText("each key must be a string at most 255 characters long", 'Form validation failed.');
}
/**
diff --git a/modules/field/modules/options/options.test b/modules/field/modules/options/options.test
index 8cbfd5b..a593d02 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>', t('Option text was properly filtered.'));
+ $this->assertRaw('Some dangerous &amp; unescaped <strong>markup</strong>', '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>', t('Option text was properly filtered.'));
+ $this->assertRaw('Some dangerous &amp; unescaped <strong>markup</strong>', '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', t('Validation error was displayed.'));
+ $this->assertText('this field cannot hold more than 2 values', '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', t('Option text was properly filtered.'));
+ $this->assertRaw('Some dangerous &amp; unescaped markup', '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)), t('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)), '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', t('Option text was properly filtered.'));
- $this->assertRaw('Group 1', t('Option groups are displayed.'));
+ $this->assertRaw('Some dangerous &amp; unescaped markup', 'Option text was properly filtered.');
+ $this->assertRaw('Group 1', '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', t('Option text was properly filtered.'));
+ $this->assertRaw('Some dangerous &amp; unescaped markup', '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', t('Validation error was displayed.'));
+ $this->assertText('this field cannot hold more than 2 values', '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)), t('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)), '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', t('Option text was properly filtered.'));
- $this->assertRaw('Group 1', t('Option groups are displayed.'));
+ $this->assertRaw('Some dangerous &amp; unescaped markup', 'Option text was properly filtered.');
+ $this->assertRaw('Group 1', '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>', t('Option text was properly filtered.'));
+ $this->assertRaw('Some dangerous &amp; unescaped <strong>markup</strong>', '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 51e2ce4..a4ead6e 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]", '', t('Widget is displayed'));
- $this->assertNoFieldByName("{$this->field_name}[$langcode][0][format]", '1', t('Format selector is not displayed'));
+ $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');
// 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)), t('Entity was created'));
+ $this->assertRaw(t('test_entity @id has been created.', array('@id' => $id)), '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]", '', t('Widget is displayed'));
- $this->assertNoFieldByName("{$this->field_name}[$langcode][0][format]", '', t('Format selector is not displayed'));
+ $this->assertFieldByName("{$this->field_name}[$langcode][0][value]", '', 'Widget is displayed');
+ $this->assertNoFieldByName("{$this->field_name}[$langcode][0][format]", '', '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)), t('Entity was created'));
+ $this->assertRaw(t('test_entity @id has been created.', array('@id' => $id)), '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, t('HTML tags are not displayed.'));
- $this->assertRaw(check_plain($value), t('Escaped HTML is displayed correctly.'));
+ $this->assertNoRaw($value, 'HTML tags are not displayed.');
+ $this->assertRaw(check_plain($value), '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]", '', t('Widget is displayed'));
- $this->assertFieldByName("{$this->field_name}[$langcode][0][format]", '', t('Format selector is displayed'));
+ $this->assertFieldByName("{$this->field_name}[$langcode][0][value]", '', 'Widget is displayed');
+ $this->assertFieldByName("{$this->field_name}[$langcode][0][format]", '', '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)), t('Entity was updated'));
+ $this->assertRaw(t('test_entity @id has been updated.', array('@id' => $id)), '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, t('Value is displayed unfiltered'));
+ $this->assertRaw($value, '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, t('Generated summary "@summary" matches expected "@expected".', array('@summary' => $summary, '@expected' => $expected)));
+ $this->assertIdentical($summary, $expected, 'Generated summary "' . $summary . '" matches 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')), t('Article content type has been updated.'));
+ $this->assertRaw(t('The content type %type has been updated.', array('%type' => 'Article')), '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'), t('Body field cardinality set to multiple.'));
+ $this->assertFieldByXPath("//input[@name='body_add_more']", t('Add another item'), '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], t('The body field with delta @delta has been saved.', array('@delta' => $delta)));
+ $this->assertText($body[$delta], 'The body field with delta ' . $delta . ' has been saved.');
}
// 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], 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)));
+ $this->assertNoText($body[0], 'The body field with delta ' . 0 . ' is hidden.');
+ $this->assertText($body[1], 'The body field with delta ' . 1 . ' is shown.');
}
}
diff --git a/modules/field/tests/field.test b/modules/field/tests/field.test
index 7fbdba6..8038233 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), t('Expected number of values were saved.'));
+ $this->assertEqual(count($values), count($expected_values), 'Expected number of values were saved.');
foreach ($expected_values as $key => $value) {
- $this->assertEqual($values[$key][$column], $value, t('Value @value was saved correctly.', array('@value' => $value)));
+ $this->assertEqual($values[$key][$column], $value, 'Value ' . $value . ' was saved correctly.');
}
}
}
@@ -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'], t('Current revision: expected number of values'));
+ $this->assertEqual(count($entity->{$this->field_name}[$langcode]), $this->field['cardinality'], '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'], t('Current revision: expected value %delta was found.', array('%delta' => $delta)));
+ $this->assertEqual($entity->{$this->field_name}[$langcode][$delta]['value'], $values[$current_revision][$delta]['value'], 'Current revision: expected value ' . $delta . ' was found.');
// The value added in hook_field_load() is 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)));
+ $this->assertEqual($entity->{$this->field_name}[$langcode][$delta]['additional_key'], 'additional_value', 'Current revision: extra information for value ' . $delta . ' was found');
}
// 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'], t('Revision %revision_id: expected number of values.', array('%revision_id' => $revision_id)));
+ $this->assertEqual(count($entity->{$this->field_name}[$langcode]), $this->field['cardinality'], 'Revision ' . $revision_id . ': 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[$revision_id][$delta]['value'], t('Revision %revision_id: expected value %delta was found.', array('%revision_id' => $revision_id, '%delta' => $delta)));
+ $this->assertEqual($entity->{$this->field_name}[$langcode][$delta]['value'], $values[$revision_id][$delta]['value'], 'Revision ' . $revision_id . ': expected value ' . $delta . ' was found.');
// The value added in hook_field_load() is 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)));
+ $this->assertEqual($entity->{$this->field_name}[$langcode][$delta]['additional_key'], 'additional_value', 'Revision ' . $revision_id . ': extra information for value ' . $delta . ' was found');
}
}
}
@@ -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], t('Entity %index: expected value was found.', array('%index' => $index)));
+ $this->assertEqual($entity->{$field_name}[$langcode][0]['value'], $values[$index][$field_name], 'Entity ' . $index . ': expected value was found.');
// The value added in hook_field_load() is found.
- $this->assertEqual($entity->{$field_name}[$langcode][0]['additional_key'], 'additional_value', t('Entity %index: extra information was found', array('%index' => $index)));
+ $this->assertEqual($entity->{$field_name}[$langcode][0]['additional_key'], 'additional_value', 'Entity ' . $index . ': extra information was found');
}
}
// 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]], 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])));
+ $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.');
}
/**
@@ -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], t('%storage storage: expected values were found.', array('%storage' => $field['storage']['type'])));
+ $this->assertEqual($values[$field['field_name']], $entity->{$field['field_name']}[$langcode], $field['storage']['type'] . ' storage: expected values were found.');
}
}
@@ -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']), t('The storage type is Drupal variables.'));
+ $this->assertTrue(array_key_exists('drupal_variables', $field['storage']['details']), '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]), 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.'));
+ $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.');
// 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, 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]')));
+ $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]' . '.');
}
}
@@ -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}), t('Insert: missing field results in no value saved'));
+ $this->assertTrue(empty($entity->{$this->field_name}), '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}), t('Insert: NULL field results in no value saved'));
+ $this->assertTrue(empty($entity->{$this->field_name}), '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, t('Field data saved'));
+ $this->assertEqual($entity->{$this->field_name}[$langcode], $values, '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, t('Update: missing field leaves existing values in place'));
+ $this->assertEqual($entity->{$this->field_name}[$langcode], $values, '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}), t('Update: NULL field removes existing values'));
+ $this->assertTrue(empty($entity->{$this->field_name}), '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, t('Field data saved'));
+ $this->assertEqual($entity->{$this->field_name}[$langcode], $values, '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}), t('Update: empty array removes existing values'));
+ $this->assertTrue(empty($entity->{$this->field_name}), '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]), t('Insert: NULL field results in no value saved'));
+ $this->assertTrue(empty($entity->{$this->field_name}[$langcode]), '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, t('Insert: missing field results in default value saved'));
+ $this->assertEqual($entity->{$this->field_name}[$langcode], $values, '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(), t('The test entity current revision is deleted.'));
+ $this->assertIdentical($read->{$this->field_name}, array(), 'The test entity current revision is deleted.');
}
/**
@@ -759,7 +759,7 @@ class FieldAttachOtherTestCase extends FieldAttachTestCase {
break;
}
}
- $this->assertTrue($result, t('Variable $@field_name correctly populated.', array('@field_name' => $this->field_name)));
+ $this->assertTrue($result, 'Variable $' . $this->field_name . ' correctly populated.');
}
/**
@@ -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'), t('Non-cached: no initial cache entry'));
+ $this->assertFalse(cache_get($cid, 'cache_field'), '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'), t('Non-cached: no cache entry on insert'));
+ $this->assertFalse(cache_get($cid, 'cache_field'), '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'), t('Non-cached: no cache entry on load'));
+ $this->assertFalse(cache_get($cid, 'cache_field'), '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'), t('Cached: no initial cache entry'));
+ $this->assertFalse(cache_get($cid, 'cache_field'), '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'), t('Cached: no cache entry on insert'));
+ $this->assertFalse(cache_get($cid, 'cache_field'), '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'), t('Cached: no cache entry on loading a single field'));
+ $this->assertFalse(cache_get($cid, 'cache_field'), '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, t('Cached: correct cache entry on load'));
+ $this->assertEqual($cache->data[$this->field_name][$langcode], $values, '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'), t('Cached: no cache entry on update'));
+ $this->assertFalse(cache_get($cid, 'cache_field'), '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, t('Cached: correct cache entry on load'));
+ $this->assertEqual($cache->data[$this->field_name][$langcode], $values, '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'), t('Cached: no cache entry on new revision creation'));
+ $this->assertFalse(cache_get($cid, 'cache_field'), '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, t('Cached: correct cache entry on load'));
+ $this->assertEqual($cache->data[$this->field_name][$langcode], $values, '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'), t('Cached: no cache entry after delete'));
+ $this->assertFalse(cache_get($cid, 'cache_field'), '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', t('Cardinality validation failed.'));
+ $this->assertEqual($errors[$this->field_name][$langcode][0][0]['error'], 'field_cardinality', '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, t("Field type $t_key key $key is $val"));
+ $this->assertEqual($info[$t_key][$key], $val, "Field type $t_key key $key is $val");
}
- $this->assertEqual($info[$t_key]['module'], 'field_test', t("Field type field_test module appears"));
+ $this->assertEqual($info[$t_key]['module'], 'field_test', "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, t("Formatter type $f_key key $key is $val"));
+ $this->assertEqual($info[$f_key][$key], $val, "Formatter type $f_key key $key is $val");
}
- $this->assertEqual($info[$f_key]['module'], 'field_test', t("Formatter type field_test module appears"));
+ $this->assertEqual($info[$f_key]['module'], 'field_test', "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, t("Widget type $w_key key $key is $val"));
+ $this->assertEqual($info[$w_key][$key], $val, "Widget type $w_key key $key is $val");
}
- $this->assertEqual($info[$w_key]['module'], 'field_test', t("Widget type field_test module appears"));
+ $this->assertEqual($info[$w_key]['module'], 'field_test', "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, t("Storage type $s_key key $key is $val"));
+ $this->assertEqual($info[$s_key][$key], $val, "Storage type $s_key key $key is $val");
}
- $this->assertEqual($info[$s_key]['module'], 'field_test', t("Storage type field_test module appears"));
+ $this->assertEqual($info[$s_key]['module'], 'field_test', "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), t('With no instances, info bundles is empty.'));
+ $this->assertTrue(empty($instances), '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, 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'));
+ $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');
$settings = array('test_field_setting' => 'dummy test string');
foreach ($settings as $key => $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']]['settings'][$key], $val, "Field setting $key has correct default value $val");
}
- $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'));
+ $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');
// 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, 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'));
+ $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');
}
/**
@@ -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'], t('All expected default field settings are present.'));
+ $this->assertIdentical($field['settings'], $field_type['settings'], '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'] , t('All expected instance settings are present.'));
+ $this->assertIdentical($instance['settings'], $field_type['instance_settings'], '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'], t('Unavailable widget replaced with default widget.'));
+ $this->assertIdentical($instance['widget']['type'], $field_type['default_widget'], 'Unavailable widget replaced with default widget.');
$widget_type = field_info_widget_types($instance['widget']['type']);
- $this->assertIdentical($instance['widget']['settings'], $widget_type['settings'] , t('All expected widget settings are present.'));
+ $this->assertIdentical($instance['widget']['settings'], $widget_type['settings'], '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'], t("Formatter is set for the 'default' view mode"));
+ $this->assertIdentical($display['type'], $field_type['default_formatter'], "Formatter is set for the 'default' view mode");
$formatter_type = field_info_formatter_types($display['type']);
- $this->assertIdentical($display['settings'], $formatter_type['settings'] , t("Formatter settings are set for the 'default' view mode"));
+ $this->assertIdentical($display['settings'], $formatter_type['settings'], "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'), t('No instances are returned on disabled entity types.'));
+ $this->assertNull(field_info_instance('comment', 'field', 'comment_node_article'), '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]", '', t('Widget is displayed.'));
+ $this->assertFieldByName("{$this->field_name}[$langcode]", '', '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', t('Widget is displayed.'));
+ $this->assertFieldByName("{$this->field_name}[$langcode]", '1, 2, 3', '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', t('Form validation failed.'));
+ $this->assertRaw('this field cannot hold more than 4 values', '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]", '', t('Widget is not displayed if field access is denied.'));
+ $this->assertNoFieldByName("{$field_name_no_access}[$langcode][0][value]", '', '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, 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.'));
+ $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.');
// 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, 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.'));
+ $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.');
// 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, 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.'));
+ $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.');
}
}
@@ -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, 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)));
+ $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.');
}
// 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, t('Label was not displayed.'));
+ $this->assertNoText($this->label, '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), t('Values were displayed with expected setting.'));
+ $this->assertText($setting . '|' . implode('|', $array), '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, t('Label was not displayed.'));
+ $this->assertNoText($this->label, 'Label was not displayed.');
foreach ($this->values as $delta => $value) {
- $this->assertText($setting . '|' . $value['value'] . '|' . ($value['value'] + 1), t('Value @delta was displayed with expected setting.', array('@delta' => $delta)));
+ $this->assertText($setting . '|' . $value['value'] . '|' . ($value['value'] + 1), 'Value ' . $delta . ' was displayed with expected setting.');
}
// 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, 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)));
+ $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.');
}
// 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, 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)));
+ $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.');
}
}
@@ -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'], t('Value @delta was displayed with expected setting.', array('@delta' => $delta)));
+ $this->assertText($setting . '|' . $value['value'], 'Value ' . $delta . ' was displayed with expected setting.');
}
// 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'], t('Value @delta was displayed with expected setting.', array('@delta' => $delta)));
+ $this->assertText($setting . '|0:' . $value['value'], 'Value ' . $delta . ' was displayed with expected setting.');
}
// 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), t('Value @delta was displayed with expected setting.', array('@delta' => $delta)));
+ $this->assertText($setting . '|' . $value['value'] . '|' . ($value['value'] + 1), 'Value ' . $delta . ' was displayed with expected setting.');
}
// 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'], t('Value @delta was displayed with expected setting.', array('@delta' => $delta)));
+ $this->assertText($setting . '|' . $value['value'], 'Value ' . $delta . ' was displayed with expected setting.');
}
// 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'], t('Value @delta was displayed with expected setting.', array('@delta' => $delta)));
+ $this->assertText($setting . '|' . $value['value'], 'Value ' . $delta . ' was displayed with expected setting.');
}
}
}
@@ -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'], t('The field name is properly saved.'));
- $this->assertEqual($record['type'], $field_definition['type'], t('The field type is properly saved.'));
+ $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.');
// Ensure that cardinality defaults to 1.
- $this->assertEqual($record['cardinality'], 1, t('Cardinality defaults to 1.'));
+ $this->assertEqual($record['cardinality'], 1, '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'], t('Default field settings have been written.'));
+ $this->assertIdentical($record['data']['settings'], $field_type['settings'], 'Default field settings have been written.');
// Ensure that default storage was set.
- $this->assertEqual($record['storage_type'], variable_get('field_storage_default'), t('The field type is properly saved.'));
+ $this->assertEqual($record['storage_type'], variable_get('field_storage_default'), 'The field type is properly saved.');
// Guarantee that the name is unique.
try {
field_create_field($field_definition);
- $this->fail(t('Cannot create two fields with the same name.'));
+ $this->fail('Cannot create two fields with the same name.');
}
catch (FieldException $e) {
- $this->pass(t('Cannot create two fields with the same name.'));
+ $this->pass('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(t('Cannot create a field with no type.'));
+ $this->fail('Cannot create a field with no type.');
}
catch (FieldException $e) {
- $this->pass(t('Cannot create a field with no type.'));
+ $this->pass('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(t('Cannot create an unnamed field.'));
+ $this->fail('Cannot create an unnamed field.');
}
catch (FieldException $e) {
- $this->pass(t('Cannot create an unnamed field.'));
+ $this->pass('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(t('Cannot create a field with a name starting with a digit.'));
+ $this->fail('Cannot create a field with a name starting with a digit.');
}
catch (FieldException $e) {
- $this->pass(t('Cannot create a field with a name starting with a digit.'));
+ $this->pass('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(t('Cannot create a field with a name containing an illegal character.'));
+ $this->fail('Cannot create a field with a name containing an illegal character.');
}
catch (FieldException $e) {
- $this->pass(t('Cannot create a field with a name containing an illegal character.'));
+ $this->pass('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(t('Cannot create a field with a name longer than 32 characters.'));
+ $this->fail('Cannot create a field with a name longer than 32 characters.');
}
catch (FieldException $e) {
- $this->pass(t('Cannot create a field with a name longer than 32 characters.'));
+ $this->pass('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(t('Cannot create a field bearing the name of an entity key.'));
+ $this->fail('Cannot create a field bearing the name of an entity key.');
}
catch (FieldException $e) {
- $this->pass(t('Cannot create a field bearing the name of an entity key.'));
+ $this->pass('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, t('The field was properly read.'));
+ $this->assertTrue($field_definition < $field, '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, t('Field type indexes saved by default'));
+ $this->assertEqual($field['indexes'], $expected_indexes, '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, t('Field definition indexes override field type indexes'));
+ $this->assertEqual($field['indexes'], $expected_indexes, '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, t('Field definition indexes are merged with field type indexes'));
+ $this->assertEqual($field['indexes'], $expected_indexes, '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']), t('A new field is not marked for deletion.'));
+ $this->assertTrue(!empty($field) && empty($field['deleted']), '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']), t('A deleted field is marked for deletion.'));
+ $this->assertTrue(!empty($field['deleted']), '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']), t('An instance for a deleted field is marked for deletion.'));
+ $this->assertTrue(!empty($instance['deleted']), '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), t('A deleted field is not loaded by default.'));
+ $this->assertTrue(empty($field), '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), t('An instance for a deleted field is not loaded by default.'));
+ $this->assertTrue(empty($instance), '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']), t('A non-deleted field is not marked for deletion.'));
+ $this->assertTrue(!empty($another_field) && empty($another_field['deleted']), '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']), t('An instance of a non-deleted field is not marked for deletion.'));
+ $this->assertTrue(!empty($another_instance) && empty($another_instance['deleted']), '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']), t('A new field with a previously used name is created.'));
+ $this->assertTrue(!empty($field) && empty($field['deleted']), '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']), t('A new instance for a previously used field name is created.'));
+ $this->assertTrue(!empty($instance) && empty($instance['deleted']), '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(t('Cannot update a field that does not exist.'));
+ $this->fail('Cannot update a field that does not exist.');
}
catch (FieldException $e) {
- $this->pass(t('Cannot update a field that does not exist.'));
+ $this->pass('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(t('Cannot update a field to a different type.'));
+ $this->fail('Cannot update a field to a different type.');
}
catch (FieldException $e) {
- $this->pass(t('Cannot update a field to a different type.'));
+ $this->pass('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(t("A changeable setting can be updated."));
+ $this->pass("A changeable setting can be updated.");
}
catch (FieldException $e) {
- $this->fail(t("An unchangeable setting cannot be updated."));
+ $this->fail("An unchangeable setting cannot be updated.");
}
$field['settings']['unchangeable']++;
try {
field_update_field($field);
- $this->fail(t("An unchangeable setting can be updated."));
+ $this->fail("An unchangeable setting can be updated.");
}
catch (FieldException $e) {
- $this->pass(t("An unchangeable setting cannot be updated."));
+ $this->pass("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, t('The field was properly read.'));
+ $this->assertTrue($field_definition <= $field, '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, t('The field is properly read when explicitly fetching inactive fields.'));
+ $this->assertTrue(isset($fields[$field_name]) && $field_definition < $field, '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), t('%modules disabled. The field is marked inactive.', array('%modules' => implode(', ', $modules))));
+ $this->assertTrue(empty($field), implode(', ', $modules) . ' disabled. The field is marked inactive.');
$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, t('The field was was marked active.'));
+ $this->assertTrue($field_definition <= $field, '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, 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.'));
+ $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.');
// Check that default settings are set.
- $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.'));
+ $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.');
// Guarantee that the field/bundle combination is unique.
try {
field_create_instance($this->instance_definition);
- $this->fail(t('Cannot create two instances with the same field / bundle combination.'));
+ $this->fail('Cannot create two instances with the same field / bundle combination.');
}
catch (FieldException $e) {
- $this->pass(t('Cannot create two instances with the same field / bundle combination.'));
+ $this->pass('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(t('Cannot create an instance of a non-existing field.'));
+ $this->fail('Cannot create an instance of a non-existing field.');
}
catch (FieldException $e) {
- $this->pass(t('Cannot create an instance of a non-existing field.'));
+ $this->pass('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(t('Can create an instance on an entity type allowed by the field.'));
+ $this->pass('Can create an instance on an entity type allowed by the field.');
}
catch (FieldException $e) {
- $this->fail(t('Can create an instance on an entity type allowed by the field.'));
+ $this->fail('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(t('Cannot create an instance on an entity type forbidden by the field.'));
+ $this->fail('Cannot create an instance on an entity type forbidden by the field.');
}
catch (FieldException $e) {
- $this->pass(t('Cannot create an instance on an entity type forbidden by the field.'));
+ $this->pass('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, t('The field was properly read.'));
+ $this->assertTrue($this->instance_definition < $instance, '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'], 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'));
+ $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');
// 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'] , t('Widget type change is saved.'));
+ $this->assertEqual($instance['widget']['type'], $instance_new['widget']['type'], '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) , t('Widget type change updates default settings.'));
- $this->assertEqual($instance['display']['default']['type'], $instance_new['display']['default']['type'] , t('Formatter type change is saved.'));
+ $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.');
$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) , t('Changing formatter type updates default settings.'));
+ $this->assertIdentical($settings, array_intersect_key($instance_new['display']['default']['settings'], $settings), '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']), 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.'));
+ $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.');
$info = field_info_formatter_types($instance_new['display']['teaser']['type']);
$settings = $info['settings'];
- $this->assertIdentical($settings, $instance_new['display']['teaser']['settings'] , t('Default formatter settings for the new view_mode have been written.'));
+ $this->assertIdentical($settings, $instance_new['display']['teaser']['settings'], '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']), t('A new field instance is not marked for deletion.'));
+ $this->assertTrue(!empty($instance) && empty($instance['deleted']), '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']), t('A deleted field instance is marked for deletion.'));
+ $this->assertTrue(!empty($instance['deleted']), '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), t('A deleted field instance is not loaded by default.'));
+ $this->assertTrue(empty($instance), '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']), t('A non-deleted field instance is not marked for deletion.'));
+ $this->assertTrue(!empty($another_instance) && empty($another_instance['deleted']), '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), t('%language is an enabled language.', array('%language' => $langcode)));
+ $this->assertTrue(in_array($langcode, $enabled_languages), $langcode . ' is an enabled language.');
}
}
- $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')));
+ $this->assertTrue(in_array('xx', $available_languages), 'xx' . ' was made available.');
+ $this->assertFalse(in_array('en', $available_languages), 'en' . ' was made unavailable.');
// 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, t('For untranslatable fields only LANGUAGE_NONE is available.'));
+ $this->assertTrue(count($available_languages) == 1 && $available_languages[0] === LANGUAGE_NONE, '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, t('The result for %language is correctly stored.', array('%language' => $langcode)));
+ $this->assertEqual($hash, $result, 'The result for ' . $langcode . ' is correctly stored.');
}
- $this->assertEqual(count($results), count($available_languages), t('No unavailable language has been processed.'));
+ $this->assertEqual(count($results), count($available_languages), '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, t('The result for entity %id/%language is correctly stored.', array('%id' => $id, '%language' => $langcode)));
+ $this->assertEqual($hash, $result, 'The result for entity ' . $id . '/' . $langcode . ' is correctly stored.');
}
- $this->assertEqual(count($results), count($available_languages), t('No unavailable language has been processed for entity %id.', array('%id' => $id)));
+ $this->assertEqual(count($results), count($available_languages), 'No unavailable language has been processed for entity ' . $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']), t('Nodes are translatable.'));
+ $this->assertTrue(count($entity_info['translation']), '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, t('Field is translatable.'));
+ $this->assertTrue(count($available_languages) > 1, '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, t('%language translation correctly handled.', array('%language' => $langcode)));
+ $this->assertTrue($result, $langcode . ' translation correctly handled.');
}
}
@@ -2654,8 +2654,7 @@ 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']);
}
@@ -2667,7 +2666,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, t('The display language for field %field_name is %language.', array('%field_name' => $field_name, '%language' => LANGUAGE_NONE)));
+ $this->assertTrue($display_language[$field_name] == LANGUAGE_NONE, 'The display language for field ' . $field_name . ' is ' . LANGUAGE_NONE . '.');
}
// Test multiple-fields display languages for translatable entities.
@@ -2681,13 +2680,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, t('The display language for the field %field_name is %language.', array('%field_name' => $field_name, '%language' => $langcode)));
+ $this->assertTrue(isset($entity->{$field_name}[$langcode]) && $langcode != $requested_language, 'The display language for the field ' . $field_name . ' is ' . $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, t('The display language for the (single) field %field_name is %language.', array('%field_name' => $field_name, '%language' => $langcode)));
+ $this->assertTrue(isset($entity->{$this->field_name}[$langcode]) && $langcode != $requested_language, 'The display language for the (single) field ' . $field_name . ' is ' . $langcode . '.');
}
/**
@@ -2731,7 +2730,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, t('The @language translation for revision @revision was correctly stored', array('@language' => $langcode, '@revision' => $entity->ftvid)));
+ $this->assertTrue($passed, 'The ' . $langcode . ' translation for revision ' . $entity->ftvid . ' was correctly stored');
}
}
}
@@ -2745,7 +2744,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',
);
}
@@ -2926,7 +2925,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 5baaa34..2274b75 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>', t('%table_header table header was found.', array('%table_header' => $table_header)));
+ $this->assertRaw($table_header . '</th>', $table_header . ' table header was found.');
}
// "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, t('"@element" was found.', array('@element' => $element)));
+ $this->assertText($element, '"' . $element . '" was found.');
}
}
@@ -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 . '"]'), t('Existing field was found in account settings.'));
+ $this->assertTrue($this->xpath('//select[@name="_add_existing_field[field_name]"]//option[@value="' . $this->field_name . '"]'), '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)), t('Redirected to "Manage fields" page.'));
+ $this->assertText(t('Saved @label configuration.', array('@label' => $this->field_label)), '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'), t('"Add existing field" was found.'));
+ $this->assertRaw(t('Add existing field'), '"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"]'), t('The list of options respects entity type restrictions.'));
+ $this->assertFalse($this->xpath('//select[@id="edit--add-existing-field-field-name"]//option[@value="comment"]'), '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, t('Field settings were found.'));
+ $this->assertTrue($field['settings']['test_field_setting'] == $string, '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, t('Field instance settings were found.'));
- $this->assertTrue($instance['widget']['settings']['test_widget_setting'] == $string, t('Field widget settings were found.'));
+ $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.');
}
/**
@@ -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, '', t('The default value widget was empty.'));
+ $this->assertFieldById($element_id, '', '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", t('Form vaildation failed.'));
+ $this->assertText("$field_name does not accept the value -1", '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", t('The form was successfully submitted.'));
+ $this->assertText("Saved $field_name configuration", 'The form was successfully submitted.');
$instance = field_info_instance('node', $field_name, $this->type);
- $this->assertEqual($instance['default_value'], array(array('value' => 1)), t('The default value was correctly saved.'));
+ $this->assertEqual($instance['default_value'], array(array('value' => 1)), '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', t('The default value widget was displayed with the correct value.'));
+ $this->assertFieldById($element_id, '1', '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", t('The form was successfully submitted.'));
+ $this->assertText("Saved $field_name configuration", 'The form was successfully submitted.');
field_info_cache_clear();
$instance = field_info_instance('node', $field_name, $this->type);
- $this->assertEqual($instance['default_value'], NULL, t('The default value was correctly saved.'));
+ $this->assertEqual($instance['default_value'], NULL, '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), t('Field instance was deleted.'));
+ $this->assertNull(field_info_instance('node', $this->field_name, $this->type), 'Field instance was deleted.');
// Check that the field was not deleted
- $this->assertNotNull(field_info_field($this->field_name), t('Field was not deleted.'));
+ $this->assertNotNull(field_info_field($this->field_name), '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), t('Field instance was deleted.'));
+ $this->assertNull(field_info_instance('node', $this->field_name, $type_name2), 'Field instance was deleted.');
// Check that the field was deleted too.
- $this->assertNull(field_info_field($this->field_name), t('Field was deleted.'));
+ $this->assertNull(field_info_field($this->field_name), '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"]'), t("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"]'), "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), t('An instance of the field %field was created programmatically.', array('%field' => $field_name)));
+ $this->assertTrue(field_read_instance('node', $field_name, $this->type), 'An instance of the field ' . $field_name . ' was created programmatically.');
// 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'], t('Field was created and appears in the overview page.'));
+ $this->assertFieldByXPath('//table[@id="field-overview"]//td[1]', $instance['label'], '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)), t("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)), "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)), t('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)), '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)), t('Redirected to instance and widget settings page.'));
+ $this->assertRaw(t('Updated field %label field settings.', array('%label' => $label)), '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)), t('Redirected to "Manage fields" page.'));
+ $this->assertRaw(t('Saved %label configuration.', array('%label' => $label)), 'Redirected to "Manage fields" page.');
// Check that the field appears in the overview form.
- $this->assertFieldByXPath('//table[@id="field-overview"]//td[1]', $label, t('Field was created and appears in the overview page.'));
+ $this->assertFieldByXPath('//table[@id="field-overview"]//td[1]', $label, '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)), t('Redirected to "Manage fields" page.'));
+ $this->assertRaw(t('Saved %label configuration.', array('%label' => $label)), 'Redirected to "Manage fields" page.');
// Check that the field appears in the overview form.
- $this->assertFieldByXPath('//table[@id="field-overview"]//td[1]', $label, t('Field was created and appears in the overview page.'));
+ $this->assertFieldByXPath('//table[@id="field-overview"]//td[1]', $label, '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)), t('Delete confirmation was found.'));
+ $this->assertRaw(t('Are you sure you want to delete the field %label', array('%label' => $label)), '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)), t('Delete message was found.'));
+ $this->assertRaw(t('The field %label has been deleted from the %type content type.', array('%label' => $label, '%type' => $bundle_label)), '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, t('Field does not appear in the overview page.'));
+ $this->assertNoFieldByXPath('//table[@id="field-overview"]//span[@class="label-field"]', $label, 'Field does not appear in the overview page.');
}
}
diff --git a/modules/file/tests/file.test b/modules/file/tests/file.test
index 2bf5b7f..f025d05 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, t('New file saved to disk on node creation.'));
+ $this->assertFileExists($node_file, 'New file saved to disk on node creation.');
// Test file download.
$this->drupalGet(file_create_url($node_file->uri));
- $this->assertResponse(200, t('Confirmed that the generated URL is correct by downloading the shipped file.'));
+ $this->assertResponse(200, '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'), 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.'));
+ $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.');
// "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'), 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.'));
+ $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.');
// 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']), t('File was successfully removed from the node.'));
+ $this->assertTrue(empty($node->{$field_name}[LANGUAGE_NONE][0]['fid']), '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, t('New file saved to disk on node creation.'));
+ $this->assertFileExists($node_file, 'New file saved to disk on node creation.');
// Test file download.
$this->drupalGet(file_create_url($node_file->uri));
- $this->assertResponse(200, t('Confirmed that the generated URL is correct by downloading the shipped file.'));
+ $this->assertResponse(200, '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', t('Upload destination setting disabled.'));
+ $this->assertFieldByXpath('//input[@id="edit-field-settings-uri-scheme-public" and @disabled="disabled"]', 'public', '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', t('Upload destination setting enabled.'));
+ $this->assertFieldByXpath('//input[@id="edit-field-settings-uri-scheme-public" and not(@disabled)]', 'public', '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, 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.'));
+ $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.');
// 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, 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.'));
+ $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.');
// 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], 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.'));
+ $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.');
// 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, 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.'));
+ $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.');
// 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, 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.'));
+ $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.');
// 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, 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.'));
+ $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.');
// 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, 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.'));
+ $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.');
// 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, 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.'));
+ $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.');
// 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, 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.'));
+ $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.');
}
}
@@ -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, t('Default formatter displaying correctly on full node view.'));
+ $this->assertRaw($default_output, '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, t('Field is hidden when "display" option is unchecked.'));
+ $this->assertNoRaw($default_output, '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'])), t('Node save failed when required file field was empty.'));
+ $this->assertRaw(t('!title field is required.', array('!title' => $instance['label'])), '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, t('File exists after uploading to the required field.'));
- $this->assertFileEntryExists($node_file, t('File entry exists after uploading to the required field.'));
+ $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.');
// 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'])), t('Node save failed when required multiple value file field was empty.'));
+ $this->assertRaw(t('!title field is required.', array('!title' => $instance['label'])), '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, 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.'));
+ $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.');
// 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, 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)));
+ $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 . ').');
// 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, t('Node save failed when file (%filesize) exceeded the max upload size (%maxsize).', array('%filesize' => format_size($large_file->filesize), '%maxsize' => $max_filesize)));
+ $this->assertRaw($error_message, 'Node save failed when file (' . format_size($large_file->filesize) . ') exceeded the max upload size (' . $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, 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))));
+ $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.');
// 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, 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.'));
+ $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.');
// 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, t('Node save failed when file uploaded with the wrong extension.'));
+ $this->assertRaw($error_message, '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, 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.'));
+ $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.');
// 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, t('The file %file was uploaded to the correct path.', array('%file' => $node_file->uri)));
+ $this->assertPathMatch('public://' . $test_file->filename, $node_file->uri, 'The file ' . $node_file->uri . ' was uploaded to the correct path.');
// 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, t('The file %file was uploaded to the correct path.', array('%file' => $node_file->uri)));
+ $this->assertPathMatch('public://foo/bar/baz/' . $test_file->filename, $node_file->uri, 'The file ' . $node_file->uri . ' was uploaded to the correct path.');
// 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, t('The file %file was uploaded to the correct path with token replacements.', array('%file' => $node_file->uri)));
+ $this->assertPathMatch('public://' . $subdirectory . '/' . $test_file->filename, $node_file->uri, 'The file ' . $node_file->uri . ' was uploaded to the correct path with token replacements.');
}
/**
@@ -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)), t('No empty tokens generated.'));
+ $this->assertFalse(in_array(0, array_map('strlen', $tests)), 'No empty tokens generated.');
foreach ($tests as $input => $expected) {
$output = token_replace($input, array('file' => $file), array('language' => $language));
- $this->assertFalse(strcmp($output, $expected), t('Sanitized file token %token replaced.', array('%token' => $input)));
+ $this->assertFalse(strcmp($output, $expected), 'Sanitized file token ' . $input . ' replaced.');
}
// 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), t('Unsanitized file token %token replaced.', array('%token' => $input)));
+ $this->assertFalse(strcmp($output, $expected), 'Unsanitized file token ' . $input . ' replaced.');
}
}
}
diff --git a/modules/filter/filter.test b/modules/filter/filter.test
index 973a0b7..fdee75d 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, t('Database: Deleted text format no longer exists.'));
+ $this->assertFalse($db_format, '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, t('Database: Filters for deleted text format no longer exist.'));
+ $this->assertFalse($db_filters, 'Database: Filters for deleted text format no longer exist.');
$formats = filter_formats();
- $this->assertTrue(!isset($formats[$format->format]), t('filter_formats: Deleted text format no longer exists.'));
+ $this->assertTrue(!isset($formats[$format->format]), '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, 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));
+ $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'] . '.');
// Verify filter_format_load().
$filter_format = filter_format_load($format->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));
+ $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'] . '.');
// 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, t('Text format contains proper cache property.'));
+ $this->assertEqual($filter_format->cache, $cacheable, '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'], t('Database: Proper status for %filter in text format %format.', $t_args));
+ $this->assertEqual($filter->status, $format_filters[$name]['status'], 'Database: Proper status for ' . $t_args['%filter'] . ' in text format ' . $t_args['%format'] . '.');
// Verify that filter settings were properly stored.
- $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));
+ $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'] . '.');
// Verify that each filter has a module name assigned.
- $this->assertTrue(!empty($filter->module), t('Database: Proper module name for %filter in text format %format.', $t_args));
+ $this->assertTrue(!empty($filter->module), 'Database: Proper module name for ' . $t_args['%filter'] . ' in text format ' . $t_args['%format'] . '.');
// 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), t('Database contains values for all filters in the saved format.'));
+ $this->assertTrue(empty($format_filters), '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'], t('filter_list_format: Proper status for %filter in text format %format.', $t_args));
+ $this->assertEqual($filter->status, $format_filters[$name]['status'], 'filter_list_format: Proper status for ' . $t_args['%filter'] . ' in text format ' . $t_args['%format'] . '.');
// Verify that filter settings were properly stored.
- $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));
+ $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'] . '.');
// Verify that each filter has a module name assigned.
- $this->assertTrue(!empty($filter->module), t('filter_list_format: Proper module name for %filter in text format %format.', $t_args));
+ $this->assertTrue(!empty($filter->module), 'filter_list_format: Proper module name for ' . $t_args['%filter'] . ' in text format ' . $t_args['%format'] . '.');
// 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), t('filter_list_format: Loaded filters contain values for all filters in the saved format.'));
+ $this->assertTrue(empty($format_filters), '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, t('Deleted text format no longer exists.'));
+ $this->assertResponse(404, '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(), t('The fallback format is set to plain text.'));
+ $this->assertTrue(!empty($plain) && $plain == filter_fallback_format(), 'The fallback format is set to plain text.');
$this->drupalGet('admin/config/content/formats');
- $this->assertNoRaw('admin/config/content/formats/' . $plain . '/delete', t('Delete link for the fallback format not found.'));
+ $this->assertNoRaw('admin/config/content/formats/' . $plain . '/delete', 'Delete link for the fallback format not found.');
$this->drupalGet('admin/config/content/formats/' . $plain . '/delete');
- $this->assertResponse(403, t('The fallback format cannot be deleted.'));
+ $this->assertResponse(403, 'The fallback format cannot be deleted.');
// Verify access permissions to Full HTML format.
- $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.'));
+ $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.');
// 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]'], t('Allowed HTML tag added.'));
+ $this->assertFieldByName('filters[filter_html][settings][allowed_html]', $edit['filters[filter_html][settings][allowed_html]'], 'Allowed HTML tag added.');
$result = db_query('SELECT * FROM {cache_filter}')->fetchObject();
- $this->assertFalse($result, t('Cache cleared.'));
+ $this->assertFalse($result, '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), t('Order confirmed in admin interface.'));
+ $this->assertTrue(!empty($elements), '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, t('Order saved successfully.'));
- $this->assertFieldByName('filters[' . $first_filter . '][weight]', 2, t('Order saved successfully.'));
+ $this->assertFieldByName('filters[' . $second_filter . '][weight]', 1, 'Order saved successfully.');
+ $this->assertFieldByName('filters[' . $first_filter . '][weight]', 2, '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), t('Reorder confirmed in admin interface.'));
+ $this->assertTrue(!empty($elements), '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), t('Order confirmed in database.'));
+ $this->assertTrue(($filters[0]->name == $second_filter && $filters[1]->name == $first_filter), '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'])), t('New filter created.'));
+ $this->assertRaw(t('Added text format %format.', array('%format' => $edit['name'])), 'New filter created.');
$format = $this->getFormat($edit['name']);
- $this->assertNotNull($format, t('Format found in database.'));
+ $this->assertNotNull($format, 'Format found in database.');
- $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.'));
+ $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.');
// 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'])), t('Format successfully deleted.'));
+ $this->assertRaw(t('Deleted text format %format.', array('%format' => $edit['name'])), '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)), t('Full HTML format successfully updated.'));
+ $this->assertRaw(t('The text format %format has been updated.', array('%format' => $format->name)), '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>', t('Full HTML filter accessible.'));
+ $this->assertRaw('<option value="' . $full . '">Full HTML</option>', '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"])), t('Filtered node created.'));
+ $this->assertRaw(t('Basic page %title has been created.', array('%title' => $edit["title"])), 'Filtered node created.');
$node = $this->drupalGetNodeByTitle($edit["title"]);
- $this->assertTrue($node, t('Node found in database.'));
+ $this->assertTrue($node, 'Node found in database.');
$this->drupalGet('node/' . $node->nid);
- $this->assertRaw($body . $extra_text, t('Filter removed invalid tag.'));
+ $this->assertRaw($body . $extra_text, '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), t('The "Plain text" text format escapes all HTML tags.'));
+ $this->assertText(check_plain($text), '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]'], t('Changes reverted.'));
+ $this->assertFieldByName('filters[filter_html][settings][allowed_html]', $edit['filters[filter_html][settings][allowed_html]'], '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)), t('Full HTML format successfully reverted.'));
- $this->assertFieldByName('roles[2]', $edit['roles[2]'], t('Changes reverted.'));
+ $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.');
// 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]'], t('Changes reverted.'));
- $this->assertFieldByName('filters[' . $first_filter . '][weight]', $edit['filters[' . $first_filter . '][weight]'], t('Changes reverted.'));
+ $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.');
}
/**
@@ -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), 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.'));
+ $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.');
// 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))), 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.'));
+ $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.');
// 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), 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.'));
+ $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.');
// 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), 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.'));
+ $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.');
}
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))), 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.'));
+ $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.');
// 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))), 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.'));
+ $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.');
// Check that the fallback format is always allowed.
- $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.'));
+ $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.');
}
/**
@@ -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.'), t('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.'), '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], t('Old body found in preview.'));
+ $this->assertText($edit[$body_value_key], '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'], t('Old title not found.'));
- $this->assertText($new_edit['title'], t('New title found.'));
- $this->assertText($edit[$body_value_key], t('Old body found.'));
+ $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.');
// 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, t('Text format access denied message not found.'));
- $this->assertFieldByXPath("//select[@name='$body_format_key']", NULL, t('Text format selector found.'));
+ $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.');
}
/**
@@ -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, 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."));
+ $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.");
// 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), t('After the formats are reordered, both users have the same default format.'));
+ $this->assertEqual(filter_default_format($first_user), filter_default_format($second_user), '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()), t('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()), '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>", t('Line breaking basic case.'));
+ $this->assertEqual(str_replace("\n", '', $f), "<p>aaa<br />bbb</p><p>ccc</p>", '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>", t('Line breaking -- do not break scripts.'));
+ $this->assertEqual($f, "<script>aaa\nbbb\n\nccc</script>", 'Line breaking -- do not break scripts.');
$f = _filter_autop('<p><div> </div></p>');
- $this->assertEqual(substr_count($f, '<p>'), substr_count($f, '</p>'), t('Make sure line breaking produces matching paragraph tags.'));
+ $this->assertEqual(substr_count($f, '<p>'), substr_count($f, '</p>'), '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>'), t('Make sure line breaking produces matching paragraph tags.'));
+ $this->assertEqual(substr_count($f, '<p>'), substr_count($f, '</p>'), '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>'), t('Make sure line breaking produces matching paragraph tags.'));
+ $this->assertEqual(substr_count($f, '<p>'), substr_count($f, '</p>'), '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, '', t('Make sure line breaking can process long strings.'));
+ $this->assertNotEqual($f, '', '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', t('HTML tag stripping -- simple script without special characters.'));
+ $this->assertNoNormalized($f, 'script', 'HTML tag stripping -- simple script without special characters.');
$f = filter_xss('<script src="http://www.example.com" />');
- $this->assertNoNormalized($f, 'script', t('HTML tag stripping -- empty script with source.'));
+ $this->assertNoNormalized($f, 'script', 'HTML tag stripping -- empty script with source.');
$f = filter_xss('<ScRipt sRc=http://www.example.com/>');
- $this->assertNoNormalized($f, 'script', t('HTML tag stripping evasion -- varying case.'));
+ $this->assertNoNormalized($f, 'script', 'HTML tag stripping evasion -- varying case.');
$f = filter_xss("<script\nsrc\n=\nhttp://www.example.com/\n>");
- $this->assertNoNormalized($f, 'script', t('HTML tag stripping evasion -- multiline tag.'));
+ $this->assertNoNormalized($f, 'script', 'HTML tag stripping evasion -- multiline tag.');
$f = filter_xss('<script/a src=http://www.example.com/a.js></script>');
- $this->assertNoNormalized($f, 'script', t('HTML tag stripping evasion -- non whitespace character after tag name.'));
+ $this->assertNoNormalized($f, 'script', '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', t('HTML tag stripping evasion -- no space between tag and attribute.'));
+ $this->assertNoNormalized($f, 'script', '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', t('HTML tag stripping evasion -- breaking HTML with nulls.'));
+ $this->assertNoNormalized($f, 'ipt', 'HTML tag stripping evasion -- breaking HTML with nulls.');
$f = filter_xss("<scrscriptipt src=http://www.example.com/a.js>");
- $this->assertNoNormalized($f, 'script', t('HTML tag stripping evasion -- filter just removing "script".'));
+ $this->assertNoNormalized($f, 'script', 'HTML tag stripping evasion -- filter just removing "script".');
$f = filter_xss('<<script>alert(0);//<</script>');
- $this->assertNoNormalized($f, 'script', t('HTML tag stripping evasion -- double opening brackets.'));
+ $this->assertNoNormalized($f, 'script', 'HTML tag stripping evasion -- double opening brackets.');
$f = filter_xss('<script src=http://www.example.com/a.js?<b>');
- $this->assertNoNormalized($f, 'script', t('HTML tag stripping evasion -- no closing tag.'));
+ $this->assertNoNormalized($f, 'script', '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', t('HTML tag stripping evasion -- double closing tag.'));
+ $this->assertNoNormalized($f, 'script', 'HTML tag stripping evasion -- double closing tag.');
$f = filter_xss('<script src=//www.example.com/.a>');
- $this->assertNoNormalized($f, 'script', t('HTML tag stripping evasion -- no scheme or ending slash.'));
+ $this->assertNoNormalized($f, 'script', 'HTML tag stripping evasion -- no scheme or ending slash.');
$f = filter_xss('<script src=http://www.example.com/.a');
- $this->assertNoNormalized($f, 'script', t('HTML tag stripping evasion -- no closing bracket.'));
+ $this->assertNoNormalized($f, 'script', 'HTML tag stripping evasion -- no closing bracket.');
$f = filter_xss('<script src=http://www.example.com/ <');
- $this->assertNoNormalized($f, 'script', t('HTML tag stripping evasion -- opening instead of closing bracket.'));
+ $this->assertNoNormalized($f, 'script', 'HTML tag stripping evasion -- opening instead of closing bracket.');
$f = filter_xss('<nosuchtag attribute="newScriptInjectionVector">');
- $this->assertNoNormalized($f, 'nosuchtag', t('HTML tag stripping evasion -- unknown tag.'));
+ $this->assertNoNormalized($f, 'nosuchtag', 'HTML tag stripping evasion -- unknown tag.');
$f = filter_xss('<?xml:namespace ns="urn:schemas-microsoft-com:time">');
- $this->assertTrue(stripos($f, '<?xml') === FALSE, t('HTML tag stripping evasion -- starting with a question sign (processing instructions).'));
+ $this->assertTrue(stripos($f, '<?xml') === FALSE, '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', t('HTML tag stripping evasion -- colon in the tag name (namespaces\' tricks).'));
+ $this->assertNoNormalized($f, 't:set', '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', t('HTML tag stripping evasion -- a malformed image tag.'));
+ $this->assertNoNormalized($f, 'script', 'HTML tag stripping evasion -- a malformed image tag.');
$f = filter_xss('<blockquote><script>alert(0)</script></blockquote>', array('blockquote'));
- $this->assertNoNormalized($f, 'script', t('HTML tag stripping evasion -- script in a blockqoute.'));
+ $this->assertNoNormalized($f, 'script', 'HTML tag stripping evasion -- script in a blockqoute.');
$f = filter_xss("<!--[if true]><script>alert(0)</script><![endif]-->");
- $this->assertNoNormalized($f, 'script', t('HTML tag stripping evasion -- script within a comment.'));
+ $this->assertNoNormalized($f, 'script', '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', t('HTML filter attributes removal -- events, no evasion.'));
+ $this->assertNoNormalized($f, 'onmouseover', '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', t('HTML filter attributes removal -- style, no evasion.'));
+ $this->assertNoNormalized($f, 'style', 'HTML filter attributes removal -- style, no evasion.');
$f = filter_xss('<img onerror =alert(0)>', array('img'));
- $this->assertNoNormalized($f, 'onerror', t('HTML filter attributes removal evasion -- spaces before equals sign.'));
+ $this->assertNoNormalized($f, 'onerror', 'HTML filter attributes removal evasion -- spaces before equals sign.');
$f = filter_xss('<img onabort!#$%&()*~+-_.,:;?@[/|\]^`=alert(0)>', array('img'));
- $this->assertNoNormalized($f, 'onabort', t('HTML filter attributes removal evasion -- non alphanumeric characters before equals sign.'));
+ $this->assertNoNormalized($f, 'onabort', 'HTML filter attributes removal evasion -- non alphanumeric characters before equals sign.');
$f = filter_xss('<img oNmediAError=alert(0)>', array('img'));
- $this->assertNoNormalized($f, 'onmediaerror', t('HTML filter attributes removal evasion -- varying case.'));
+ $this->assertNoNormalized($f, 'onmediaerror', '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', t('HTML filter attributes removal evasion -- breaking with nulls.'));
+ $this->assertNoNormalized($f, 'focus', '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', t('HTML scheme clearing -- no evasion.'));
+ $this->assertNoNormalized($f, 'javascript', 'HTML scheme clearing -- no evasion.');
$f = filter_xss('<img src=javascript:alert(0)>', array('img'));
- $this->assertNoNormalized($f, 'javascript', t('HTML scheme clearing evasion -- no quotes.'));
+ $this->assertNoNormalized($f, 'javascript', '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', t('HTML scheme clearing evasion -- no alert ;)'));
+ $this->assertNoNormalized($f, 'javascript', 'HTML scheme clearing evasion -- no alert ;)');
$f = filter_xss('<img src=`javascript:alert(0)`>', array('img'));
- $this->assertNoNormalized($f, 'javascript', t('HTML scheme clearing evasion -- grave accents.'));
+ $this->assertNoNormalized($f, 'javascript', 'HTML scheme clearing evasion -- grave accents.');
$f = filter_xss('<img dynsrc="javascript:alert(0)">', array('img'));
- $this->assertNoNormalized($f, 'javascript', t('HTML scheme clearing -- rare attribute.'));
+ $this->assertNoNormalized($f, 'javascript', 'HTML scheme clearing -- rare attribute.');
$f = filter_xss('<table background="javascript:alert(0)">', array('table'));
- $this->assertNoNormalized($f, 'javascript', t('HTML scheme clearing -- another tag.'));
+ $this->assertNoNormalized($f, 'javascript', 'HTML scheme clearing -- another tag.');
$f = filter_xss('<base href="javascript:alert(0);//">', array('base'));
- $this->assertNoNormalized($f, 'javascript', t('HTML scheme clearing -- one more attribute and tag.'));
+ $this->assertNoNormalized($f, 'javascript', 'HTML scheme clearing -- one more attribute and tag.');
$f = filter_xss('<img src="jaVaSCriPt:alert(0)">', array('img'));
- $this->assertNoNormalized($f, 'javascript', t('HTML scheme clearing evasion -- varying case.'));
+ $this->assertNoNormalized($f, 'javascript', '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', t('HTML scheme clearing evasion -- UTF-8 decimal encoding.'));
+ $this->assertNoNormalized($f, 'javascript', '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', t('HTML scheme clearing evasion -- long UTF-8 encoding.'));
+ $this->assertNoNormalized($f, 'javascript', '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', t('HTML scheme clearing evasion -- UTF-8 hex encoding.'));
+ $this->assertNoNormalized($f, 'javascript', 'HTML scheme clearing evasion -- UTF-8 hex encoding.');
$f = filter_xss("<img src=\"jav\tascript:alert(0)\">", array('img'));
- $this->assertNoNormalized($f, 'script', t('HTML scheme clearing evasion -- an embedded tab.'));
+ $this->assertNoNormalized($f, 'script', 'HTML scheme clearing evasion -- an embedded tab.');
$f = filter_xss('<img src="jav&#x09;ascript:alert(0)">', array('img'));
- $this->assertNoNormalized($f, 'script', t('HTML scheme clearing evasion -- an encoded, embedded tab.'));
+ $this->assertNoNormalized($f, 'script', 'HTML scheme clearing evasion -- an encoded, embedded tab.');
$f = filter_xss('<img src="jav&#x000000A;ascript:alert(0)">', array('img'));
- $this->assertNoNormalized($f, 'script', t('HTML scheme clearing evasion -- an encoded, embedded newline.'));
+ $this->assertNoNormalized($f, 'script', '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', t('HTML scheme clearing evasion -- an encoded, embedded carriage return.'));
+ $this->assertNoNormalized($f, 'script', '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', t('HTML scheme clearing evasion -- broken into many lines.'));
+ $this->assertNoNormalized($f, 'cript', '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', t('HTML scheme clearing evasion -- embedded nulls.'));
+ $this->assertNoNormalized($f, 'cript', 'HTML scheme clearing evasion -- embedded nulls.');
$f = filter_xss('<img src=" &#14; javascript:alert(0)">', array('img'));
- $this->assertNoNormalized($f, 'javascript', t('HTML scheme clearing evasion -- spaces and metacharacters before scheme.'));
+ $this->assertNoNormalized($f, 'javascript', 'HTML scheme clearing evasion -- spaces and metacharacters before scheme.');
$f = filter_xss('<img src="vbscript:msgbox(0)">', array('img'));
- $this->assertNoNormalized($f, 'vbscript', t('HTML scheme clearing evasion -- another scheme.'));
+ $this->assertNoNormalized($f, 'vbscript', 'HTML scheme clearing evasion -- another scheme.');
$f = filter_xss('<img src="nosuchscheme:notice(0)">', array('img'));
- $this->assertNoNormalized($f, 'nosuchscheme', t('HTML scheme clearing evasion -- unknown scheme.'));
+ $this->assertNoNormalized($f, 'nosuchscheme', 'HTML scheme clearing evasion -- unknown scheme.');
// Netscape 4.x javascript entities.
$f = filter_xss('<br size="&{alert(0)}">', array('br'));
- $this->assertNoNormalized($f, 'alert', t('Netscape 4.x javascript entities.'));
+ $this->assertNoNormalized($f, 'alert', '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', t('HTML filter -- invalid UTF-8.'));
+ $this->assertNoNormalized($f, 'style', 'HTML filter -- invalid UTF-8.');
$f = filter_xss("\xc0aaa");
- $this->assertEqual($f, '', t('HTML filter -- overlong UTF-8 sequences.'));
+ $this->assertEqual($f, '', 'HTML filter -- overlong UTF-8 sequences.');
$f = filter_xss("Who&#039;s Online");
- $this->assertNormalized($f, "who's online", t('HTML filter -- html entity number'));
+ $this->assertNormalized($f, "who's online", 'HTML filter -- html entity number');
$f = filter_xss("Who&amp;#039;s Online");
- $this->assertNormalized($f, "who&#039;s online", t('HTML filter -- encoded html entity number'));
+ $this->assertNormalized($f, "who&#039;s online", 'HTML filter -- encoded html entity number');
$f = filter_xss("Who&amp;amp;#039; Online");
- $this->assertNormalized($f, "who&amp;#039; online", t('HTML filter -- double encoded html entity number'));
+ $this->assertNormalized($f, "who&amp;#039; online", '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', t('HTML filter should always remove script tags.'));
+ $this->assertNoNormalized($f, 'script', 'HTML filter should always remove script tags.');
$f = _filter_html('<iframe />', $filter);
- $this->assertNoNormalized($f, 'iframe', t('HTML filter should always remove iframe tags.'));
+ $this->assertNoNormalized($f, 'iframe', 'HTML filter should always remove iframe tags.');
$f = _filter_html('<object />', $filter);
- $this->assertNoNormalized($f, 'object', t('HTML filter should always remove object tags.'));
+ $this->assertNoNormalized($f, 'object', 'HTML filter should always remove object tags.');
$f = _filter_html('<style />', $filter);
- $this->assertNoNormalized($f, 'style', t('HTML filter should always remove style tags.'));
+ $this->assertNoNormalized($f, 'style', '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', t('HTML filter should remove img tags on default.'));
+ $this->assertNoNormalized($f, 'img', 'HTML filter should remove img tags on default.');
$f = _filter_html('<input />', $filter);
- $this->assertNoNormalized($f, 'img', t('HTML filter should remove input tags on default.'));
+ $this->assertNoNormalized($f, 'img', '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', t('HTML filter should remove style attribute on default.'));
+ $this->assertNoNormalized($f, 'style', 'HTML filter should remove style attribute on default.');
$f = _filter_html('<p onerror="alert(0);" />', $filter);
- $this->assertNoNormalized($f, 'onerror', t('HTML filter should remove on* attributes on default.'));
+ $this->assertNoNormalized($f, 'onerror', 'HTML filter should remove 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.'));
+ $f = _filter_html('<code onerror>&nbsp;</code>', $filter);
+ $this->assertNoNormalized($f, 'onerror', '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"', t('Spam deterrent -- no evasion.'));
+ $this->assertNormalized($f, 'rel="nofollow"', 'Spam deterrent -- no evasion.');
$f = _filter_html('<A href="http://www.example.com/">text</a>', $filter);
- $this->assertNormalized($f, 'rel="nofollow"', t('Spam deterrent evasion -- capital A.'));
+ $this->assertNormalized($f, 'rel="nofollow"', 'Spam deterrent evasion -- capital A.');
$f = _filter_html("<a/href=\"http://www.example.com/\">text</a>", $filter);
- $this->assertNormalized($f, 'rel="nofollow"', t('Spam deterrent evasion -- non whitespace character after tag name.'));
+ $this->assertNormalized($f, 'rel="nofollow"', '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"', t('Spam deterrent evasion -- some nulls.'));
+ $this->assertNormalized($f, 'rel="nofollow"', '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"', t('Spam deterrent evasion -- link within a comment.'));
+ $this->assertNormalized($f, 'rel="nofollow"', '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"', 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.'));
+ $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.');
}
/**
@@ -957,13 +957,13 @@ class FilterUnitTestCase extends DrupalUnitTestCase {
function testAdminHtmlFilter() {
// DRUPAL-SA-2008-044
$f = filter_xss_admin('<object />');
- $this->assertNoNormalized($f, 'object', t('Admin HTML filter -- should not allow object tag.'));
+ $this->assertNoNormalized($f, 'object', 'Admin HTML filter -- should not allow object tag.');
$f = filter_xss_admin('<script />');
- $this->assertNoNormalized($f, 'script', t('Admin HTML filter -- should not allow script tag.'));
+ $this->assertNoNormalized($f, 'script', '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, '', t('Admin HTML filter -- should never allow some tags.'));
+ $this->assertEqual($f, '', '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>', t('Converting URLs.'));
+ $this->assertEqual($f, '<a href="http://www.example.com/">http://www.example.com/</a>', '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>', t('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>', '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>', t('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>', '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>', t('Converting domain names.'));
+ $this->assertEqual($f, '<a href="http://www.example.com">www.example.com</a>', '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>', t('Converting domain names -- domain in a list.'));
+ $this->assertEqual($f, '<li><a href="http://www.example.com">www.example.com</a></li>', '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>)', t('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>)', '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>', t('Converting e-mail addresses.'));
+ $this->assertEqual($f, '<a href="mailto:johndoe@example.com">johndoe@example.com</a>', 'Converting e-mail addresses.');
$f = _filter_url('aaa@sub.tv', $filter);
- $this->assertEqual($f, '<a href="mailto:aaa@sub.tv">aaa@sub.tv</a>', t('Converting e-mail addresses -- a short e-mail from Tuvalu.'));
+ $this->assertEqual($f, '<a href="mailto:aaa@sub.tv">aaa@sub.tv</a>', '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....', t('URL trimming.'));
+ $this->assertNormalized($f, 'http://www.example.com/d/ff....', '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>', t('Converting URLs -- do not break existing links.'));
+ $this->assertEqual($f, '<a href="http://www.example.com">www.example.com</a>', '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>', t('Converting URLs -- do not break existing, relative links.'));
+ $this->assertEqual($f, '<a href="foo">http://www.example.com</a>', '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>', t('Converting URLs -- skip code contents.'));
+ $this->assertEqual($f, '<code>http://www.example.com</code>', '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>', t('Converting URLs -- really skip code contents.'));
+ $this->assertEqual($f, '<code><em>http://www.example.com</em></code>', '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>', t('Converting URLs -- do not process scripts.'));
+ $this->assertEqual($f, '<script>http://www.example.com</script>', '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" />', t('Converting URLs -- do not convert addresses in attributes.'));
+ $this->assertEqual($f, '<p xmlns="http://www.example.com" />', '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>', t('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>', '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>.', t('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>.', '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>.', t('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>.', '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>.', t('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>.', '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>', t('HTML corrector -- tag closing at the end of input.'));
+ $this->assertEqual($f, '<p>text</p>', '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>', t('HTML corrector -- tag closing.'));
+ $this->assertEqual($f, '<p>text</p><p></p><p>text</p>', 'HTML corrector -- tag closing.');
$f = _filter_htmlcorrector("<ul><li>e1<li>e2");
- $this->assertEqual($f, "<ul><li>e1</li><li>e2</li></ul>", t('HTML corrector -- unclosed list tags.'));
+ $this->assertEqual($f, "<ul><li>e1</li><li>e2</li></ul>", 'HTML corrector -- unclosed list tags.');
$f = _filter_htmlcorrector('<div id="d">content');
- $this->assertEqual($f, '<div id="d">content</div>', t('HTML corrector -- unclosed tag with attribute.'));
+ $this->assertEqual($f, '<div id="d">content</div>', 'HTML corrector -- unclosed tag with attribute.');
// XHTML slash for empty elements.
$f = _filter_htmlcorrector('<hr><br>');
- $this->assertEqual($f, '<hr /><br />', t('HTML corrector -- XHTML closing slash.'));
+ $this->assertEqual($f, '<hr /><br />', 'HTML corrector -- XHTML closing slash.');
$f = _filter_htmlcorrector('<P>test</P>');
- $this->assertEqual($f, '<p>test</p>', t('HTML corrector -- Convert uppercased tags to proper lowercased ones.'));
+ $this->assertEqual($f, '<p>test</p>', 'HTML corrector -- Convert uppercased tags to proper lowercased ones.');
$f = _filter_htmlcorrector('<P>test</p>');
- $this->assertEqual($f, '<p>test</p>', t('HTML corrector -- Convert uppercased tags to proper lowercased ones.'));
+ $this->assertEqual($f, '<p>test</p>', 'HTML corrector -- Convert uppercased tags to proper lowercased ones.');
$f = _filter_htmlcorrector('test<hr />');
- $this->assertEqual($f, 'test<hr />', t('HTML corrector -- Let proper XHTML pass through.'));
+ $this->assertEqual($f, 'test<hr />', 'HTML corrector -- Let proper XHTML pass through.');
$f = _filter_htmlcorrector('test<hr/>');
- $this->assertEqual($f, 'test<hr />', t('HTML corrector -- Let proper XHTML pass through, but ensure there is a single space before the closing slash.'));
+ $this->assertEqual($f, 'test<hr />', '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 />', t('HTML corrector -- Let proper XHTML pass through, but ensure there are not too many spaces before the closing slash.'));
+ $this->assertEqual($f, 'test<hr />', '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>', t('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>', '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', t('HTML corrector -- Automatically close single tags.'));
+ $this->assertEqual($f, 'test1<br class="test" />test2', 'HTML corrector -- Automatically close single tags.');
$f = _filter_htmlcorrector('line1<hr>line2');
- $this->assertEqual($f, 'line1<hr />line2', t('HTML corrector -- Automatically close single tags.'));
+ $this->assertEqual($f, 'line1<hr />line2', 'HTML corrector -- Automatically close single tags.');
$f = _filter_htmlcorrector('line1<HR>line2');
- $this->assertEqual($f, 'line1<hr />line2', t('HTML corrector -- Automatically close single tags.'));
+ $this->assertEqual($f, 'line1<hr />line2', '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', t('HTML corrector -- Automatically close single tags.'));
+ $this->assertEqual($f, '<img src="http://example.com/test.jpg" />test', 'HTML corrector -- Automatically close single tags.');
$f = _filter_htmlcorrector('<br></br>');
- $this->assertEqual($f, '<br />', t("HTML corrector -- Transform empty tags to a single closed tag if the tag's content model is EMPTY."));
+ $this->assertEqual($f, '<br />', "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>', t("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>', "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', t('HTML corrector -- Move non-inline elements outside of inline containers.'));
+ $this->assertEqual($f, '<p>line1<br /></p><hr />line2', '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>', t('HTML corrector -- Move non-inline elements outside of inline containers.'));
+ $this->assertEqual($f, '<p>line1</p><div>line2</div>', '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', t('HTML corrector -- Auto-close improperly nested tags.'));
+ $this->assertEqual($f, '<p>test</p><p>test</p>\n', '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>', t('HTML corrector -- Properly close unclosed tags, and remove useless closing tags.'));
+ $this->assertEqual($f, '<p>Line1<br /><strong>bold stuff</strong></p>', '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 -->', t('HTML corrector -- Do not touch HTML comments.'));
+ $this->assertEqual($f, 'test <!-- this is a comment -->', 'HTML corrector -- Do not touch HTML comments.');
$f = _filter_htmlcorrector('test <!--this is a comment-->');
- $this->assertEqual($f, 'test <!--this is a comment-->', t('HTML corrector -- Do not touch HTML comments.'));
+ $this->assertEqual($f, 'test <!--this is a comment-->', '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> -->', t('HTML corrector -- Do not touch HTML comments.'));
+ comment</p> -->', '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> -->', t('HTML corrector -- Do not touch HTML comments.'));
+ $this->assertEqual($f, 'test <!-- comment <p>another comment</p> -->', 'HTML corrector -- Do not touch HTML comments.');
$f = _filter_htmlcorrector('test <!--break-->');
- $this->assertEqual($f, 'test <!--break-->', t('HTML corrector -- Do not touch HTML comments.'));
+ $this->assertEqual($f, 'test <!--break-->', 'HTML corrector -- Do not touch HTML comments.');
$f = _filter_htmlcorrector('<p>test\n</p>\n');
- $this->assertEqual($f, '<p>test\n</p>\n', t('HTML corrector -- New-lines are accepted and kept as-is.'));
+ $this->assertEqual($f, '<p>test\n</p>\n', 'HTML corrector -- New-lines are accepted and kept as-is.');
$f = _filter_htmlcorrector('<p>دروبال');
- $this->assertEqual($f, '<p>دروبال</p>', t('HTML corrector -- Encoding is correctly kept.'));
+ $this->assertEqual($f, '<p>دروبال</p>', '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>', t('HTML corrector -- CDATA added to script element'));
+</script>', '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>', t('HTML corrector -- CDATA added to a nested script element'));
+</script></p>', '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>', t('HTML corrector -- CDATA added to a style element.'));
+</style></p>', '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;', t('The @function() function correctly filters basic HTML entities.', $replacements));
+ $this->assertEqual($f, '&lt;&gt;&amp;&quot;', 'The ' . $replacements['@function'] . '() function correctly filters basic HTML entities.');
// A single quote can also be used for evil things in some contexts.
$f = $function('\'');
- $this->assertEqual($f, '&#039;', t('The @function() function correctly filters single quotes.', $replacements));
+ $this->assertEqual($f, '&#039;', 'The ' . $replacements['@function'] . '() function correctly filters single quotes.');
// 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, '', t('The @function() function correctly filters invalid UTF-8.', $replacements));
+ $this->assertEqual($f, '', 'The ' . $replacements['@function'] . '() function correctly filters invalid UTF-8.');
}
}
@@ -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)), t('New format created.'));
- $this->assertText('hook_filter_format_insert invoked.', t('hook_filter_format_insert was invoked.'));
+ $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.');
$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)), t('Format successfully updated.'));
- $this->assertText('hook_filter_format_update invoked.', t('hook_filter_format_update() was invoked.'));
+ $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.');
// 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.'), t('New block successfully created.'));
+ $this->assertText(t('The block has been created.'), '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, t('New block found in database'));
+ $this->assertNotNull($bid, '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)), t('Format successfully deleted.'));
- $this->assertText('hook_filter_format_delete invoked.', t('hook_filter_format_delete() was invoked.'));
+ $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.');
// 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(), t('Deleted text format replaced with the fallback format.'));
+ $this->assertEqual($current_format, filter_fallback_format(), 'Deleted text format replaced with the fallback format.');
}
}
diff --git a/modules/forum/forum.test b/modules/forum/forum.test
index a7b9a08..f114c43 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, t('A forum node was not created when missing a forum vocabulary.'));
+ $this->assertEqual(0, $nid_count, '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.'), t('Active forum topics forum block was enabled'));
+ $this->assertText(t('The block settings have been updated.'), '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.'), t('[New forum topics] Forum block was enabled'));
+ $this->assertText(t('The block settings have been updated.'), '[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', t('Followed the link to edit the container'));
+ $this->assertRaw('Edit container', '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', t('Followed the link to edit the forum'));
+ $this->assertRaw('Edit forum', '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)), t('Vocabulary was edited'));
+ $this->assertRaw(t('Updated vocabulary %name.', array('%name' => $title)), '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, t('The name was updated'));
- $this->assertEqual($current_settings->description, $description, t('The description was updated'));
+ $this->assertEqual($current_settings->name, $title, 'The name was updated');
+ $this->assertEqual($current_settings->description, $description, '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))), t(ucfirst($type) . ' was created'));
+ $this->assertRaw(t('Created new @type %term.', array('%term' => $name, '@type' => t($type))), 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)), 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'));
+ $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');
return;
}
else {
- $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'));
+ $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');
}
// Retrieve node object, ensure that the topic was created and in the proper forum.
$node = $this->drupalGetNodeByTitle($title);
- $this->assertTrue($node != NULL, t('Node @title was loaded', array('@title' => $title)));
+ $this->assertTrue($node != NULL, 'Node ' . $title . ' was loaded');
$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, t('Subject was found'));
- $this->assertRaw($body, t('Body was found'));
+ $this->assertRaw($title, 'Subject was found');
+ $this->assertRaw($body, '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'), t('Forum help title was displayed'));
- $this->assertText(t('Forum'), t('Forum help node was displayed'));
+ $this->assertTitle(t('Forum | Drupal'), 'Forum help title was displayed');
+ $this->assertText(t('Forum'), 'Forum help node was displayed');
}
// Verify the forum blocks were displayed.
$this->drupalGet('');
$this->assertResponse(200);
- $this->assertText(t('New forum topics'), t('[New forum topics] Forum block was displayed'));
+ $this->assertText(t('New forum topics'), '[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', t('Forum node was displayed'));
+ $this->assertTitle($node->title . ' | Drupal', '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)), t('Breadcrumbs were displayed'));
+ $this->assertRaw(theme('breadcrumb', array('breadcrumb' => $breadcrumb)), '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', t('Forum edit node was displayed'));
+ $this->assertTitle('Edit Forum topic ' . $node->title . ' | Drupal', '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"])), t('Forum node was edited'));
+ $this->assertRaw(t('Forum topic %title has been updated.', array('%title' => $edit["title"])), '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'])), t('Forum node was deleted'));
+ $this->assertRaw(t('Forum topic %title has been deleted.', array('%title' => $edit['title'])), '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', t('Forum name was displayed'));
+ $this->assertTitle($forum['name'] . ' | Drupal', '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)), t('Breadcrumbs were displayed'));
+ $this->assertRaw(theme('breadcrumb', array('breadcrumb' => $breadcrumb)), 'Breadcrumbs were displayed');
}
/**
diff --git a/modules/help/help.test b/modules/help/help.test
index db739f3..070f815 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', t('The help.css file is present in the HTML.'));
+ $this->assertRaw(drupal_get_path('module', 'help') . '/help.css', '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>', t('Help topics text correctly appears.'));
+ $this->assertRaw('<h2>' . t('Help topics') . '</h2><p>' . t('Help is available on the following items:') . '</p>', '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, t('Link properly added to @name (admin/help/@module)', array('@module' => $module, '@name' => $name)));
+ $this->assertLink($name, 0, 'Link properly added to ' . $name . ' (admin/help/' . $module . ')');
}
}
@@ -66,9 +66,9 @@ class HelpTestCase extends DrupalWebTestCase {
$this->drupalGet('admin/help/' . $module);
$this->assertResponse($response);
if ($response == 200) {
- $this->assertTitle($name . ' | Drupal', t('[' . $module . '] Title was displayed'));
- $this->assertRaw('<h1 class="page-title">' . t($name) . '</h1>', t('[' . $module . '] Heading was displayed'));
- }
+ $this->assertTitle($name . ' | Drupal', '[' . $module . '] Title was displayed');
+ $this->assertRaw('<h1 class="page-title">' . t($name) . '</h1>', '[' . $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', t('Making sure the test module menu_test does not display a help link in admin/help'));
+ $this->assertNoText('Hook menu tests', '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 9f0604d..a31dfc2 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, t('Got the path for a file URI.'));
+ $this->assertEqual($actual, $expected, '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, t('Got the path for a relative file path.'));
+ $this->assertEqual($actual, $expected, '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, t('Created the directory for the generated images for the test style.'));
+ $this->assertNotIdentical(FALSE, $status, '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, t('Created the generated image file.'));
+ $this->assertNotIdentical(FALSE, $original_uri, '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), t('Generated file does not exist.'));
+ $this->assertFalse(file_exists($generated_uri), '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, t('Access to generate URL was denied.'));
+ $this->assertResponse(403, '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, t('Got the generate URL for a non-existent file.'));
+ $this->assertEqual($actual_generate_url, $expected_generate_url, '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), t('Lock was acquired.'));
+ $this->assertTrue(lock_acquire($lock_name), 'Lock was acquired.');
$this->drupalGet($expected_generate_url);
- $this->assertResponse(503, t('Service Unavailable response received.'));
- $this->assertTrue($this->drupalGetHeader('Retry-After'), t('Retry-After header received.'));
+ $this->assertResponse(503, 'Service Unavailable response received.');
+ $this->assertTrue($this->drupalGetHeader('Retry-After'), '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), t('Generated file was created.'));
- $this->assertRaw(file_get_contents($generated_uri), t('URL returns expected file.'));
+ $this->assertTrue(file_exists($generated_uri), 'Generated file was created.');
+ $this->assertRaw(file_get_contents($generated_uri), 'URL returns expected file.');
$generated_image_info = image_get_info($generated_uri);
- $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.'));
+ $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.');
// 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, 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.'));
+ $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.');
}
}
@@ -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)), t('Function returned the expected value.'));
+ $this->assertTrue(image_resize_effect($this->image, array('width' => 1, 'height' => 2)), '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, t('Width was passed correctly'));
- $this->assertEqual($calls['resize'][0][2], 2, t('Height was passed correctly'));
+ $this->assertEqual($calls['resize'][0][1], 1, 'Width was passed correctly');
+ $this->assertEqual($calls['resize'][0][2], 2, '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)), t('Function returned the expected value.'));
+ $this->assertTrue(image_scale_effect($this->image, array('width' => 10, 'height' => 10)), '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, t('Width was passed correctly'));
- $this->assertEqual($calls['resize'][0][2], 5, t('Height was based off aspect ratio and passed correctly'));
+ $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');
}
/**
@@ -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)), t('Function returned the expected value.'));
+ $this->assertTrue(image_crop_effect($this->image, array('anchor' => 'top-1', 'width' => 3, 'height' => 4)), '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, 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'));
+ $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');
}
/**
* Test the image_scale_and_crop_effect() function.
*/
function testScaleAndCropEffect() {
- $this->assertTrue(image_scale_and_crop_effect($this->image, array('width' => 5, 'height' => 10)), t('Function returned the expected value.'));
+ $this->assertTrue(image_scale_and_crop_effect($this->image, array('width' => 5, 'height' => 10)), '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, 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'));
+ $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');
}
/**
* Test the image_desaturate_effect() function.
*/
function testDesaturateEffect() {
- $this->assertTrue(image_desaturate_effect($this->image, array()), t('Function returned the expected value.'));
+ $this->assertTrue(image_desaturate_effect($this->image, array()), '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, t('Only the image was passed.'));
+ $this->assertEqual(count($calls['desaturate'][0]), 1, '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')), t('Function returned the expected value.'));
+ $this->assertTrue(image_rotate_effect($this->image, array('degrees' => 90, 'bgcolor' => '#fff')), '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, t('Degrees were passed correctly'));
- $this->assertEqual($calls['rotate'][0][2], 0xffffff, t('Background color was passed correctly'));
+ $this->assertEqual($calls['rotate'][0][1], 90, 'Degrees were passed correctly');
+ $this->assertEqual($calls['rotate'][0][2], 0xffffff, '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)), t('Image style successfully created.'));
+ $this->assertRaw(t('Style %name was created.', array('%name' => $style_name)), '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, t('The %field field in the %effect effect has the correct value of %value.', array('%field' => $field, '%effect' => $effect['name'], '%value' => $value)));
+ $this->assertFieldByName($field, $value, 'The ' . $field . ' field in the ' . $effect['name'] . ' effect has the correct value of ' . $value . '.');
}
}
@@ -438,7 +438,7 @@ class ImageAdminStylesUnitTest extends ImageFieldTestCase {
$order_correct = FALSE;
}
}
- $this->assertTrue($order_correct, t('The order of the effects is correctly set by default.'));
+ $this->assertTrue($order_correct, '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, t('Image style %style image %file successfully generated.', array('%style' => $style['name'], '%file' => $image_path)));
+ $this->assertEqual($this->getImageCount($style), 1, 'Image style ' . $style['name'] . ' image ' . $image_path . ' successfully generated.');
$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, t('Image style %original renamed to %new', array('%original' => $style['name'], '%new' => $style_name)));
+ $this->assertResponse(200, 'Image style ' . $style['name'] . ' renamed to ' . $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, t('Image style %style was flushed after renaming the style and updating the order of effects.', array('%style' => $style['name'])));
+ $this->assertEqual($this->getImageCount($style), 0, 'Image style ' . $style['name'] . ' was flushed after renaming the style and updating the order of effects.');
// 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, t('The order of the effects is correctly set by default.'));
+ $this->assertTrue($order_correct, '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, t('Image style %style image %file successfully generated.', array('%style' => $style['name'], '%file' => $image_path)));
+ $this->assertEqual($this->getImageCount($style), 1, 'Image style ' . $style['name'] . ' image ' . $image_path . ' successfully generated.');
// 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'])), t('Image effect deleted.'));
+ $this->assertRaw(t('The image effect %name has been deleted.', array('%name' => $effect['label'])), '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), t('Image style %style directory removed on style deletion.', array('%style' => $style['name'])));
+ $this->assertFalse(is_dir($directory), 'Image style ' . $style['name'] . ' directory removed on style deletion.');
drupal_static_reset('image_styles');
- $this->assertFalse(image_style_load($style_name), t('Image style %style successfully deleted.', array('%style' => $style['name'])));
+ $this->assertFalse(image_style_load($style_name), 'Image style ' . $style['name'] . ' successfully deleted.');
}
@@ -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'), t('Default styles may not be deleted.'));
+ $this->assertText(t('Page not found'), 'Default styles may not be deleted.');
// Ensure that editing a default is not possible (without overriding).
$this->drupalGet($edit_path);
- $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.'));
+ $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.');
// 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, t('Image style %style image %file successfully generated.', array('%style' => $style['name'], '%file' => $image_path)));
+ $this->assertEqual($this->getImageCount($style), 1, 'Image style ' . $style['name'] . ' image ' . $image_path . ' successfully generated.');
// Verify that effects attached to a default style do not have an ieid key.
foreach ($style['effects'] as $effect) {
- $this->assertFalse(isset($effect['ieid']), t('The %effect effect does not have an ieid.', array('%effect' => $effect['name'])));
+ $this->assertFalse(isset($effect['ieid']), 'The ' . $effect['name'] . ' effect does not have an ieid.');
}
// 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)), t('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)), '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']), t('The %effect effect has an ieid.', array('%effect' => $effect['name'])));
+ $this->assertTrue(isset($effect['ieid']), 'The ' . $effect['name'] . ' effect has an ieid.');
}
// 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', 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.'));
+ $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.');
// Check that we are unable to rename an overridden style.
$this->drupalGet($edit_path);
- $this->assertNoField('edit-name', t('Overridden styles may not be renamed.'));
+ $this->assertNoField('edit-name', '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, t('Image style %style image %file successfully generated.', array('%style' => $style['name'], '%file' => $image_path)));
+ $this->assertEqual($this->getImageCount($style), 1, 'Image style ' . $style['name'] . ' image ' . $image_path . ' successfully generated.');
// 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', 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.'));
+ $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.');
}
/**
@@ -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']), t('Image displayed using style @style.', array('@style' => $style_name)));
+ $this->assertRaw(image_style_url($style_name, $node->{$field_name}[LANGUAGE_NONE][0]['uri']), 'Image displayed using 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.'), t('Style %name was renamed to %new_name.', array('%name' => $style_name, '%new_name' => $new_style_name)));
+ $this->assertText(t('Changes to the style have been saved.'), 'Style ' . $style_name . ' was renamed to ' . $new_style_name . '.');
$this->drupalGet('node/' . $nid);
- $this->assertRaw(image_style_url($new_style_name, $node->{$field_name}[LANGUAGE_NONE][0]['uri']), t('Image displayed using style replacement style.'));
+ $this->assertRaw(image_style_url($new_style_name, $node->{$field_name}[LANGUAGE_NONE][0]['uri']), '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']), t('Image displayed using style replacement style.'));
+ $this->assertRaw(image_style_url('thumbnail', $node->{$field_name}[LANGUAGE_NONE][0]['uri']), '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, t('Default formatter displaying correctly on full node view.'));
+ $this->assertRaw($default_output, '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, t('Image linked to file formatter displaying correctly on full node view.'));
+ $this->assertRaw($default_output, '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, t('Image linked to content formatter displaying correctly on full node view.'));
+ $this->assertRaw($default_output, '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, t('Image style thumbnail formatter displaying correctly on full node view.'));
+ $this->assertRaw($default_output, '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.'), 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.'));
+ $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.');
// 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]', '', t('Alt field displayed on article form.'));
- $this->assertFieldByName($field_name . '[' . LANGUAGE_NONE . '][0][title]', '', t('Title field displayed on article form.'));
+ $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.');
// 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, t("Preview image is displayed using 'medium' style."));
+ $this->assertRaw($default_output, "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, t('Image displayed using user supplied alt and title attributes.'));
+ $this->assertRaw($default_output, '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, '_', '-') . '(.*?)">', t('No image displayed when no image is attached and no default image specified.'));
+ $this->assertNoPattern('<div class="(.*?)field-name-' . strtr($field_name, '_', '-') . '(.*?)">', '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, t('Default image displayed when no user supplied image is present.'));
+ $this->assertRaw($default_output, '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, t('Default image is not displayed when user supplied image is present.'));
- $this->assertRaw($image_output, t('User supplied image is displayed.'));
+ $this->assertNoRaw($default_output, 'Default image is not displayed when user supplied image is present.');
+ $this->assertRaw($image_output, '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'], t('Default image removed from field.'));
+ $this->assertFalse($field['settings']['default_image'], '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.'), t('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.'), '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.'), t('Image exceeding max resolution was properly resized.'));
+ $this->assertText(t('The image was resized to fit within the maximum allowed dimensions of 100x100 pixels.'), 'Image exceeding max resolution was properly resized.');
}
}
diff --git a/modules/locale/locale.test b/modules/locale/locale.test
index e6c7cac..03dce7e 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', t('Language added successfully.'));
- $this->assertEqual($this->getUrl(), url('admin/config/regional/language', array('absolute' => TRUE)), t('Correct page redirection.'));
+ $this->assertText('fr', 'Language added successfully.');
+ $this->assertEqual($this->getUrl(), url('admin/config/regional/language', array('absolute' => TRUE)), '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)), 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.'));
+ $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.');
// Check if we can change the default language.
$path = 'admin/config/regional/language';
$this->drupalGet($path);
- $this->assertFieldChecked('edit-site-default-en', t('English is the default language.'));
+ $this->assertFieldChecked('edit-site-default-en', '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', t('Default language updated.'));
- $this->assertEqual($this->getUrl(), url('admin/config/regional/language', array('absolute' => TRUE)), t('Correct page redirection.'));
+ $this->assertNoFieldChecked('edit-site-default-en', 'Default language updated.');
+ $this->assertEqual($this->getUrl(), url('admin/config/regional/language', array('absolute' => TRUE)), '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)), t('Correct page redirection.'));
- $this->assertText(t('The default language cannot be deleted.'), t('Failed to delete the default language.'));
+ $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.');
// Check if we can disable a language.
$edit = array(
'enabled[en]' => FALSE,
);
$this->drupalPost($path, $edit, t('Save configuration'));
- $this->assertNoFieldChecked('edit-enabled-en', t('Language disabled.'));
+ $this->assertNoFieldChecked('edit-enabled-en', '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', t('Default language re-enabled.'));
+ $this->assertFieldChecked('edit-enabled-en', 'Default language re-enabled.');
// Ensure 'edit' link works.
$this->clickLink(t('edit'));
- $this->assertTitle(t('Edit language | Drupal'), t('Page title is "Edit language".'));
+ $this->assertTitle(t('Edit language | Drupal'), '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, t('The language has been updated.'));
- $this->assertEqual($this->getUrl(), url('admin/config/regional/language', array('absolute' => TRUE)), t('Correct page redirection.'));
+ $this->assertRaw($name, 'The language has been updated.');
+ $this->assertEqual($this->getUrl(), url('admin/config/regional/language', array('absolute' => TRUE)), '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'), t('"delete" link is correct.'));
+ $this->assertText(t('Are you sure you want to delete the language'), '"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)), t('Correct page redirection.'));
- $this->assertRaw($name, t('The language was not deleted.'));
+ $this->assertEqual($this->getUrl(), url('admin/config/regional/language', array('absolute' => TRUE)), 'Correct page redirection.');
+ $this->assertRaw($name, '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)), t('The test language has been removed.'));
- $this->assertEqual($this->getUrl(), url('admin/config/regional/language', array('absolute' => TRUE)), t('Correct page redirection.'));
+ $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.');
// Verify that language is no longer found.
$this->drupalGet('admin/config/regional/language/delete/' . $langcode);
- $this->assertResponse(404, t('Language no longer found.'));
+ $this->assertResponse(404, '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)), t('Correct page redirection.'));
- $this->assertText(t('The English language cannot be deleted.'), t('Failed to delete English language.'));
+ $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.');
}
}
@@ -202,12 +202,12 @@ class LocaleTranslationFunctionalTest extends DrupalWebTestCase {
t($name, array(), array('langcode' => $langcode));
// Reset locale cache.
locale_reset();
- $this->assertText($langcode, t('Language code found.'));
- $this->assertText($name, t('Name found.'));
- $this->assertText($native, t('Native found.'));
+ $this->assertText($langcode, 'Language code found.');
+ $this->assertText($name, 'Name found.');
+ $this->assertText($native, '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, t('Test language added.'));
+ $this->assertText($native, '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, t('Search found the name.'));
- $this->assertRaw($language_indicator, t('Name is untranslated.'));
+ $this->assertText($name, 'Search found the name.');
+ $this->assertRaw($language_indicator, '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, t('name found on edit screen.'));
+ $this->assertText($name, '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.'), 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->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->drupalPost('admin/config/regional/translate/translate', $search, t('Filter'));
// The indicator should not be here.
- $this->assertNoRaw($language_indicator, t('String is translated.'));
+ $this->assertNoRaw($language_indicator, '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'), t('String not found.'));
- $this->assertEqual($this->getUrl(), url('admin/config/regional/translate/translate', array('absolute' => TRUE)), t('Correct page redirection.'));
+ $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->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)), t('The test language has been removed.'));
+ $this->assertRaw(t('The language %locale has been removed.', array('%locale' => $name)), 'The test language has been removed.');
// Reload to remove $name.
$this->drupalGet($path);
- $this->assertNoText($langcode, t('Language code not found.'));
- $this->assertNoText($name, t('Name not found.'));
- $this->assertNoText($native, t('Native not found.'));
+ $this->assertNoText($langcode, 'Language code not found.');
+ $this->assertNoText($name, 'Name not found.');
+ $this->assertNoText($native, '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'), t('"delete" link is correct.'));
+ $this->assertText(t('Are you sure you want to delete the string'), '"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)), t('Correct page redirection.'));
- $this->assertRaw($name, t('The string was not deleted.'));
+ $this->assertEqual($this->getUrl(), url('admin/config/regional/translate/translate', array('absolute' => TRUE)), 'Correct page redirection.');
+ $this->assertRaw($name, '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.'), 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->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->drupalPost('admin/config/regional/translate/translate', $search, t('Filter'));
- $this->assertNoText($name, t('Search now can not find the name.'));
+ $this->assertNoText($name, '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), t('JavaScript file created: %file', array('%file' => $result ? $js_file : t('not found'))));
+ $this->assertTrue($result = file_exists($js_file), 'JavaScript file created: ' . $result ? $js_file : t('not found'));
// Test JavaScript translation rebuilding.
file_unmanaged_delete($js_file);
- $this->assertTrue($result = !file_exists($js_file), t('JavaScript file deleted: %file', array('%file' => $result ? $js_file : t('found'))));
+ $this->assertTrue($result = !file_exists($js_file), 'JavaScript file deleted: ' . $result ? $js_file : t('found'));
cache_clear_all();
_locale_rebuild_js($langcode);
- $this->assertTrue($result = file_exists($js_file), t('JavaScript file rebuilt: %file', array('%file' => $result ? $js_file : t('not found'))));
+ $this->assertTrue($result = file_exists($js_file), 'JavaScript file rebuilt: ' . $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), t('Found the edit path.'));
+ $this->assertTrue(preg_match('@(admin/config/regional/translate/edit/[0-9]+)@', $content, $matches), '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'), t('The string was rejected as unsafe.'));
- $this->assertNoText(t('The string has been saved.'), t('The string was not saved.'));
+ $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.');
}
}
@@ -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, t('Search found the string.'));
+ $this->assertText($name, '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.'), t("Search didn't find the string."));
+ $this->assertText(t('No strings available.'), "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.'), t('Search found the string.'));
+ $this->assertNoText(t('No strings available.'), '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.'), t('Search found the translation.'));
+ $this->assertNoText(t('No strings available.'), '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.'), t("Search didn't find the source string."));
+ $this->assertText(t('No strings available.'), "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.'), t("Search didn't find the translation."));
+ $this->assertText(t('No strings available.'), "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.'), t('Search found the translation.'));
+ $this->assertNoText(t('No strings available.'), '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.'), t("Search didn't find the translation."));
+ $this->assertText(t('No strings available.'), "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.'), t("Search didn't find the invalid string."));
+ $this->assertText(t('No strings available.'), "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')), t('The language has been automatically created.'));
+ $this->assertRaw(t('The language %language has been created.', array('%language' => 'French')), '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)), t('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)), '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, t('Plural number initialized.'));
+ $this->assert(db_query("SELECT plurals FROM {languages} WHERE language = 'fr'")->fetchField() == 2, 'Plural number initialized.');
// Ensure we were redirected correctly.
- $this->assertEqual($this->getUrl(), url('admin/config/regional/translate', array('absolute' => TRUE)), t('Correct page redirection.'));
+ $this->assertEqual($this->getUrl(), url('admin/config/regional/translate', array('absolute' => TRUE)), '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)), t('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)), '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, t('Unsafe strings were skipped.'));
+ $this->assertRaw($skip_message, '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)), t('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)), '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)), t('Correct page redirection.'));
- $this->assertText(t('File to import not found.'), t('File to import not found message.'));
+ $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.');
// 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)), t('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)), '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.'), t('String not overwritten by imported string.'));
+ $this->assertText(t('No strings available.'), '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, t('Plural numbers untouched.'));
+ $this->assert(db_query("SELECT plurals FROM {languages} WHERE language = 'fr'")->fetchField() == 2, '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)), t('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)), '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.'), t('String overwritten by imported string.'));
+ $this->assertNoText(t('No strings available.'), '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, t('Plural numbers changed.'));
+ $this->assert(db_query("SELECT plurals FROM {languages} WHERE language = 'fr'")->fetchField() == 3, '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.'), t('Language file automatically imported.'));
+ $this->assertText(t('One translation file imported for the enabled modules.'), '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.'), t('String successfully imported.'));
+ $this->assertNoText(t('No strings available.'), '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', t('Long month name context is working.'));
- $this->assertIdentical(t('May', array(), array('langcode' => 'hr')), 'Svi.', t('Default context is working.'));
+ $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.');
}
/**
@@ -919,9 +919,9 @@ class LocaleExportFunctionalTest extends DrupalWebTestCase {
), t('Export'));
// Ensure we have a translation file.
- $this->assertRaw('# French translation of Drupal', t('Exported French translation file.'));
+ $this->assertRaw('# French translation of Drupal', 'Exported French translation file.');
// Ensure our imported translations exist in the file.
- $this->assertRaw('msgstr "lundi"', t('French translations present in exported file.'));
+ $this->assertRaw('msgstr "lundi"', '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', t('Exported translation template file.'));
+ $this->assertRaw('# LANGUAGE translation of PROJECT', '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(), t('Function signatures of t() and st() are equal.'));
+ $this->assertEqual($reflector_t->getParameters(), $reflector_st->getParameters(), '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, t('Current language: %lang', array('%lang' => $language->language)));
+ $this->assertEqual($language->language, $this->language, 'Current language: ' . $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), t('JavaScript file created: %file', array('%file' => $result ? $js_file : t('none'))));
+ $this->assertTrue($result = file_exists($js_file), 'JavaScript file created: ' . $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', t('Language after uninstall: %lang', array('%lang' => $language->language)));
+ $this->assertEqual($language->language, 'en', 'Language after uninstall: ' . $language->language);
// Check JavaScript files deletion.
- $this->assertTrue($result = !file_exists($js_file), t('JavaScript file deleted: %file', array('%file' => $result ? $js_file : t('found'))));
+ $this->assertTrue($result = !file_exists($js_file), 'JavaScript file deleted: ' . $result ? $js_file : t('found'));
// Check language count.
$language_count = variable_get('language_count', 1);
- $this->assertEqual($language_count, 1, t('Language count: %count', array('%count' => $language_count)));
+ $this->assertEqual($language_count, 1, 'Language count: ' . $language_count);
// Check language negotiation.
require_once DRUPAL_ROOT . '/includes/language.inc';
- $this->assertTrue(count(language_types()) == count(drupal_language_types()), t('Language types reset'));
+ $this->assertTrue(count(language_types()) == count(drupal_language_types()), 'Language types reset');
$language_negotiation = language_negotiation_get(LANGUAGE_TYPE_INTERFACE) == LANGUAGE_NEGOTIATION_DEFAULT;
- $this->assertTrue($language_negotiation, t('Interface language negotiation: %setting', array('%setting' => t($language_negotiation ? 'none' : 'set'))));
+ $this->assertTrue($language_negotiation, 'Interface language negotiation: ' . t($language_negotiation ? 'none' : 'set'));
$language_negotiation = language_negotiation_get(LANGUAGE_TYPE_CONTENT) == LANGUAGE_NEGOTIATION_DEFAULT;
- $this->assertTrue($language_negotiation, t('Content language negotiation: %setting', array('%setting' => t($language_negotiation ? 'none' : 'set'))));
+ $this->assertTrue($language_negotiation, 'Content language negotiation: ' . t($language_negotiation ? 'none' : 'set'));
$language_negotiation = language_negotiation_get(LANGUAGE_TYPE_URL) == LANGUAGE_NEGOTIATION_DEFAULT;
- $this->assertTrue($language_negotiation, t('URL language negotiation: %setting', array('%setting' => t($language_negotiation ? 'none' : 'set'))));
+ $this->assertTrue($language_negotiation, 'URL language negotiation: ' . t($language_negotiation ? 'none' : 'set'));
// Check language providers settings.
- $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.'));
+ $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.');
// Check JavaScript parsed.
$javascript_parsed_count = count(variable_get('javascript_parsed', array()));
- $this->assertEqual($javascript_parsed_count, 0, t('JavaScript parsed count: %count', array('%count' => $javascript_parsed_count)));
+ $this->assertEqual($javascript_parsed_count, 0, 'JavaScript parsed count: ' . $javascript_parsed_count);
// Check multilingual workflow option for articles.
$multilingual = variable_get('language_content_type_article', 0);
- $this->assertEqual($multilingual, 0, t('Multilingual workflow option: %status', array('%status' => t($multilingual ? 'enabled': 'disabled'))));
+ $this->assertEqual($multilingual, 0, 'Multilingual workflow option: ' . t($multilingual ? 'enabled' : 'disabled'));
// Check JavaScript translations directory.
$locale_js_directory = variable_get('locale_js_directory', 'languages');
- $this->assertEqual($locale_js_directory, 'languages', t('JavaScript translations directory: %dir', array('%dir' => $locale_js_directory)));
+ $this->assertEqual($locale_js_directory, 'languages', 'JavaScript translations directory: ' . $locale_js_directory);
// Check string caching.
$locale_cache_strings = variable_get('locale_cache_strings', 1);
- $this->assertEqual($locale_cache_strings, 1, t('String caching: %status', array('%status' => t($locale_cache_strings ? 'enabled': 'disabled'))));
+ $this->assertEqual($locale_cache_strings, 1, 'String caching: ' . 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'), t('Language switcher block found.'));
+ $this->assertText(t('Languages'), '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')), 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.'));
+ $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.');
}
}
@@ -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'), t('Language settings available.'));
+ $this->assertText(t('Language settings'), 'Language settings available.');
// Ensure custom language is present.
- $this->assertText($name, t('Language present on form.'));
+ $this->assertText($name, 'Language present on form.');
// Ensure disabled language isn't present.
- $this->assertNoText($name_disabled, t('Disabled language not present on form.'));
+ $this->assertNoText($name_disabled, '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.'), t('Changes were saved.'));
+ $this->assertText(t('The changes have been saved.'), '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']), t('Default language successfully updated.'));
+ $this->assertTrue(isset($elements[0]) && !empty($elements[0]['checked']), '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, t('Language added successfully.'));
- $this->assertEqual($this->getUrl(), url('admin/config/regional/language', array('absolute' => TRUE)), t('Correct page redirection.'));
+ $this->assertText($langcode, 'Language added successfully.');
+ $this->assertEqual($this->getUrl(), url('admin/config/regional/language', array('absolute' => TRUE)), '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.'), t('Set language negotiation.'));
+ $this->assertText(t('Language negotiation configuration saved.'), '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", t('Global language set in the language selector.'));
+ $this->assertFieldChecked("edit-language-$langcode", '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, t('New user has correct language set.'));
+ $this->assertEqual($user->language, $langcode, '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, t('New user has correct language set.'));
+ $this->assertEqual($user->language, $langcode, '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", t('Language selector is accessible and correct language is selected.'));
+ $this->assertFieldChecked("edit-language-$langcode", '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", t('Language selector is accessible and correct language is selected.'));
+ $this->assertFieldChecked("edit-language-$langcode", '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, t('English alias works.'));
+ $this->assertText($node->title, 'English alias works.');
// Confirm custom language path alias works.
$this->drupalGet($prefix . '/' . $custom_language_path);
- $this->assertText($node->title, t('Custom language alias works.'));
+ $this->assertText($node->title, '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'), t('Multilingual support fieldset present on content type configuration form.'));
+ $this->assertText(t('Multilingual support'), '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')), t('Basic page content type has been updated.'));
+ $this->assertRaw(t('The content type %type has been updated.', array('%type' => 'Basic page')), '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', '', t('Language select not present on add article form.'));
+ $this->assertNoFieldByName('language', '', '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', '', t('Language select present on add Basic page form.'));
+ $this->assertFieldByName('language', '', 'Language select present on add Basic page form.');
// Ensure enabled language appears.
- $this->assertText($name, t('Enabled language present.'));
+ $this->assertText($name, 'Enabled language present.');
// Ensure disabled language doesn't appear.
- $this->assertNoText($name_disabled, t('Disabled language not present.'));
+ $this->assertNoText($name_disabled, '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>', t('Correct language selected.'));
+ $this->assertRaw('<option value="' . $langcode . '" selected="selected">' . $name . '</option>', '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)), t('Basic page content updated.'));
+ $this->assertRaw(t('%title has been updated.', array('%title' => $node_title)), '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')), t('Basic page content type has been updated.'));
+ $this->assertRaw(t('The content type %type has been updated.', array('%type' => 'Basic page')), '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, t('Node found in database.'));
+ $this->assertTrue($node, 'Node found in database.');
$assert = isset($node->body['en']) && !isset($node->body[LANGUAGE_NONE]) && $node->body['en'][0]['value'] == $body_value;
- $this->assertTrue($assert, t('Field language correctly set.'));
+ $this->assertTrue($assert, '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, t('Node found in database.'));
+ $this->assertTrue($node, 'Node found in database.');
$assert = isset($node->body['it']) && !isset($node->body['en']) && $node->body['it'][0]['value'] == $body_value;
- $this->assertTrue($assert, t('Field language correctly changed.'));
+ $this->assertTrue($assert, '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, t('Body correctly displayed using Italian as requested language'));
+ $this->assertRaw($body_value, 'Body correctly displayed using Italian as requested language');
$this->drupalGet("node/$node->nid");
- $this->assertRaw($body_value, t('Body correctly displayed using English as requested language'));
+ $this->assertRaw($body_value, '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, t('Node found in database.'));
+ $this->assertTrue($node, '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, t('English date format appears'));
+ $this->assertText($english_date, 'English date format appears');
$this->drupalGet('fr/node/' . $node->nid);
$french_date = format_date($node->created, 'custom', 'd.m.Y');
- $this->assertText($french_date, t('French date format appears'));
+ $this->assertText($french_date, 'French date format appears');
}
}
diff --git a/modules/menu/menu.test b/modules/menu/menu.test
index d1b8226..a050fd9 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'], t('Saving an existing link updates the description (title attribute)'));
+ $this->assertEqual($description, $saved_item['options']['attributes']['title'], '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, t('Custom menu was added.'));
+ $this->assertText($title, '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, t('Custom menu was edited.'));
+ $this->assertText($new_title, '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."), t('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."), '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."), t('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."), '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.'), t('Custom menu block was enabled'));
+ $this->assertText(t('The block settings have been updated.'), '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)), t('Custom menu was deleted'));
+ $this->assertRaw(t('The custom menu %title has been deleted.', array('%title' => $title)), '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, t('All menu links associated to the custom menu were deleted.'));
+ $this->assertFalse($result, '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, t('Link is not hidden in the database table when enabled via the overview form'));
+ $this->assertEqual($hidden, 0, '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, t('Path is found with both query and fragment.'));
+ $this->assertFieldByName('link_path', $path, '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, t('Path no longer has query or fragment.'));
+ $this->assertFieldByName('link_path', $path, '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)), t('Parent menu link link target was correct'));
+ $this->assertTitle(t("@title | Drupal", array('@title' => $title)), '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)), t('Menu link link target was correct'));
+ $this->assertTitle(t("@title | Drupal", array('@title' => $title)), '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.'), t('Menu link was reset'));
+ $this->assertRaw(t('The menu link was reset to its default settings.'), '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)), t('Menu link was deleted'));
+ $this->assertRaw(t('The menu link %title has been deleted.', array('%title' => $title)), '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, t('Link is hidden in the database table'));
+ $this->assertEqual($hidden, 1, '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, t('Link is not hidden in the database table'));
+ $this->assertEqual($hidden, 0, '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'), t('Menu help was displayed'));
+ $this->assertText(t('Menu'), 'Menu help was displayed');
}
// View menu build overview node.
$this->drupalGet('admin/structure/menu');
$this->assertResponse($response);
if ($response == 200) {
- $this->assertText(t('Menus'), t('Menu build overview node was displayed'));
+ $this->assertText(t('Menus'), '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'), t('Navigation menu node was displayed'));
+ $this->assertText(t('Navigation'), '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'), t('Menu edit node was displayed'));
+ $this->assertText(t('Edit menu item'), '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'), t('Menu settings node was displayed'));
+ $this->assertText(t('Menus'), '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'), t('Add menu node was displayed'));
+ $this->assertText(t('Menus'), '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, t('Menu weight correct in edit form'));
+ $this->assertOptionSelected('edit-menu-weight', 17, '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 f5d3aef..2a47eb7 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, 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.'));
+ $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.');
// 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, t('Node was loaded.'));
- $this->assertEqual($node4->title, $nodes[$node4->nid]->title, t('Node was loaded.'));
+ $this->assertEqual($node3->title, $nodes[$node3->nid]->title, 'Node was loaded.');
+ $this->assertEqual($node4->title, $nodes[$node4->nid]->title, 'Node was loaded.');
$count = count($nodes);
- $this->assertTrue($count == 2, t('@count nodes loaded.', array('@count' => $count)));
+ $this->assertTrue($count == 2, $count . ' nodes loaded.');
// 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, 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'));
+ $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');
foreach ($nodes as $node) {
- $this->assertTrue(is_object($node), t('Node is an object'));
+ $this->assertTrue(is_object($node), '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, 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->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]));
// 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, 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'));
+ $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');
// 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, t('@count node loaded', array('@count' => $count)));
- $this->assertEqual($nodes[$node3->nid]->title, $node3->title, t('Node successfully loaded.'));
+ $this->assertTrue($count == 1, $count . ' node loaded');
+ $this->assertEqual($nodes[$node3->nid]->title, $node3->title, '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'], t('Correct text displays for version.'));
+ $this->assertText($node->body[LANGUAGE_NONE][0]['value'], '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, t('Log message found.'));
+ $this->assertText($log, '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))), t('Revision reverted.'));
+ '%revision-date' => format_date($nodes[1]->revision_timestamp))), 'Revision reverted.');
$reverted_node = node_load($node->nid);
- $this->assertTrue(($nodes[1]->body[LANGUAGE_NONE][0]['value'] == $reverted_node->body[LANGUAGE_NONE][0]['value']), t('Node reverted correctly.'));
+ $this->assertTrue(($nodes[1]->body[LANGUAGE_NONE][0]['value'] == $reverted_node->body[LANGUAGE_NONE][0]['value']), '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)), 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.'));
+ '@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.');
}
/**
@@ -188,9 +188,9 @@ class NodeRevisionsTestCase extends DrupalWebTestCase {
);
node_save($updated_node);
$this->drupalGet('node/' . $node->nid);
- $this->assertText($new_title, t('New node title appears on the page.'));
+ $this->assertText($new_title, 'New node title appears on the page.');
$node_revision = node_load($node->nid, NULL, TRUE);
- $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.'));
+ $this->assertEqual($node_revision->log, $log, '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, t('Node found in database.'));
+ $this->assertTrue($node, '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, t('On edit page.'));
+ $this->assertEqual($edit_url, $actual_url, '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, 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.'));
+ $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.');
// 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], t('Title displayed.'));
- $this->assertText($edit[$body_key], t('Body displayed.'));
+ $this->assertText($edit[$title_key], 'Title displayed.');
+ $this->assertText($edit[$body_key], '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'), t('Basic page title is preview.'));
- $this->assertText($edit[$title_key], t('Title displayed.'));
- $this->assertText($edit[$body_key], t('Body displayed.'));
+ $this->assertTitle(t('Preview | Drupal'), 'Basic page title is preview.');
+ $this->assertText($edit[$title_key], 'Title displayed.');
+ $this->assertText($edit[$body_key], 'Body displayed.');
// Check that the title and body fields are displayed with the correct values.
- $this->assertFieldByName($title_key, $edit[$title_key], t('Title field displayed.'));
- $this->assertFieldByName($body_key, $edit[$body_key], t('Body field displayed.'));
+ $this->assertFieldByName($title_key, $edit[$title_key], 'Title field displayed.');
+ $this->assertFieldByName($body_key, $edit[$body_key], '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'), t('Basic page title is preview.'));
- $this->assertText($edit[$title_key], t('Title displayed.'));
- $this->assertText($edit[$body_key], t('Body displayed.'));
+ $this->assertTitle(t('Preview | Drupal'), 'Basic page title is preview.');
+ $this->assertText($edit[$title_key], 'Title displayed.');
+ $this->assertText($edit[$body_key], 'Body displayed.');
// Check that the title and body fields are displayed with the correct values.
- $this->assertFieldByName($title_key, $edit[$title_key], t('Title field displayed.'));
- $this->assertFieldByName($body_key, $edit[$body_key], t('Body field displayed.'));
+ $this->assertFieldByName($title_key, $edit[$title_key], 'Title field displayed.');
+ $this->assertFieldByName($body_key, $edit[$body_key], 'Body field displayed.');
// Check that the log field has the correct value.
- $this->assertFieldByName('log', $edit['log'], t('Log field displayed.'));
+ $this->assertFieldByName('log', $edit['log'], '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"])), t('Basic page created.'));
+ $this->assertRaw(t('!post %title has been created.', array('!post' => 'Basic page', '%title' => $edit["title"])), 'Basic page created.');
// Check that the node exists in the database.
$node = $this->drupalGetNodeByTitle($edit["title"]);
- $this->assertTrue($node, t('Node found in database.'));
+ $this->assertTrue($node, 'Node found in database.');
}
/**
@@ -468,30 +468,30 @@ class NodeCreationTestCase extends DrupalWebTestCase {
try {
node_save((object) $edit);
- $this->fail(t('Expected exception has not been thrown.'));
+ $this->fail('Expected exception has not been thrown.');
}
catch (Exception $e) {
- $this->pass(t('Expected exception has been thrown.'));
+ $this->pass('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, t('Transactions supported, and node not found in database.'));
+ $this->assertFalse($node, '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, t('Transactions not supported, and node found in database.'));
+ $this->assertTrue($node, '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, t('Transactions not supported, and rollback error logged to watchdog.'));
+ $this->assertTrue(count($records) > 0, '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, t('Rollback explanatory error logged to watchdog.'));
+ $this->assertTrue(count($records) > 0, '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), t('Node created.'));
+ $this->assertTrue(node_load($node->nid), '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), t('Node created.'));
+ $this->assertTrue(node_load($node->nid), '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, t('Check that the summary is 600 characters in length'), 'Node');
+ $this->assertRaw($expected, '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, t('Check that the summary is not longer than 200 characters'), 'Node');
+ $this->assertNoRaw($expected, '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, t('Harmful tags are escaped when previewing a node.'));
+ $this->assertNoRaw($xss, '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', t('Title is diplayed when viewing a node.'));
- $this->assertNoRaw($xss, t('Harmful tags are escaped when viewing a node.'));
+ $this->assertTitle($edit["title"] . ' | Drupal', 'Title is diplayed when viewing a node.');
+ $this->assertNoRaw($xss, 'Harmful tags are escaped when viewing a node.');
$this->drupalGet('node/' . $node->nid . '/edit');
- $this->assertNoRaw($xss, t('Harmful tags are escaped when editing a node.'));
+ $this->assertNoRaw($xss, '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.'), t('Block configuration set.'));
+ $this->assertText(t('The block configuration has been saved.'), '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.'), t('Block successfully move to footer region.'));
+ $this->assertText(t('The block settings have been updated.'), '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, t('Post information is displayed.'));
+ $this->assertEqual(count($elements), 1, '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">', t('Post information is not displayed.'));
+ $this->assertNoRaw('<span class="submitted">', '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, t('Node content designated for RSS appear in RSS feed.'));
+ $this->assertText($rss_only_content, '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, t('Node content not designed for RSS doesn\'t appear in RSS feed.'));
+ $this->assertNoText($non_rss_content, '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)), t('Extra RSS elements appear in RSS feed.'));
- $this->assertRaw($test_ns, t('Extra namespaces appear in RSS feed.'));
+ $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.');
// Check that content added in 'rss' view mode doesn't appear when
// viewing node.
$this->drupalGet("node/$node->nid");
- $this->assertNoText($rss_only_content, t('Node content designed for RSS doesn\'t appear when viewing node.'));
+ $this->assertNoText($rss_only_content, '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), t('Article node created.'));
+ $this->assertTrue(node_load($node1->nid), '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, 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.'));
+ $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.');
// Create an unpromoted "Basic page" node.
$node2 = $this->drupalCreateNode(array('type' => 'page', 'promote' => 0));
- $this->assertTrue(node_load($node1->nid), t('Unpromoted basic page node created.'));
+ $this->assertTrue(node_load($node1->nid), '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, 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.'));
+ $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.');
// Create an unpromoted, unpublished "Basic page" node.
$node3 = $this->drupalCreateNode(array('type' => 'page', 'promote' => 0, 'status' => 0));
- $this->assertTrue(node_load($node3->nid), t('Unpromoted, unpublished basic page node created.'));
+ $this->assertTrue(node_load($node3->nid), '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, 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.'));
+ $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.');
// Create a promoted "Basic page" node.
$node4 = $this->drupalCreateNode(array('type' => 'page', 'promote' => 1));
- $this->assertTrue(node_load($node4->nid), t('Promoted basic page node created.'));
+ $this->assertTrue(node_load($node4->nid), '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, 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.'));
+ $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.');
// 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, t('Altered the %op grant for a user.', array('%op' => $op)));
+ $this->assertNotEqual($grants, $altered_grants, 'Altered the ' . $op . ' grant for a user.');
}
}
}
@@ -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, t('Function node_submit() preserves user ID'));
+ $this->assertEqual($node->uid, $this->web_user->uid, 'Function node_submit() preserves user ID');
node_save($node);
// Test the import.
$node_by_nid = node_load($test_nid);
- $this->assertTrue($node_by_nid, t('Node load by node ID.'));
+ $this->assertTrue($node_by_nid, 'Node load by node ID.');
$node_by_title = $this->drupalGetNodeByTitle($title);
- $this->assertTrue($node_by_title, t('Node load by node title.'));
+ $this->assertTrue($node_by_title, '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, t('Creating a node sets default "created" timestamp.'));
- $this->assertEqual($node->changed, REQUEST_TIME, t('Creating a node sets default "changed" timestamp.'));
+ $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.');
// 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, t('Updating a node preserves "created" timestamp.'));
+ $this->assertEqual($node->created, $created, '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, 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.'));
+ $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.');
// 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, 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.'));
+ $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.');
// 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, 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.'));
+ $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.');
}
}
@@ -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']), t('Node type article is available.'));
- $this->assertTrue(isset($node_types['page']), t('Node type basic page is available.'));
+ $this->assertTrue(isset($node_types['article']), 'Node type article is available.');
+ $this->assertTrue(isset($node_types['page']), 'Node type basic page is available.');
- $this->assertEqual($node_types['article']->name, $node_names['article'], t('Correct node type base has been returned.'));
+ $this->assertEqual($node_types['article']->name, $node_names['article'], '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.'));
+ $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.');
}
/**
@@ -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', t('Body field was found.'));
+ $this->assertEqual($instance['label'], 'Body', 'Body field was found.');
// Verify that title and body fields are displayed.
$this->drupalGet('node/add/page');
- $this->assertRaw('Title', t('Title field was found.'));
- $this->assertRaw('Body', t('Body field was found.'));
+ $this->assertRaw('Title', 'Title field was found.');
+ $this->assertRaw('Body', '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', t('New title label was displayed.'));
- $this->assertNoRaw('Title', t('Old title label was not displayed.'));
+ $this->assertRaw('Foo', 'New title label was displayed.');
+ $this->assertNoRaw('Title', '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', t('New name was displayed.'));
- $this->assertRaw('Lorem ipsum', t('New description was displayed.'));
+ $this->assertRaw('Bar', 'New name was displayed.');
+ $this->assertRaw('Lorem ipsum', 'New description was displayed.');
$this->clickLink('Bar');
- $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.'));
+ $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.');
// 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', t('Body field was not found.'));
+ $this->assertNoRaw('Body', '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 . ']', '', t('Tableselect found.'));
+ $this->assertFieldByName('nodes[' . $node->nid . ']', '', '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'))), t('Content list is filtered by status.'));
+ $this->assertRaw(t('<strong>%type</strong> is <strong>%value</strong>', array('%type' => t('status'), '%value' => t('published'))), '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'))), 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->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->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 . ']', '', t('No tableselect found.'));
+ $this->assertNoFieldByName('nodes[' . $nodes['published_page']->nid . ']', '', '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 . ']', '', t('No tableselect found.'));
+ $this->assertNoFieldByName('nodes[' . $nodes['unpublished_page_2']->nid . ']', '', '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.'), t('Block saved to first sidebar region.'));
+ $this->assertText(t('The block settings have been updated.'), '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.'), t('Block saved.'));
+ $this->assertText(t('The block configuration has been saved.'), 'Block saved.');
// Test that block is not visible without nodes
$this->drupalGet('');
- $this->assertText(t('No content available.'), t('Block with "No content available." found.'));
+ $this->assertText(t('No content available.'), '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'], t('Block was not found.'));
+ $this->assertNoText($block['title'], 'Block was not found.');
// Test that only the 2 latest nodes are shown.
$this->drupalLogin($this->web_user);
- $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.'));
+ $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.');
// 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 . '"]'), t('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 . '"]'), '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.'), t('Block saved.'));
+ $this->assertText(t('The block configuration has been saved.'), 'Block saved.');
// Post an additional node.
$node4 = $this->drupalCreateNode($default_settings);
// Test that all four nodes are shown.
$this->drupalGet('');
- $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.'));
+ $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.');
// 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, t('Custom block with visibility rule was created.'));
+ $this->assertTrue($bid, 'Custom block with visibility rule was created.');
// Verify visibility rules.
$this->drupalGet('');
- $this->assertNoText($custom_block['title'], t('Block was displayed on the front page.'));
+ $this->assertNoText($custom_block['title'], 'Block was displayed on the front page.');
$this->drupalGet('node/add/article');
- $this->assertText($custom_block['title'], t('Block was displayed on the node/add/article page.'));
+ $this->assertText($custom_block['title'], 'Block was displayed on the node/add/article page.');
$this->drupalGet('node/' . $node1->nid);
- $this->assertText($custom_block['title'], t('Block was displayed on the node/N.'));
+ $this->assertText($custom_block['title'], '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, t('Custom block was deleted.'));
+ $this->assertFalse($bid, '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']), t('Node content was emptied prior to being built.'));
+ $this->assertFalse(isset($content['test_content_property']), '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, t('User with access can see correct nodes'));
+ $this->assertEqual(count($result), 4, 'User with access can see correct nodes');
}
catch (Exception $e) {
- $this->fail(t('Altered query is malformed'));
+ $this->fail('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, t('User with no access cannot see nodes'));
+ $this->assertEqual(count($result), 0, 'User with no access cannot see nodes');
}
catch (Exception $e) {
- $this->fail(t('Altered query is malformed'));
+ $this->fail('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, t('User with view-only access cannot edit nodes'));
+ $this->assertEqual(count($result), 0, 'User with view-only access cannot edit nodes');
}
catch (Exception $e) {
$this->fail($e->getMessage());
$this->fail((string) $query);
- $this->fail(t('Altered query is malformed'));
+ $this->fail('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)), t('No empty tokens generated.'));
+ $this->assertFalse(in_array(0, array_map('strlen', $tests)), 'No empty tokens generated.');
foreach ($tests as $input => $expected) {
$output = token_replace($input, array('node' => $node), array('language' => $language));
- $this->assertFalse(strcmp($output, $expected), t('Sanitized node token %token replaced.', array('%token' => $input)));
+ $this->assertFalse(strcmp($output, $expected), 'Sanitized node token ' . $input . ' replaced.');
}
// 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), t('Unsanitized node token %token replaced.', array('%token' => $input)));
+ $this->assertFalse(strcmp($output, $expected), 'Unsanitized node token ' . $input . ' replaced.');
}
}
}
diff --git a/modules/openid/openid.test b/modules/openid/openid.test
index 68313ae..36d65f2 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'), t('OpenID redirect page was displayed.'));
+ $this->assertTitle(t('OpenID redirect'), '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, t('User was logged in.'));
+ $this->assertLink($this->web_user->name, 0, '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'), t('OpenID redirect page was displayed.'));
+ $this->assertTitle(t('OpenID redirect'), '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, t('User was logged in.'));
+ $this->assertLink($this->web_user->name, 0, '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'), t('OpenID redirect page was displayed.'));
+ $this->assertTitle(t('OpenID redirect'), '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, t('User was logged in.'));
+ $this->assertLink($this->web_user->name, 0, '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, t('Identity appears in list.'));
+ $this->assertText($identity, 'Identity appears in list.');
// Delete the newly added identity.
$this->clickLink(t('Delete'));
$this->drupalPost(NULL, array(), t('Confirm'));
- $this->assertText(t('OpenID deleted.'), t('Identity deleted'));
- $this->assertNoText($identity, t('Identity no longer appears in list.'));
+ $this->assertText(t('OpenID deleted.'), 'Identity deleted');
+ $this->assertNoText($identity, '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.', t('Account was blocked.'));
+ $this->assertRaw('The update has been performed.', '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)), t('User login was blocked.'));
+ $this->assertRaw(t('The username %name has not been activated or is blocked.', array('%name' => $this->web_user->name)), '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.'), t('Invalid identity was rejected.'));
+ $this->assertRaw(t('Sorry, that is not a valid OpenID. Ensure you have spelled your ID correctly.'), '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'), t('OpenID redirect page was displayed.'));
+ $this->assertTitle(t('OpenID redirect'), '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)), t('Identity %identity was added.', array('%identity' => $identity)));
+ $this->assertRaw(t('Successfully added %identity', array('%identity' => $claimed_id)), 'Identity ' . $identity . ' was added.');
}
}
@@ -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.'), 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.'));
+ $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.');
$user = user_load_by_name('john');
- $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->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->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, t('User was logged in.'));
+ $this->assertLink('john', 0, '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, t('User was logged in.'));
+ $this->assertLink('john', 0, 'User was logged in.');
$user = user_load_by_name('john');
- $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->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->drupalLogout();
$this->submitLoginForm($identity);
- $this->assertLink('john', 0, t('User was logged in.'));
+ $this->assertLink('john', 0, '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'))), 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.'));
+ $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.');
// 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.'), t('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.'), 'User was asked to verify e-mail address.');
$user = user_load_by_name('john');
- $this->assertTrue($user, t('User was registered with right username.'));
- $this->assertFalse($user->data, t('No additional user info was saved.'));
+ $this->assertTrue($user, 'User was registered with right username.');
+ $this->assertFalse($user->data, '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', t('User was registered with right e-mail address.'));
+ $this->assertFieldByName('mail', 'john@example.com', 'User was registered with right e-mail address.');
$this->clickLink(t('OpenID identities'));
- $this->assertRaw($identity, t('OpenID identity was registered.'));
+ $this->assertRaw($identity, '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'))), 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.'));
+ $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.');
// 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.'), t('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.'), 'User was asked to verify e-mail address.');
$user = user_load_by_name('john');
- $this->assertTrue($user, t('User was registered with right username.'));
- $this->assertFalse($user->data, t('No additional user info was saved.'));
+ $this->assertTrue($user, 'User was registered with right username.');
+ $this->assertFalse($user->data, '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', t('User was registered with right e-mail address.'));
+ $this->assertFieldByName('mail', 'john@example.com', 'User was registered with right e-mail address.');
$this->clickLink(t('OpenID identities'));
- $this->assertRaw($identity, t('OpenID identity was registered.'));
+ $this->assertRaw($identity, '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, t('User was logged in.'));
+ $this->assertLink('john', 0, 'User was logged in.');
$user = user_load_by_name('john');
- $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->assertTrue($user, 'User was registered with right username.');
+ $this->assertEqual($user->mail, 'john@example.com', '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', 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_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_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.'));
+ $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.');
}
/**
* Test _openid_dh_xorsecret().
*/
function testOpenidDhXorsecret() {
- $this->assertEqual(_openid_dh_xorsecret('123456790123456790123456790', "abc123ABC\x00\xFF"), "\xa4'\x06\xbe\xf1.\x00y\xff\xc2\xc1", t('_openid_dh_xorsecret() returned expected result.'));
+ $this->assertEqual(_openid_dh_xorsecret('123456790123456790123456790', "abc123ABC\x00\xFF"), "\xa4'\x06\xbe\xf1.\x00y\xff\xc2\xc1", '_openid_dh_xorsecret() returned expected result.');
}
/**
* Test _openid_get_bytes().
*/
function testOpenidGetBytes() {
- $this->assertEqual(strlen(_openid_get_bytes(20)), 20, t('_openid_get_bytes() returned expected result.'));
+ $this->assertEqual(strlen(_openid_get_bytes(20)), 20, '_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=', t('Expected signature calculated.'));
+ $this->assertEqual(_openid_signature($association, $response, array('foo', 'bar')), 'QnKZQzSFstT+GNiJDFOptdcZjrc=', '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'), 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.'));
+ $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.');
}
/**
@@ -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', 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('$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('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('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('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'), 'http://example.com/path', 'openid_normalize() correctly normalized a URL with a path.');
- $this->assertEqual(openid_normalize('http://example.com/path#fragment'), 'http://example.com/path', t('openid_normalize() correctly normalized a URL with a fragment.'));
+ $this->assertEqual(openid_normalize('http://example.com/path#fragment'), 'http://example.com/path', 'openid_normalize() correctly normalized a URL with a fragment.');
}
}
diff --git a/modules/path/path.test b/modules/path/path.test
index cca5fd9..8d48c71 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'), t('Cache entry was created.'));
+ $this->assertTrue(cache_get($edit['source'], 'cache_path'), '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'), t('Cache entry was created.'));
+ $this->assertTrue(cache_get($edit['source'], 'cache_path'), '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]']), t('URL contains the path alias.'));
+ $this->assertTrue(strpos($url, $edit['path[alias]']), '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, t('Alias for French translation is unavailable when URL language negotiation is disabled.'));
+ $this->assertResponse(404, '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, t('Normal path works.'));
+ $this->assertEqual($french_node_path, 'node/' . $french_node->nid, '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, t('Normal path is the same.'));
+ $this->assertEqual($french_node_path, 'node/' . $french_node->nid, '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, t('Alias works.'));
+ $this->assertEqual($french_node_alias, $french_alias, '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, t('Alias is the same.'));
+ $this->assertEqual($french_node_alias, $french_alias, '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(), t('Site is mono-lingual'));
- $this->assertEqual(language_default('language'), 'fr', t('French is the default language'));
+ $this->assertFalse(drupal_multilingual(), 'Site is mono-lingual');
+ $this->assertEqual(language_default('language'), 'fr', '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 6f36e4f..703c36e 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', t('PHP code text format was created.'));
+ $this->assertEqual($php_format->name, 'PHP code', '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, t('PHP code filter is enabled.'));
+ $this->assertTrue($filters['php_code']->status, 'PHP code filter is enabled.');
// Verify that the format exists on the administration page.
$this->drupalGet('admin/config/content/formats');
- $this->assertText('PHP code', t('PHP code text format was created.'));
+ $this->assertText('PHP code', '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, 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.'));
+ $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.');
// 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!"', t('PHP code is displayed.'));
+ $this->assertText('print "SimpleTest PHP was executed!"', '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)), t('PHP code filter turned on.'));
+ $this->assertRaw(t('Basic page %title has been updated.', array('%title' => $node->title)), 'PHP code filter turned on.');
// Make sure that the PHP code shows up as text.
- $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.'));
+ $this->assertNoText('print "SimpleTest PHP was executed!"', "PHP code isn't displayed.");
+ $this->assertText('SimpleTest PHP was executed!', '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', t('PHP code was not evaluated.'));
+ $this->assertText('print', '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 . '">', t('PHP code format not available.'));
+ $this->assertNoRaw('<option value="' . $this->php_code_format . '">', 'PHP code format not available.');
}
}
diff --git a/modules/poll/poll.test b/modules/poll/poll.test
index 0616464..4b214cb 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, t('Choice @choice found was in preview.', array('@choice' => $k)));
+ $this->assertRaw($choice_text, 'Choice ' . $k . ' found was in preview.');
}
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, t('Poll has been found in the database.'));
+ $this->assertTrue($node->nid, '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), t("Vote button doesn't appear."));
+ $this->assertTrue(empty($elements), "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]), t("'Cancel your vote' button appears."));
+ $this->assertTrue(isset($elements[0]), "'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), t("'Cancel your vote' button no longer appears."));
+ $this->assertTrue(empty($elements), "'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]), t("'Cancel your vote' button appears."));
+ $this->assertTrue(isset($elements[0]), "'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), t("'Cancel your vote' button does not appear."));
+ $this->assertTrue(empty($elements), "'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.'), t('Block configuration set.'));
+ $this->assertText(t('The block configuration has been saved.'), '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.'), t('Block successfully move to footer region.'));
+ $this->assertText(t('The block settings have been updated.'), '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]'], 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)));
+ $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');
}
}
@@ -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.'), 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.'));
+ $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.');
// Check to make sure User1 cannot vote again.
$this->drupalGet('node/' . $this->poll_nid);
$elements = $this->xpath('//input[@value="Vote"]');
- $this->assertTrue(empty($elements), t("%user is not able to vote again.", array('%user' => $this->web_user1->name)));
+ $this->assertTrue(empty($elements), "" . $this->web_user1->name . " is not able to vote again.");
$elements = $this->xpath('//input[@value="Cancel your vote"]');
- $this->assertTrue(!empty($elements), t("'Cancel your vote' button appears."));
+ $this->assertTrue(!empty($elements), "'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', t('Page was cacheable but was not in the cache.'));
+ $this->assertEqual($this->drupalGetHeader('x-drupal-cache'), 'MISS', 'Page was cacheable but was not in the cache.');
$this->drupalGet('node/' . $this->poll_nid);
- $this->assertEqual($this->drupalGetHeader('x-drupal-cache'), 'HIT', t('Page was cached.'));
+ $this->assertEqual($this->drupalGetHeader('x-drupal-cache'), 'HIT', 'Page was cached.');
// Anonymous user vote on Poll.
$this->drupalPost(NULL, $edit, t('Vote'));
- $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.'));
+ $this->assertText(t('Your vote was recorded.'), 'Anonymous vote was recorded.');
+ $this->assertText(t('Total votes: @votes', array('@votes' => 2)), 'Vote count updated correctly.');
$elements = $this->xpath('//input[@value="Cancel your vote"]');
- $this->assertTrue(!empty($elements), t("'Cancel your vote' button appears."));
+ $this->assertTrue(!empty($elements), "'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'), t('Page was not cacheable.'));
+ $this->assertFalse($this->drupalGetHeader('x-drupal-cache'), 'Page was not cacheable.');
$elements = $this->xpath('//input[@value="Vote"]');
- $this->assertTrue(empty($elements), t("Anonymous is not able to vote again."));
+ $this->assertTrue(empty($elements), "Anonymous is not able to vote again.");
$elements = $this->xpath('//input[@value="Cancel your vote"]');
- $this->assertTrue(!empty($elements), t("'Cancel your vote' button appears."));
+ $this->assertTrue(!empty($elements), "'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.'), t('%user vote was recorded.', array('%user' => $this->web_user2->name)));
+ $this->assertText(t('Your vote was recorded.'), $this->web_user2->name . ' vote was recorded.');
$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), t("'Cancel your vote' button does not appear."));
+ $this->assertTrue(empty($elements), "'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', t('Page was cacheable but was not in the cache.'));
+ $this->assertEqual($this->drupalGetHeader('x-drupal-cache'), 'MISS', 'Page was cacheable but was not in the cache.');
$this->drupalPost(NULL, $edit, t('Vote'));
- $this->assertText(t('Your vote was recorded.'), t('%user vote was recorded.', array('%user' => $this->web_user2->name)));
+ $this->assertText(t('Your vote was recorded.'), $this->web_user2->name . ' vote was recorded.');
$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), t("'Cancel your vote' button appears."));
+ $this->assertTrue(!empty($elements), "'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', t('Page was cacheable but was not in the cache.'));
+ $this->assertEqual($this->drupalGetHeader('x-drupal-cache'), 'MISS', 'Page was cacheable but was not in the cache.');
$elements = $this->xpath('//input[@value="Vote"]');
- $this->assertTrue(empty($elements), t('Anonymous is not able to vote again.'));
+ $this->assertTrue(empty($elements), 'Anonymous is not able to vote again.');
$elements = $this->xpath('//input[@value="Cancel your vote"]');
- $this->assertTrue(empty($elements), t("'Cancel your vote' button does not appear."));
+ $this->assertTrue(empty($elements), "'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), t("%user is not able to vote again.", array('%user' => $this->web_user1->name)));
+ $this->assertTrue(empty($elements), "" . $this->web_user1->name . " is not able to vote again.");
$elements = $this->xpath('//input[@value="Cancel your vote"]');
- $this->assertTrue(!empty($elements), t("'Cancel your vote' button appears."));
+ $this->assertTrue(!empty($elements), "'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)), t('No empty tokens generated.'));
+ $this->assertFalse(in_array(0, array_map('strlen', $tests)), 'No empty tokens generated.');
foreach ($tests as $input => $expected) {
$output = token_replace($input, array('node' => $poll), array('language' => $language));
- $this->assertFalse(strcmp($output, $expected), t('Sanitized poll token %token replaced.', array('%token' => $input)));
+ $this->assertFalse(strcmp($output, $expected), 'Sanitized poll token ' . $input . ' replaced.');
}
// 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), t('Unsanitized poll token %token replaced.', array('%token' => $input)));
+ $this->assertFalse(strcmp($output, $expected), 'Unsanitized poll token ' . $input . ' replaced.');
}
}
}
@@ -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, t('Poll for auto-expire test created.'), t('Poll'));
+ $this->assertTrue($poll_nid, 'Poll for auto-expire test created.', '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', t('Poll expiration setting found.'), t('Poll'));
+ $this->assertField('runtime', 'Poll expiration setting found.', 'Poll');
$elements = $this->xpath('//select[@id="edit-runtime"]/option[@selected="selected"]');
- $this->assertTrue(isset($elements[0]['value']) && $elements[0]['value'] == 0, t('Poll expiration set to unlimited.'), t('Poll'));
+ $this->assertTrue(isset($elements[0]['value']) && $elements[0]['value'] == 0, 'Poll expiration set to unlimited.', '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)), t('Poll expiration settings saved.'), t('Poll'));
+ $this->assertRaw(t('Poll %title has been updated.', array('%title' => $title)), 'Poll expiration settings saved.', '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, t('Poll expiration set to unlimited.'), t('Poll'));
+ $this->assertTrue(isset($elements[0]['value']) && $elements[0]['value'] == $poll_expiration, 'Poll expiration set to unlimited.', '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']), t('Poll is still active.'), t('Poll'));
+ $this->assertTrue(isset($elements[0]) && !empty($elements[0]['checked']), 'Poll is still active.', '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']), t('Poll has expired.'), t('Poll'));
+ $this->assertTrue(isset($elements[0]) && !empty($elements[0]['checked']), 'Poll has expired.', 'Poll');
}
-} \ No newline at end of file
+}
diff --git a/modules/profile/profile.test b/modules/profile/profile.test
index 27b32d3..37843cd 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, t('New Profile field has been entered in the database'));
+ $this->assertTrue($fid, '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]', 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'));
+ $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');
}
else {
- $this->assertField($form_name , t('Found form named @name', array('@name' => $form_name)));
+ $this->assertField($form_name, 'Found form named ' . $form_name);
}
// Checking name.
- $this->assertText($title, t('Checking title for field %title', array('%title' => $title)));
+ $this->assertText($title, 'Checking title for field ' . $title);
// Checking explanation.
- $this->assertText($edit['explanation'], t('Checking explanation for field %title', array('%title' => $title)));
+ $this->assertText($edit['explanation'], 'Checking explanation for field ' . $title);
return array(
'fid' => $fid,
@@ -92,18 +92,18 @@ class ProfileTestCase extends DrupalWebTestCase {
// Checking field.
if ($type == 'date') {
- $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'));
+ $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');
}
else {
- $this->assertField($form_name , t('Found form named @name', array('@name' => $form_name)));
+ $this->assertField($form_name, 'Found form named ' . $form_name);
}
// Checking name.
- $this->assertText($title, t('Checking title for field %title', array('%title' => $title)));
+ $this->assertText($title, 'Checking title for field ' . $title);
// Checking explanation.
- $this->assertText($edit['explanation'], t('Checking explanation for field %title', array('%title' => $title)));
+ $this->assertText($edit['explanation'], 'Checking explanation for field ' . $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'], t('Found profile field with title %title', array('%title' => $field['title'])));
+ $this->assertText($field['title'], 'Found profile field with title ' . $field['title']);
if ($field['type'] != 'checkbox') {
// $value must be cast to a string in order to be found by assertText.
- $this->assertText("$value", t('Found profile field with value %value', array('%value' => $value)));
+ $this->assertText("$value", 'Found profile field with 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'], t('Checking deleted field %title', array('%title' => $field['title'])));
+ $this->assertNoText($field['title'], 'Checking deleted field ' . $field['title']);
}
}
@@ -266,9 +266,9 @@ class ProfileTestDate extends ProfileTestCase {
// Check profile page.
$this->drupalGet('user/' . $this->normal_user->uid);
- $this->assertText($field['title'], t('Found profile field with title %title', array('%title' => $field['title'])));
+ $this->assertText($field['title'], 'Found profile field with title ' . $field['title']);
- $this->assertText('01/09/1983', t('Found date profile field.'));
+ $this->assertText('01/09/1983', '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']), t('Profile field weights are respected on the user edit form.'));
+ $this->assertTrue(strpos($profile_edit, $field1['title']) > strpos($profile_edit, $field2['title']), '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']), t('Profile field weights are respected on the user profile page.'));
+ $this->assertTrue(strpos($profile_page, $field1['title']) > strpos($profile_page, $field2['title']), '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, 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.'));
+ $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.');
// 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, t('Autocomplete path allowed to user with permission.'));
- $this->assertRaw($field['value'], t('Autocomplete value found.'));
+ $this->assertResponse(200, 'Autocomplete path allowed to user with permission.');
+ $this->assertRaw($field['value'], '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, t('Autocomplete not found.'));
+ $this->assertNoRaw($autocomplete_html, '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, t('Autocomplete path denied to user without permission.'));
+ $this->assertResponse(403, '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.'), t('Block successfully move to footer region.'));
+ $this->assertText(t('The block settings have been updated.'), '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.'), t('Block configuration set.'));
+ $this->assertText(t('The block configuration has been saved.'), 'Block configuration set.');
// Visit the node and confirm that the field is displayed.
$this->drupalGet('node/' . $this->node->nid);
- $this->assertRaw($this->value1, t('Field 1 is displayed'));
- $this->assertNoRaw($this->value2, t('Field 2 is not displayed'));
+ $this->assertRaw($this->value1, 'Field 1 is displayed');
+ $this->assertNoRaw($this->value2, '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.'), t('Block configuration set.'));
+ $this->assertText(t('The block configuration has been saved.'), 'Block configuration set.');
// Visit the node and confirm that the field is displayed.
$this->drupalGet('node/' . $this->node->nid);
- $this->assertNoRaw($this->value1, t('Field 1 is not displayed'));
- $this->assertRaw($this->value2, t('Field 2 is displayed'));
+ $this->assertNoRaw($this->value1, 'Field 1 is not displayed');
+ $this->assertRaw($this->value2, '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.'), t('Block configuration set.'));
+ $this->assertText(t('The block configuration has been saved.'), 'Block configuration set.');
// Visit the node and confirm that the field is displayed.
$this->drupalGet('node/' . $this->node->nid);
- $this->assertRaw($this->value1, t('Field 1 is displayed'));
- $this->assertRaw($this->value2, t('Field 2 is displayed'));
+ $this->assertRaw($this->value1, 'Field 1 is displayed');
+ $this->assertRaw($this->value2, '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.'), t('Block configuration set.'));
+ $this->assertText(t('The block configuration has been saved.'), '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 137bb7c..82da0c2 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'), 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['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['created'], array(
'predicates' => array('dc:created'),
'datatype' => 'xsd:dateTime',
'callback' => 'date_iso8601',
- ), 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 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.');
$mapping = rdf_mapping_load('test_entity', 'test_bundle_no_mapping');
- $this->assertEqual($mapping, array(), t('Empty array returned when an entity type, bundle pair has no mapping.'));
+ $this->assertEqual($mapping, array(), '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), t('Attribute \'rel\' set on file field. Attribute \'resource\' is also set.'));
+ $this->assertTrue(!empty($file_rel), '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), t('Attribute \'rel\' set on image field. Attribute \'resource\' is also set.'));
+ $this->assertTrue(!empty($image_rel), '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), t('Default mapping was found.'));
+ $this->assertTrue(count($mapping), '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, t('Mapping was saved.'));
+ $this->assertTrue(rdf_mapping_save($mapping) === SAVED_NEW, '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, t('Mapping was stored properly in the {rdf_mapping} table.'));
+ $this->assertEqual($mapping, $stored_mapping, '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']), t('Saved mapping loaded successfully.'));
+ $this->assertEqual($mapping['mapping'], _rdf_mapping_load($mapping['type'], $mapping['bundle']), 'Saved mapping loaded successfully.');
// Verify updating of mapping.
$mapping['mapping']['title'] = array(
'predicates' => array('dc2:bar2'),
);
- $this->assertTrue(rdf_mapping_save($mapping) === SAVED_UPDATED, t('Mapping was updated.'));
+ $this->assertTrue(rdf_mapping_save($mapping) === SAVED_UPDATED, '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, t('Updated mapping was stored properly in the {rdf_mapping} table.'));
+ $this->assertEqual($mapping, $stored_mapping, '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']), t('Saved mapping loaded successfully.'));
+ $this->assertEqual($mapping['mapping'], _rdf_mapping_load($mapping['type'], $mapping['bundle']), 'Saved mapping loaded successfully.');
// Verify deleting of mapping.
- $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.'));
+ $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.');
}
}
@@ -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), 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.'));
+ $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.');
}
/**
@@ -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), 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.'));
+ $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.');
}
/**
@@ -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), 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.'));
+ $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.');
}
/**
@@ -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), t('RDFa markup found on user profile page'));
+ $this->assertTrue(!empty($user2_profile_about), '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), t('URI created for account holder and username set on sioc:UserAccount.'));
+ $this->assertTrue(!empty($user_account_holder), '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), t('foaf:name set on username.'));
+ $this->assertTrue(!empty($user_username), '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), t('RDFa markup found on author information on post. xml:lang on username is set to empty string.'));
+ $this->assertTrue(!empty($author_about), '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), t('RDFa markup found on term page.'));
+ $this->assertTrue(!empty($term_rdfa_meta), '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), t('RDFa markup for the number of comments found on teaser view.'));
+ $this->assertTrue(!empty($comment_count_teaser), '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), t('Empty rel attribute found in comment count link.'));
+ $this->assertTrue(!empty($comment_count_link), '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), t('RDFa markup for the number of comments found on full node view.'));
+ $this->assertTrue(!empty($comment_count_teaser), '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), t('RDFa markup for the homepage of anonymous user found.'));
+ $this->assertTrue(!empty($comment_homepage), '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), t('No about attribute is present on anonymous user comment.'));
+ $this->assertTrue(empty($comment_homepage), '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), t("RDFa markup for the homepage of anonymous user found."));
+ $this->assertTrue(!empty($comment_homepage), "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), t("No about attribute is present on anonymous user comment."));
+ $this->assertTrue(empty($comment_homepage), "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), t('RDFa markup referring to the node is present.'));
+ $this->assertEqual(1, count($result), '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, t('No RDFa markup referring to the comment itself is present.'));
+ $this->assertFalse($result, '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), t('RDFa markup referring to the node is present.'));
+ $this->assertEqual(1, count($result), '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), t('RDFa markup referring to the parent comment is present.'));
+ $this->assertEqual(1, count($result), '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), t("Comment RDF type for comment found."));
+ $this->assertTrue(!empty($comment_container), "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, t("RDFa markup for the comment title found."));
+ $this->assertEqual((string) $comment_title[0]->a, $comment->subject, "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), t("RDFa markup for the date of the comment found."));
+ $this->assertTrue(!empty($comment_date), "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, t("RDFa markup for the comment author found."));
+ $this->assertEqual((string) $comment_author[0], $name, "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, t("RDFa markup for the comment body found."));
+ $this->assertEqual((string) $comment_body[0]->p, $comment->comment, "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), t('About attribute found on table row for @user content.', array('@user'=> $user)));
+ $this->assertTrue(!empty($tracker_about), 'About attribute found on table row for ' . $user . ' content.');
// 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), t('Title property attribute found on @user content.', array('@user'=> $user)));
+ $this->assertTrue(!empty($tracker_title), 'Title property attribute found on ' . $user . ' content.');
// 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), t('Typeof and name property attributes found on @user.', array('@user'=> $user)));
+ $this->assertTrue(!empty($tracker_user), 'Typeof and name property attributes found on ' . $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), t('No about attribute is present on @user.', array('@user'=> $user)));
+ $this->assertTrue(empty($tracker_user), 'No about attribute is present on ' . $user . '.');
}
elseif ($node->uid > 0) {
- $this->assertTrue(!empty($tracker_user), t('About attribute is present on @user.', array('@user'=> $user)));
+ $this->assertTrue(!empty($tracker_user), 'About attribute is present on ' . $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, t('Num replies property and content attributes found on @user content.', array('@user'=> $user)));
+ $this->assertTrue($tracker_replies, 'Num replies property and content attributes found on ' . $user . ' content.');
// 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), 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)));
+ $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.');
// 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, t('Num replies property and content attributes found on @user content.', array('@user'=> $user)));
+ $this->assertTrue($tracker_replies, 'Num replies property and content attributes found on ' . $user . ' content.');
// 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), t('Latest activity date found when there are comments on @user content. Latest activity date content is correct.', array('@user'=> $user)));
+ $this->assertTrue(!empty($tracker_activity), 'Latest activity date found when there are comments on ' . $user . ' content. Latest activity date content is correct.');
}
}
@@ -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#', 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.'));
+ $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.');
}
}
diff --git a/modules/search/search.test b/modules/search/search.test
index 9079326..8f7a1ca 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.'), t('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.'), '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', t('Node type is Basic page.'));
+ $this->assertTrue($this->node->type == 'page', '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, t("Dummy title doens't equal node title"));
+ $this->assertNotEqual($dummy_title, $this->node->title, "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, t('Basic page node is not found with dummy title.'));
+ $this->assertNoText($this->node->title, '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, t('Basic page node is found with GET query.'));
+ $this->assertText($this->node->title, '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, t('Basic page node is found with POST query.'));
+ $this->assertText($this->node->title, '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, t('Basic page node is found with POST query and type:page.'));
+ $this->assertText($this->node->title, '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', t('Article node is not found with POST query and type:article.'));
+ $this->assertText('bike shed', '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,7 +464,8 @@ 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.');
}
}
@@ -489,7 +490,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);
}
@@ -506,8 +507,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,
);
@@ -555,13 +556,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.'), t('Block configuration set.'));
+ $this->assertText(t('The block configuration has been saved.'), '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.'), t('Block successfully move to footer region.'));
+ $this->assertText(t('The block settings have been updated.'), 'Block successfully move to footer region.');
}
/**
@@ -726,20 +727,20 @@ class SearchCommentTestCase extends DrupalWebTestCase {
'search_block_form' => "'" . $edit_comment['subject'] . "'",
);
$this->drupalPost('', $edit, t('Search'));
- $this->assertText($node->title, t('Node found in search results.'));
- $this->assertText($edit_comment['subject'], t('Comment subject found in search results.'));
+ $this->assertText($node->title, 'Node found in search results.');
+ $this->assertText($edit_comment['subject'], '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, t('Node found in search results.'));
+ $this->assertText($node->title, 'Node found in search results.');
// Verify that comment is rendered using proper format.
- $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.'));
+ $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.');
// Hide comments.
$this->drupalLogin($this->admin_user);
@@ -752,7 +753,7 @@ class SearchCommentTestCase extends DrupalWebTestCase {
// Search for $title.
$this->drupalPost('', $edit, t('Search'));
- $this->assertNoText($comment_body, t('Comment body text not found in search results.'));
+ $this->assertNoText($comment_body, 'Comment body text not found in search results.');
}
/**
@@ -811,7 +812,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);
-
+
}
/**
@@ -848,9 +849,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
@@ -859,7 +860,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',
@@ -876,23 +877,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();
@@ -913,28 +914,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'), 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'));
-
+ $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');
+
// 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'), 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'));
+ $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');
// 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'), 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'));
+ $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');
}
}
@@ -967,7 +968,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), t('Search simplify works for ASCII control characters.'));
+ $this->assertIdentical(' ', search_simplify($string), 'Search simplify works for ASCII control characters.');
}
/**
diff --git a/modules/shortcut/shortcut.test b/modules/shortcut/shortcut.test
index 34ae061..7c64083 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, 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)));
+ $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.');
}
/**
diff --git a/modules/simpletest/tests/actions.test b/modules/simpletest/tests/actions.test
index 8e0220d..5d279da 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.'), 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."));
+ $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.");
// 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.'), 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."));
+ $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.");
// 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)), t('Make sure that we get a delete confirmation message.'));
+ $this->assertRaw(t('Action %action was deleted', array('%action' => $new_action_label)), 'Make sure that we get a delete confirmation message.');
$this->drupalGet('admin/config/system/actions/manage');
- $this->assertNoText($new_action_label, t("Make sure the action label does not appear on the overview page after we've deleted the action."));
+ $this->assertNoText($new_action_label, "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, t('Make sure the action is gone from the database after being deleted.'));
+ $this->assertFalse($exists, '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, t('Expected message %expected, got %message.', array('%expected' => $expected_message, '%message' => $row->message)));
+ $this->assertEqual($row->message, $expected_message, 'Expected message ' . $expected_message . ', got ' . $row->message . '.');
}
- $this->assertTrue(empty($expected), t('All expected messages found.'));
+ $this->assertTrue(empty($expected), 'All expected messages found.');
}
}
diff --git a/modules/simpletest/tests/ajax.test b/modules/simpletest/tests/ajax.test
index 91572bd..e711eec 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', t('drupal_add_js() settings are contained first.'));
+ $this->assertIdentical($result[0]['command'], 'settings', 'drupal_add_js() settings are contained first.');
// Verify that basePath is contained in JavaScript settings.
- $this->assertEqual($result[0]['settings']['basePath'], base_path(), t('Base path is contained in JavaScript settings.'));
+ $this->assertEqual($result[0]['settings']['basePath'], base_path(), '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', 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.'));
+ $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.');
// 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'], t('Custom error message is output.'));
+ $this->assertEqual($result[0]['text'], $edit['message'], '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', t('drupal_add_js() settings are contained first.'));
+ $this->assertIdentical($result[0]['command'], 'settings', 'drupal_add_js() settings are contained first.');
// Verify that the custom setting is contained.
- $this->assertEqual($result[1]['settings']['foo'], 42, t('Custom setting is output.'));
+ $this->assertEqual($result[1]['settings']['foo'], 42, '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, 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->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->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, 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->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->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'), t("No error message in resultant JSON"));
- $this->assertText('ajax_forms_test_validation_form_callback invoked', t('The correct callback was invoked'));
+ $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');
}
}
diff --git a/modules/simpletest/tests/batch.test b/modules/simpletest/tests/batch.test
index 451575c..f14f56b 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), 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.'));
+ $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.');
}
/**
@@ -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'), t('Batch with no operation performed successfully.'));
- $this->assertText('Redirection successful.', t('Redirection after batch execution is correct.'));
+ $this->assertBatchMessages($this->_resultMessages('batch_0'), 'Batch with no operation performed successfully.');
+ $this->assertText('Redirection successful.', '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'), 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.'));
+ $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.');
// Batch 2: one multistep operation.
$edit = array('batch' => 'batch_2');
$this->drupalPost('batch_test/simple', $edit, 'Submit');
- $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.'));
+ $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.');
// Batch 3: simple + multistep combined.
$edit = array('batch' => 'batch_3');
$this->drupalPost('batch_test/simple', $edit, 'Submit');
- $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.'));
+ $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.');
// Batch 4: nested batch.
$edit = array('batch' => 'batch_4');
$this->drupalPost('batch_test/simple', $edit, 'Submit');
- $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.'));
+ $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.');
}
/**
@@ -77,19 +77,19 @@ class BatchProcessingTestCase extends DrupalWebTestCase {
*/
function testBatchFormMultistep() {
$this->drupalGet('batch_test/multistep');
- $this->assertText('step 1', t('Form is displayed in step 1.'));
+ $this->assertText('step 1', 'Form is displayed in step 1.');
// First step triggers batch 1.
$this->drupalPost(NULL, array(), 'Submit');
- $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.'));
+ $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.');
// Second step triggers batch 2.
$this->drupalPost(NULL, array(), 'Submit');
- $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.'));
+ $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.');
}
/**
@@ -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'), t('Batches defined in separate submit handlers performed successfully.'));
+ $this->assertBatchMessages($this->_resultMessages('chained'), '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), t('Execution order was correct, and $form_state is correctly persisted.'));
- $this->assertText('Redirection successful.', t('Redirection after batch execution is correct.'));
+ $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.');
}
/**
@@ -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'), t('Batches defined in separate submit handlers performed successfully.'));
+ $this->assertBatchMessages($this->_resultMessages('chained'), '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), 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.'));
+ $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.');
}
/**
@@ -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), t('drupal_form_submit() ran successfully within a batch operation.'));
+ $this->assertEqual(batch_test_stack(), array('mock form submitted with value = ' . $value), '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'), t('A progressive batch correctly uses the theme of the page that started the batch.'));
+ $this->assertEqual(batch_test_stack(), array('seven'), '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(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)));
+ $this->pass('Expected the batch api percentage at the state ' . $current . '/' . $total . ' to be ' . $expected_result . '%, and got ' . $actual_result . '%.');
}
else {
- $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)));
+ $this->fail('Expected the batch api percentage at the state ' . $current . '/' . $total . ' to be ' . $expected_result . '%, but got ' . $actual_result . '%.');
}
}
}
diff --git a/modules/simpletest/tests/bootstrap.test b/modules/simpletest/tests/bootstrap.test
index d8a9d8c..d41ecf3 100644
--- a/modules/simpletest/tests/bootstrap.test
+++ b/modules/simpletest/tests/bootstrap.test
@@ -42,60 +42,48 @@ class BootstrapIPAddressTestCase extends DrupalWebTestCase {
function testIPAddressHost() {
// Test the normal IP address.
$this->assertTrue(
- ip_address() == $this->remote_ip,
- t('Got remote IP address.')
- );
+ ip_address() == $this->remote_ip, 'Got remote IP address.');
// Proxy forwarding on but no proxy addresses defined.
variable_set('reverse_proxy', 1);
$this->assertTrue(
- ip_address() == $this->remote_ip,
- t('Proxy forwarding without trusted proxies got remote IP address.')
- );
+ ip_address() == $this->remote_ip, '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,
- t('Proxy forwarding with untrusted proxy got remote IP address.')
- );
+ ip_address() == $this->untrusted_ip, '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,
- t('Proxy forwarding with trusted proxy got forwarded IP address.')
- );
+ ip_address() == $this->forwarded_ip, '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,
- t('Proxy forwarding with trusted 2-tier proxy got forwarded IP address.')
- );
+ ip_address() == $this->forwarded_ip, '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,
- t('Cluster environment got cluster client IP.')
- );
+ ip_address() == $this->cluster_ip, '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'), 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'));
+ $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');
// IPv6 loopback address
- $this->assertTrue(drupal_valid_http_host('[::1]:80'), t('HTTP_HOST containing IPv6 loopback is valid'));
+ $this->assertTrue(drupal_valid_http_host('[::1]:80'), 'HTTP_HOST containing IPv6 loopback is valid');
}
}
@@ -123,32 +111,32 @@ class BootstrapPageCacheTestCase extends DrupalWebTestCase {
$this->drupalGet('');
$this->drupalHead('');
- $this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'HIT', t('Page was cached.'));
+ $this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'HIT', '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, t('Conditional request returned 304 Not Modified.'));
+ $this->assertResponse(304, '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, t('Conditional request with obsolete If-Modified-Since date returned 304 Not Modified.'));
+ $this->assertResponse(304, '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, t('Conditional request with obsolete If-Modified-Since date returned 304 Not Modified.'));
+ $this->assertResponse(304, 'Conditional request with obsolete If-Modified-Since date returned 304 Not Modified.');
$this->drupalGet('', array(), array('If-Modified-Since: ' . $last_modified));
- $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->assertResponse(200, 'Conditional request without If-None-Match returned 200 OK.');
+ $this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'HIT', 'Page was cached.');
$this->drupalGet('', array(), array('If-Modified-Since: ' . gmdate(DATE_RFC1123, strtotime($last_modified) + 1), 'If-None-Match: ' . $etag));
- $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.'));
+ $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.');
$user = $this->drupalCreateUser();
$this->drupalLogin($user);
$this->drupalGet('', array(), array('If-Modified-Since: ' . $last_modified, 'If-None-Match: ' . $etag));
- $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.'));
+ $this->assertResponse(200, 'Conditional request returned 200 OK for authenticated user.');
+ $this->assertFalse($this->drupalGetHeader('X-Drupal-Cache'), 'Absense of Page was not cached.');
}
/**
@@ -159,35 +147,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', 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.'));
+ $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.');
// Check cache.
$this->drupalGet('system-test/set-header', array('query' => array('name' => 'Foo', 'value' => 'bar')));
- $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.'));
+ $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.');
// 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', t('Default header was replaced.'));
+ $this->assertEqual($this->drupalGetHeader('Expires'), 'Fri, 19 Nov 2008 05:00:00 GMT', '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', t('Default header was replaced.'));
+ $this->assertEqual($this->drupalGetHeader('Vary'), 'User-Agent,Accept-Encoding', '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'), 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.'));
+ $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.');
}
@@ -203,23 +191,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', t('Page was not cached.'));
+ $this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'MISS', 'Page was not cached.');
$this->drupalSetContent(gzinflate(substr($this->drupalGetContent(), 10, -8)));
- $this->assertRaw('</html>', t('Page was gzip compressed.'));
+ $this->assertRaw('</html>', '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', t('Page was cached.'));
- $this->assertEqual($this->drupalGetHeader('Content-Encoding'), 'gzip', t('A Content-Encoding header was sent.'));
+ $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->drupalSetContent(gzinflate(substr($this->drupalGetContent(), 10, -8)));
- $this->assertRaw('</html>', t('Page was gzip compressed.'));
+ $this->assertRaw('</html>', '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', 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.'));
+ $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.');
}
}
@@ -244,17 +232,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'), t('Setting and retrieving values'));
+ $this->assertIdentical($variable, variable_get('simpletest_bootstrap_variable_test'), 'Setting and retrieving values');
// Make sure the variable persists across multiple requests.
$this->drupalGet('system-test/variable-get');
- $this->assertText($variable, t('Variable persists across multiple requests'));
+ $this->assertText($variable, '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, t('Deleting variables'));
+ $this->assertIdentical($variable, $default_value, 'Deleting variables');
}
/**
@@ -262,10 +250,10 @@ class BootstrapVariableTestCase extends DrupalWebTestCase {
*/
function testVariableDefaults() {
// Tests passing nothing through to the default.
- $this->assertIdentical(NULL, variable_get('simpletest_bootstrap_variable_test'), t('Variables are correctly defaulting to NULL.'));
+ $this->assertIdentical(NULL, variable_get('simpletest_bootstrap_variable_test'), 'Variables are correctly defaulting to NULL.');
// Tests passing 5 to the default parameter.
- $this->assertIdentical(5, variable_get('simpletest_bootstrap_variable_test', 5), t('The default variable parameter is passed through correctly.'));
+ $this->assertIdentical(5, variable_get('simpletest_bootstrap_variable_test', 5), 'The default variable parameter is passed through correctly.');
}
}
@@ -295,29 +283,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, 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.'));
+ $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.');
// 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, 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.'));
+ $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.');
// 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'), t('Page has been cached.'));
+ $this->assertTrue(cache_get(url('', array('absolute' => TRUE)), 'cache_page'), '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, 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.'));
+ $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.');
// Test with page cache cleared, boot and exit should be called.
- $this->assertTrue(db_delete('cache_page')->execute(), t('Page cache cleared.'));
+ $this->assertTrue(db_delete('cache_page')->execute(), '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, 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.'));
+ $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.');
}
}
@@ -343,16 +331,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', t('Retrieve module location.'));
+ $this->assertIdentical(drupal_get_filename('module', 'php'), 'modules/php/php.module', 'Retrieve module location.');
// Retrieving the location of a theme.
- $this->assertIdentical(drupal_get_filename('theme', 'stark'), 'themes/stark/stark.info', t('Retrieve theme location.'));
+ $this->assertIdentical(drupal_get_filename('theme', 'stark'), 'themes/stark/stark.info', 'Retrieve theme location.');
// Retrieving the location of a theme engine.
- $this->assertIdentical(drupal_get_filename('theme_engine', 'phptemplate'), 'themes/engines/phptemplate/phptemplate.engine', t('Retrieve theme engine location.'));
+ $this->assertIdentical(drupal_get_filename('theme_engine', 'phptemplate'), 'themes/engines/phptemplate/phptemplate.engine', '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', t('Retrieve install profile location.'));
+ $this->assertIdentical(drupal_get_filename('profile', 'standard'), 'profiles/standard/standard.profile', 'Retrieve install profile location.');
}
}
@@ -374,17 +362,17 @@ class BootstrapTimerTestCase extends DrupalUnitTestCase {
function testTimer() {
timer_start('test');
sleep(1);
- $this->assertTrue(timer_read('test') >= 1000, t('Timer measured 1 second of sleeping while running.'));
+ $this->assertTrue(timer_read('test') >= 1000, 'Timer measured 1 second of sleeping while running.');
sleep(1);
timer_stop('test');
- $this->assertTrue(timer_read('test') >= 2000, t('Timer measured 2 seconds of sleeping after being stopped.'));
+ $this->assertTrue(timer_read('test') >= 2000, 'Timer measured 2 seconds of sleeping after being stopped.');
timer_start('test');
sleep(1);
- $this->assertTrue(timer_read('test') >= 3000, t('Timer measured 3 seconds of sleeping after being restarted.'));
+ $this->assertTrue(timer_read('test') >= 3000, 'Timer measured 3 seconds of sleeping after being restarted.');
sleep(1);
$timer = timer_stop('test');
- $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.'));
+ $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.');
}
}
@@ -408,21 +396,21 @@ class BootstrapResettableStaticTestCase extends DrupalUnitTestCase {
function testDrupalStatic() {
$name = __CLASS__ . '_' . __METHOD__;
$var = &drupal_static($name, 'foo');
- $this->assertEqual($var, 'foo', t('Variable returned by drupal_static() was set to its default.'));
+ $this->assertEqual($var, 'foo', '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', t('Variable was reset after first invocation of name-specific reset.'));
+ $this->assertEqual($var, 'foo', 'Variable was reset after first invocation of name-specific reset.');
$var = 'bar';
drupal_static_reset($name);
- $this->assertEqual($var, 'foo', t('Variable was reset after second invocation of name-specific reset.'));
+ $this->assertEqual($var, 'foo', 'Variable was reset after second invocation of name-specific reset.');
$var = 'bar';
drupal_static_reset();
- $this->assertEqual($var, 'foo', t('Variable was reset after first invocation of global reset.'));
+ $this->assertEqual($var, 'foo', 'Variable was reset after first invocation of global reset.');
$var = 'bar';
drupal_static_reset();
- $this->assertEqual($var, 'foo', t('Variable was reset after second invocation of global reset.'));
+ $this->assertEqual($var, 'foo', 'Variable was reset after second invocation of global reset.');
}
}
diff --git a/modules/simpletest/tests/cache.test b/modules/simpletest/tests/cache.test
index 0fc9fe2..b45dd85 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, t('Object is saved and restored properly.'));
+ $this->assertTrue(isset($cache->data) && $cache->data == $test_object, '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, t('@type is saved and restored properly.', array('@type' => ucfirst(gettype($var)))));
+ $this->assertTrue(isset($cache->data) && $cache->data === $var, ucfirst(gettype($var)) . ' is saved and restored properly.');
}
}
@@ -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), t('Item 1 is cached.'));
- $this->assertTrue($this->checkCacheExists('item2', $item2), t('Item 2 is cached.'));
+ $this->assertTrue($this->checkCacheExists('item1', $item1), 'Item 1 is cached.');
+ $this->assertTrue($this->checkCacheExists('item2', $item2), '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, t('Item was returned from cache successfully.'));
- $this->assertEqual($items['item2']->data, $item2, t('Item was returned from cache successfully.'));
+ $this->assertEqual($items['item1']->data, $item1, 'Item was returned from cache successfully.');
+ $this->assertEqual($items['item2']->data, $item2, '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, 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.'));
+ $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.');
}
}
@@ -237,17 +237,15 @@ 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(t('Cache was removed after clearing cid.'), 'test_cid_clear');
+ $this->assertCacheRemoved('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),
- t('Two caches were created for checking cid "*" with wildcard false.'));
+ && $this->checkCacheExists('test_cid_clear2', $this->default_value), '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),
- t('Two caches still exists after clearing cid "*" with wildcard false.'));
+ && $this->checkCacheExists('test_cid_clear2', $this->default_value), 'Two caches still exists after clearing cid "*" with wildcard false.');
}
/**
@@ -257,22 +255,18 @@ 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),
- t('Two caches were created for checking cid "*" with wildcard true.'));
+ && $this->checkCacheExists('test_cid_clear2', $this->default_value), '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),
- t('Two caches removed after clearing cid "*" with wildcard true.'));
+ || $this->checkCacheExists('test_cid_clear2', $this->default_value), '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),
- t('Two caches were created for checking cid substring with wildcard true.'));
+ && $this->checkCacheExists('test_cid_clear2', $this->default_value), '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),
- t('Two caches removed after clearing cid substring with wildcard true.'));
+ || $this->checkCacheExists('test_cid_clear2', $this->default_value), 'Two caches removed after clearing cid substring with wildcard true.');
}
/**
@@ -285,17 +279,14 @@ 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),
- t('Three cache entries were created.'));
+ && $this->checkCacheExists('test_cid_clear3', $this->default_value), '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),
- t('Two cache entries removed after clearing with an array.'));
+ || $this->checkCacheExists('test_cid_clear2', $this->default_value), 'Two cache entries removed after clearing with an array.');
- $this->assertTrue($this->checkCacheExists('test_cid_clear3', $this->default_value),
- t('Entry was not cleared from the cache'));
+ $this->assertTrue($this->checkCacheExists('test_cid_clear3', $this->default_value), '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.
@@ -303,13 +294,11 @@ 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),
- t('Two cache entries were created.'));
+ && $this->checkCacheExists('test_cid_clear2', $this->default_value), '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),
- t('All cache entries removed when the array exceeded the cache clear threshold.'));
+ || $this->checkCacheExists('test_cid_clear3', $this->default_value), 'All cache entries removed when the array exceeded the cache clear threshold.');
}
}
@@ -338,14 +327,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), t('The cache bin is empty'));
+ $this->assertTrue(cache_is_empty($this->default_bin), '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), t('The cache bin is not empty'));
+ $this->assertFalse(cache_is_empty($this->default_bin), 'The cache bin is not empty');
// Remove the cached data.
cache_clear_all($this->default_cid, $this->default_bin);
- $this->assertCacheRemoved(t('Cache was removed.'), $this->default_cid);
- $this->assertTrue(cache_is_empty($this->default_bin), t('The cache bin is empty'));
+ $this->assertCacheRemoved('Cache was removed.', $this->default_cid);
+ $this->assertTrue(cache_is_empty($this->default_bin), 'The cache bin is empty');
}
}
diff --git a/modules/simpletest/tests/common.test b/modules/simpletest/tests/common.test
index 35c5bbc..24a6819 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, t('Single array was altered.'));
+ $this->assertEqual($array_copy, $array_expected, '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, t('Single object was altered.'));
+ $this->assertEqual($entity_copy, $entity_expected, '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, 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.'));
+ $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.');
}
}
@@ -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, t('XSS attack @path was filtered', array('@path' => $path)));
+ $this->assertTrue(strpos($link, $sanitized_path) !== FALSE, 'XSS attack ' . $path . ' was filtered');
}
/*
@@ -91,7 +91,7 @@ class CommonURLUnitTest extends DrupalWebTestCase {
*/
function testLActiveClass() {
$link = l($this->randomName(), $_GET['q']);
- $this->assertTrue($this->hasClass($link, 'active'), t('Class @class is present on link to the current page', array('@class' => 'active')));
+ $this->assertTrue($this->hasClass($link, 'active'), 'Class ' . 'active' . ' is present on link to the current page');
}
/**
@@ -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), 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')));
+ $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');
}
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, t("\$_GET['q'] was removed."));
+ $this->assertEqual(drupal_get_query_parameters(), $result, "\$_GET['q'] was removed.");
// Default exclusion.
$result = $original;
unset($result['q']);
- $this->assertEqual(drupal_get_query_parameters($original), $result, t("'q' was removed."));
+ $this->assertEqual(drupal_get_query_parameters($original), $result, "'q' was removed.");
// First-level exclusion.
$result = $original;
unset($result['b']);
- $this->assertEqual(drupal_get_query_parameters($original, array('b')), $result, t("'b' was removed."));
+ $this->assertEqual(drupal_get_query_parameters($original, array('b')), $result, "'b' was removed.");
// Second-level exclusion.
$result = $original;
unset($result['b']['d']);
- $this->assertEqual(drupal_get_query_parameters($original, array('b[d]')), $result, t("'b[d]' was removed."));
+ $this->assertEqual(drupal_get_query_parameters($original, array('b[d]')), $result, "'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, t("'b[e][f]' was removed."));
+ $this->assertEqual(drupal_get_query_parameters($original, array('b[e][f]')), $result, "'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, t("'a', 'b[e]', 'c' were removed."));
+ $this->assertEqual(drupal_get_query_parameters($original, array('a', 'b[e]', 'c')), $result, "'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', 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.'));
+ $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.');
}
/**
@@ -176,7 +176,7 @@ class CommonURLUnitTest extends DrupalWebTestCase {
'query' => array('foo' => 'bar', 'bar' => 'baz', 'baz' => ''),
'fragment' => 'foo',
);
- $this->assertEqual(drupal_parse_url($url), $result, t('Relative URL parsed correctly.'));
+ $this->assertEqual(drupal_parse_url($url), $result, '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, t('Relative URL parsed correctly.'));
+ $this->assertEqual(drupal_parse_url($url), $result, '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, t('Absolute URL parsed correctly.'));
+ $this->assertEqual(drupal_parse_url($url), $result, '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), t('Correctly identified an external URL.'));
+ $this->assertTrue(url_is_external($url), '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, t('External URL parsed correctly.'));
+ $this->assertEqual(drupal_parse_url($url), $result, '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, t('Absolute URL with clean URLs disabled parsed correctly.'));
+ $this->assertEqual(drupal_parse_url($url), $result, '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, t('Relative URL with clean URLs disabled parsed correctly.'));
+ $this->assertEqual(drupal_parse_url($url), $result, '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, t('Relative URL on non-Apache webserver with clean URLs disabled parsed correctly.'));
+ $this->assertEqual(drupal_parse_url($url), $result, '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), t('drupal_parse_url() correctly parsed a forged URL.'));
+ $this->assertFalse(valid_url($parts['path'], TRUE), '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, t('External URL with fragment works without a fragment in $options.'));
+ $this->assertEqual($url, $result, '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, t('External URL fragment is overidden with a custom fragment in $options.'));
+ $this->assertEqual($test_url . '#' . $fragment, $result, '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, t('External URL with query string works without a query string in $options.'));
+ $this->assertEqual($url, $result, '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, t('External URL can be extended with a query string in $options.'));
+ $this->assertEqual($url . '?' . http_build_query($query, '', '&'), $result, '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, t('External URL query string can be extended with a custom query string in $options.'));
+ $this->assertEqual($url . '&' . http_build_query($query, '', '&'), $result, '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, 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.'));
+ $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.');
}
}
@@ -533,11 +533,11 @@ class DrupalTagsHandlingTestCase extends DrupalWebTestCase {
$original = $this->validTags;
foreach ($tags as $tag) {
$key = array_search($tag, $original);
- $this->assertTrue($key, t('Make sure tag %tag shows up in the final tags array (originally %original)', array('%tag' => $tag, '%original' => $key)));
+ $this->assertTrue($key, 'Make sure tag ' . $tag . ' shows up in the final tags array (originally ' . $key . ')');
unset($original[$key]);
}
foreach ($original as $leftover) {
- $this->fail(t('Leftover tag %leftover was left over.', array('%leftover' => $leftover)));
+ $this->fail('Leftover tag ' . $leftover . ' was left over.');
}
}
}
@@ -564,7 +564,7 @@ class CascadingStylesheetsTestCase extends DrupalWebTestCase {
* Check default stylesheets as empty.
*/
function testDefault() {
- $this->assertEqual(array(), drupal_add_css(), t('Default CSS is empty.'));
+ $this->assertEqual(array(), drupal_add_css(), '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, t('Adding a CSS file caches it properly.'));
+ $this->assertEqual($css[$path]['data'], $path, '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', t('Adding an external CSS file caches it properly.'));
+ $this->assertEqual($css[$path]['type'], 'external', '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(), t('Resetting the CSS empties the cache.'));
+ $this->assertEqual(array(), drupal_add_css(), '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, t('Rendered CSS includes the added stylesheet.'));
+ $this->assertTrue(strpos($styles, $css) > 0, '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, t('Rendering an external CSS file.'));
+ $this->assertTrue(strpos($styles, 'href="' . $css) > 0 || strpos($styles, '@import url("' . $css . '")') > 0, '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, t('Rendering preprocessed inline CSS adds it to the page.'));
+ $this->assertEqual(trim($styles), $css_preprocessed, '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, t('Rendering non-preprocessed inline CSS adds it to the page.'));
+ $this->assertTrue(strpos($styles, $css) > 0, '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, t('Inline stylesheets appear in the full page rendering.'));
+ $this->assertRaw($expected, 'Inline stylesheets appear in the full page rendering.');
}
/**
@@ -694,7 +694,7 @@ class CascadingStylesheetsTestCase extends DrupalWebTestCase {
$result = array();
}
- $this->assertIdentical($result, $expected, t('The CSS files are in the expected order.'));
+ $this->assertIdentical($result, $expected, '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, 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.'));
+ $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.');
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, 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.'));
+ $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.');
}
/**
@@ -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, t('CSS is alterable as right to left overrides are added.'));
+ $this->assert(strpos($styles, drupal_get_path('module', 'system') . '/system-rtl.css') !== FALSE, '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, t('Query string was appended correctly to css.'));
+ $this->assertRaw(drupal_get_path('module', 'node') . '/node.css?arg1=value1&amp;arg2=value2&amp;' . $query_string, '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, t('Verify valid ASCII characters pass through.'));
+ $this->assertIdentical(drupal_clean_css_identifier($identifier, array()), $identifier, '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, t('Verify valid UTF-8 characters pass through.'));
+ $this->assertIdentical(drupal_clean_css_identifier($identifier, array()), $identifier, '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', t('Strip invalid characters.'));
+ $this->assertIdentical(drupal_clean_css_identifier('invalid !"#$%&\'()*+,./:;<=>?@[\\]^`{|}~ identifier', array()), 'invalididentifier', '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--ü', t('Enforce Drupal coding standards.'));
+ $this->assertIdentical(drupal_html_class('CLASS NAME_[Ü]'), 'class-name--ü', '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, t('Verify valid characters pass through.'));
+ $this->assertIdentical(drupal_html_id($id), $id, 'Verify valid characters pass through.');
// Verify that invalid characters are stripped from the ID.
- $this->assertIdentical(drupal_html_id('invalid,./:@\\^`{Üidentifier'), 'invalididentifier', t('Strip invalid characters.'));
+ $this->assertIdentical(drupal_html_id('invalid,./:@\\^`{Üidentifier'), 'invalididentifier', 'Strip invalid characters.');
// Verify Drupal coding standards are enforced.
- $this->assertIdentical(drupal_html_id('ID NAME_[1]'), 'id-name-1', t('Enforce Drupal coding standards.'));
+ $this->assertIdentical(drupal_html_id('ID NAME_[1]'), 'id-name-1', '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', 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.'));
+ $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.');
}
}
@@ -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, t('Unoptimized CSS file has expected contents (@file)', array('@file' => $file)));
+ $this->assertEqual($unoptimized_output, $expected, 'Unoptimized CSS file has expected contents (' . $file . ')');
$expected = file_get_contents("$path/$file.optimized.css");
$optimized_output = drupal_load_stylesheet("$path/$file", TRUE);
- $this->assertEqual($optimized_output, $expected, t('Optimized CSS file has expected contents (@file)', array('@file' => $file)));
+ $this->assertEqual($optimized_output, $expected, 'Optimized CSS file has expected contents (' . $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, t('Returned with "-1002" error code.'));
- $this->assertEqual($missing_scheme->error, 'missing schema', t('Returned with "missing schema" error message.'));
+ $this->assertEqual($missing_scheme->code, -1002, 'Returned with "-1002" error code.');
+ $this->assertEqual($missing_scheme->error, 'missing schema', 'Returned with "missing schema" error message.');
$unable_to_parse = drupal_http_request('http:///path');
- $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.'));
+ $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.');
// Fetch page.
$result = drupal_http_request(url('node', array('absolute' => TRUE)));
- $this->assertEqual($result->code, 200, t('Fetched page successfully.'));
+ $this->assertEqual($result->code, 200, 'Fetched page successfully.');
$this->drupalSetContent($result->data);
- $this->assertTitle(t('Welcome to @site-name | @site-name', array('@site-name' => variable_get('site_name', 'Drupal'))), t('Site title matches.'));
+ $this->assertTitle(t('Welcome to @site-name | @site-name', array('@site-name' => variable_get('site_name', 'Drupal'))), '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), 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"'));
+ $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"');
// 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, 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.'));
+ $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.');
}
}
@@ -918,40 +918,40 @@ class DrupalHTTPRequestTestCase extends DrupalWebTestCase {
$result = drupal_http_request($auth);
$this->drupalSetContent($result->data);
- $this->assertRaw($username, t('$_SERVER["PHP_AUTH_USER"] is passed correctly.'));
- $this->assertRaw($password, t('$_SERVER["PHP_AUTH_PW"] is passed correctly.'));
+ $this->assertRaw($username, '$_SERVER["PHP_AUTH_USER"] is passed correctly.');
+ $this->assertRaw($password, '$_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, t('drupal_http_request follows the 301 redirect.'));
+ $this->assertEqual($redirect_301->redirect_code, 301, '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), t('drupal_http_request does not follow 301 redirect if max_redirects = 0.'));
+ $this->assertFalse(isset($redirect_301->redirect_code), '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, 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)));
+ $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 . '".');
$redirect_invalid = drupal_http_request(url('system-test/redirect-noparse', array('absolute' => TRUE)), array('max_redirects' => 1));
- $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)));
+ $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 . '".');
$redirect_invalid = drupal_http_request(url('system-test/redirect-invalid-scheme', array('absolute' => TRUE)), array('max_redirects' => 1));
- $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)));