diff options
Diffstat (limited to 'modules/aggregator/aggregator.test')
-rw-r--r-- | modules/aggregator/aggregator.test | 106 |
1 files changed, 53 insertions, 53 deletions
diff --git a/modules/aggregator/aggregator.test b/modules/aggregator/aggregator.test index eb0343afb..160f8ba6a 100644 --- a/modules/aggregator/aggregator.test +++ b/modules/aggregator/aggregator.test @@ -26,10 +26,10 @@ class AggregatorTestCase extends DrupalWebTestCase { function createFeed($feed_url = NULL) { $edit = $this->getFeedEditArray($feed_url); $this->drupalPost('admin/config/services/aggregator/add/feed', $edit, t('Save')); - $this->assertRaw(t('The feed %name has been added.', array('%name' => $edit['title'])), 'The feed ' . $edit['title'] . ' has been added.'); + $this->assertRaw(t('The feed %name has been added.', array('%name' => $edit['title'])), t('The feed !name has been added.', array('!name' => $edit['title']))); $feed = db_query("SELECT * FROM {aggregator_feed} WHERE title = :title AND url = :url", array(':title' => $edit['title'], ':url' => $edit['url']))->fetch(); - $this->assertTrue(!empty($feed), 'The feed found in database.'); + $this->assertTrue(!empty($feed), t('The feed found in database.')); return $feed; } @@ -41,7 +41,7 @@ class AggregatorTestCase extends DrupalWebTestCase { */ function deleteFeed($feed) { $this->drupalPost('admin/config/services/aggregator/edit/feed/' . $feed->fid, array(), t('Delete')); - $this->assertRaw(t('The feed %title has been deleted.', array('%title' => $feed->title)), 'Feed deleted successfully.'); + $this->assertRaw(t('The feed %title has been deleted.', array('%title' => $feed->title)), t('Feed deleted successfully.')); } /** @@ -91,7 +91,7 @@ class AggregatorTestCase extends DrupalWebTestCase { function updateFeedItems(&$feed, $expected_count) { // First, let's ensure we can get to the rss xml. $this->drupalGet($feed->url); - $this->assertResponse(200, $feed->url . ' is reachable.'); + $this->assertResponse(200, t('!url is reachable.', array('!url' => $feed->url))); // Refresh the feed (simulated link click). $this->drupalGet('admin/config/services/aggregator/update/' . $feed->fid); @@ -104,7 +104,7 @@ class AggregatorTestCase extends DrupalWebTestCase { $feed->items[] = $item->iid; } $feed->item_count = count($feed->items); - $this->assertEqual($expected_count, $feed->item_count, 'Total items in feed equal to the total items in database (' . $expected_count . ' != ' . $feed->item_count . ')'); + $this->assertEqual($expected_count, $feed->item_count, t('Total items in feed equal to the total items in database (!val1 != !val2)', array('!val1' => $expected_count, '!val2' => $feed->item_count))); } /** @@ -115,7 +115,7 @@ class AggregatorTestCase extends DrupalWebTestCase { */ function removeFeedItems($feed) { $this->drupalPost('admin/config/services/aggregator/remove/' . $feed->fid, array(), t('Remove items')); - $this->assertRaw(t('The news items from %title have been removed.', array('%title' => $feed->title)), 'Feed items removed.'); + $this->assertRaw(t('The news items from %title have been removed.', array('%title' => $feed->title)), t('Feed items removed.')); } /** @@ -295,15 +295,15 @@ class AddFeedTestCase extends AggregatorTestCase { $feed = $this->createFeed(); // Check feed data. - $this->assertEqual($this->getUrl(), url('admin/config/services/aggregator/add/feed', array('absolute' => TRUE)), 'Directed to correct url.'); - $this->assertTrue($this->uniqueFeed($feed->title, $feed->url), 'The feed is unique.'); + $this->assertEqual($this->getUrl(), url('admin/config/services/aggregator/add/feed', array('absolute' => TRUE)), t('Directed to correct url.')); + $this->assertTrue($this->uniqueFeed($feed->title, $feed->url), t('The feed is unique.')); // Check feed source. $this->drupalGet('aggregator/sources/' . $feed->fid); - $this->assertResponse(200, 'Feed source exists.'); - $this->assertText($feed->title, 'Page title'); + $this->assertResponse(200, t('Feed source exists.')); + $this->assertText($feed->title, t('Page title')); $this->drupalGet('aggregator/sources/' . $feed->fid . '/categorize'); - $this->assertResponse(200, 'Feed categorization page exists.'); + $this->assertResponse(200, t('Feed categorization page exists.')); // Delete feed. $this->deleteFeed($feed); @@ -327,11 +327,11 @@ class CategorizeFeedTestCase extends AggregatorTestCase { // Create 2 categories. $category_1 = array('title' => $this->randomName(10), 'description' => ''); $this->drupalPost('admin/config/services/aggregator/add/category', $category_1, t('Save')); - $this->assertRaw(t('The category %title has been added.', array('%title' => $category_1['title'])), 'The category ' . $category_1['title'] . ' has been added.'); + $this->assertRaw(t('The category %title has been added.', array('%title' => $category_1['title'])), t('The category %title has been added.', array('%title' => $category_1['title']))); $category_2 = array('title' => $this->randomName(10), 'description' => ''); $this->drupalPost('admin/config/services/aggregator/add/category', $category_2, t('Save')); - $this->assertRaw(t('The category %title has been added.', array('%title' => $category_2['title'])), 'The category ' . $category_2['title'] . ' has been added.'); + $this->assertRaw(t('The category %title has been added.', array('%title' => $category_2['title'])), t('The category %title has been added.', array('%title' => $category_2['title']))); // Get categories from database. $categories = $this->getCategories(); @@ -349,7 +349,7 @@ class CategorizeFeedTestCase extends AggregatorTestCase { // Assert the feed has two categories. $this->getFeedCategories($db_feed); - $this->assertEqual(count($db_feed->categories), 2, 'Feed has 2 categories'); + $this->assertEqual(count($db_feed->categories), 2, t('Feed has 2 categories')); } } @@ -377,16 +377,16 @@ class UpdateFeedTestCase extends AggregatorTestCase { $edit[$same_field] = $feed->{$same_field}; } $this->drupalPost('admin/config/services/aggregator/edit/feed/' . $feed->fid, $edit, t('Save')); - $this->assertRaw(t('The feed %name has been updated.', array('%name' => $edit['title'])), 'The feed ' . $edit['title'] . ' has been updated.'); + $this->assertRaw(t('The feed %name has been updated.', array('%name' => $edit['title'])), t('The feed %name has been updated.', array('%name' => $edit['title']))); // Check feed data. $this->assertEqual($this->getUrl(), url('admin/config/services/aggregator/', array('absolute' => TRUE))); - $this->assertTrue($this->uniqueFeed($edit['title'], $edit['url']), 'The feed is unique.'); + $this->assertTrue($this->uniqueFeed($edit['title'], $edit['url']), t('The feed is unique.')); // Check feed source. $this->drupalGet('aggregator/sources/' . $feed->fid); - $this->assertResponse(200, 'Feed source exists.'); - $this->assertText($edit['title'], 'Page title'); + $this->assertResponse(200, t('Feed source exists.')); + $this->assertText($edit['title'], t('Page title')); // Delete feed. $feed->title = $edit['title']; // Set correct title so deleteFeed() will work. @@ -415,11 +415,11 @@ class RemoveFeedTestCase extends AggregatorTestCase { // Check feed source. $this->drupalGet('aggregator/sources/' . $feed->fid); - $this->assertResponse(404, 'Deleted feed source does not exists.'); + $this->assertResponse(404, t('Deleted feed source does not exists.')); // Check database for feed. $result = db_query("SELECT COUNT(*) FROM {aggregator_feed} WHERE title = :title AND url = :url", array(':title' => $feed->title, ':url' => $feed->url))->fetchField(); - $this->assertFalse($result, 'Feed not found in database'); + $this->assertFalse($result, t('Feed not found in database')); } } @@ -455,10 +455,10 @@ class UpdateFeedItemTestCase extends AggregatorTestCase { ); $this->drupalGet($edit['url']); - $this->assertResponse(array(200), 'URL ' . $edit['url'] . ' is accessible'); + $this->assertResponse(array(200), t('URL !url is accessible', array('!url' => $edit['url']))); $this->drupalPost('admin/config/services/aggregator/add/feed', $edit, t('Save')); - $this->assertRaw(t('The feed %name has been added.', array('%name' => $edit['title'])), 'The feed ' . $edit['title'] . ' has been added.'); + $this->assertRaw(t('The feed %name has been added.', array('%name' => $edit['title'])), t('The feed !name has been added.', array('!name' => $edit['title']))); $feed = db_query("SELECT * FROM {aggregator_feed} WHERE url = :url", array(':url' => $edit['url']))->fetchObject(); $this->drupalGet('admin/config/services/aggregator/update/' . $feed->fid); @@ -480,7 +480,7 @@ class UpdateFeedItemTestCase extends AggregatorTestCase { $after = db_query('SELECT timestamp FROM {aggregator_item} WHERE fid = :fid', array(':fid' => $feed->fid))->fetchField(); - $this->assertTrue($before === $after, 'Publish timestamp of feed item was not updated (' . $before . ' === ' . $after . ')'); + $this->assertTrue($before === $after, t('Publish timestamp of feed item was not updated (!before === !after)', array('!before' => $before, '!after' => $after))); } } @@ -541,14 +541,14 @@ class CategorizeFeedItemTestCase extends AggregatorTestCase { // Simulate form submission on "admin/config/services/aggregator/add/category". $edit = array('title' => $this->randomName(10), 'description' => ''); $this->drupalPost('admin/config/services/aggregator/add/category', $edit, t('Save')); - $this->assertRaw(t('The category %title has been added.', array('%title' => $edit['title'])), 'The category ' . $edit['title'] . ' has been added.'); + $this->assertRaw(t('The category %title has been added.', array('%title' => $edit['title'])), t('The category %title has been added.', array('%title' => $edit['title']))); $category = db_query("SELECT * FROM {aggregator_category} WHERE title = :title", array(':title' => $edit['title']))->fetch(); - $this->assertTrue(!empty($category), 'The category found in database.'); + $this->assertTrue(!empty($category), t('The category found in database.')); $link_path = 'aggregator/categories/' . $category->cid; $menu_link = db_query("SELECT * FROM {menu_links} WHERE link_path = :link_path", array(':link_path' => $link_path))->fetch(); - $this->assertTrue(!empty($menu_link), 'The menu link associated with the category found in database.'); + $this->assertTrue(!empty($menu_link), t('The menu link associated with the category found in database.')); $feed = $this->createFeed(); db_insert('aggregator_category_feed') @@ -559,7 +559,7 @@ class CategorizeFeedItemTestCase extends AggregatorTestCase { ->execute(); $this->updateFeedItems($feed, $this->getDefaultFeedItemCount()); $this->getFeedCategories($feed); - $this->assertTrue(!empty($feed->categories), 'The category found in the feed.'); + $this->assertTrue(!empty($feed->categories), t('The category found in the feed.')); // For each category of a feed, ensure feed items have that category, too. if (!empty($feed->categories) && !empty($feed->items)) { @@ -570,7 +570,7 @@ class CategorizeFeedItemTestCase extends AggregatorTestCase { ->execute() ->fetchField(); - $this->assertEqual($feed->item_count, $categorized_count, 'Total items in feed equal to the total categorized feed items in database'); + $this->assertEqual($feed->item_count, $categorized_count, t('Total items in feed equal to the total categorized feed items in database')); } } @@ -603,11 +603,11 @@ class ImportOPMLTestCase extends AggregatorTestCase { ->execute(); $this->drupalGet('admin/config/services/aggregator/add/opml'); - $this->assertText('A single OPML document may contain a collection of many feeds.', 'Looking for help text.'); - $this->assertFieldByName('files[upload]', '', 'Looking for file upload field.'); - $this->assertFieldByName('remote', '', 'Looking for remote URL field.'); - $this->assertFieldByName('refresh', '', 'Looking for refresh field.'); - $this->assertFieldByName("category[$cid]", $cid, 'Looking for category field.'); + $this->assertText('A single OPML document may contain a collection of many feeds.', t('Looking for help text.')); + $this->assertFieldByName('files[upload]', '', t('Looking for file upload field.')); + $this->assertFieldByName('remote', '', t('Looking for remote URL field.')); + $this->assertFieldByName('refresh', '', t('Looking for refresh field.')); + $this->assertFieldByName("category[$cid]", $cid, t('Looking for category field.')); } /** @@ -618,7 +618,7 @@ class ImportOPMLTestCase extends AggregatorTestCase { $edit = array(); $this->drupalPost('admin/config/services/aggregator/add/opml', $edit, t('Import')); - $this->assertRaw(t('You must <em>either</em> upload a file or enter a URL.'), 'Error if no fields are filled.'); + $this->assertRaw(t('You must <em>either</em> upload a file or enter a URL.'), t('Error if no fields are filled.')); $path = $this->getEmptyOpml(); $edit = array( @@ -626,14 +626,14 @@ class ImportOPMLTestCase extends AggregatorTestCase { 'remote' => file_create_url($path), ); $this->drupalPost('admin/config/services/aggregator/add/opml', $edit, t('Import')); - $this->assertRaw(t('You must <em>either</em> upload a file or enter a URL.'), 'Error if both fields are filled.'); + $this->assertRaw(t('You must <em>either</em> upload a file or enter a URL.'), t('Error if both fields are filled.')); $edit = array('remote' => 'invalidUrl://empty'); $this->drupalPost('admin/config/services/aggregator/add/opml', $edit, t('Import')); - $this->assertText(t('This URL is not valid.'), 'Error if the URL is invalid.'); + $this->assertText(t('This URL is not valid.'), t('Error if the URL is invalid.')); $after = db_query('SELECT COUNT(*) FROM {aggregator_feed}')->fetchField(); - $this->assertEqual($before, $after, 'No feeds were added during the three last form submissions.'); + $this->assertEqual($before, $after, t('No feeds were added during the three last form submissions.')); } /** @@ -644,14 +644,14 @@ class ImportOPMLTestCase extends AggregatorTestCase { $form['files[upload]'] = $this->getInvalidOpml(); $this->drupalPost('admin/config/services/aggregator/add/opml', $form, t('Import')); - $this->assertText(t('No new feed has been added.'), 'Attempting to upload invalid XML.'); + $this->assertText(t('No new feed has been added.'), t('Attempting to upload invalid XML.')); $edit = array('remote' => file_create_url($this->getEmptyOpml())); $this->drupalPost('admin/config/services/aggregator/add/opml', $edit, t('Import')); - $this->assertText(t('No new feed has been added.'), 'Attempting to load empty OPML from remote URL.'); + $this->assertText(t('No new feed has been added.'), t('Attempting to load empty OPML from remote URL.')); $after = db_query('SELECT COUNT(*) FROM {aggregator_feed}')->fetchField(); - $this->assertEqual($before, $after, 'No feeds were added during the two last form submissions.'); + $this->assertEqual($before, $after, t('No feeds were added during the two last form submissions.')); db_delete('aggregator_feed')->execute(); db_delete('aggregator_category')->execute(); @@ -675,11 +675,11 @@ class ImportOPMLTestCase extends AggregatorTestCase { 'category[1]' => $category, ); $this->drupalPost('admin/config/services/aggregator/add/opml', $edit, t('Import')); - $this->assertRaw(t('A feed with the URL %url already exists.', array('%url' => $feeds[0]['url'])), 'Verifying that a duplicate URL was identified'); - $this->assertRaw(t('A feed named %title already exists.', array('%title' => $feeds[1]['title'])), 'Verifying that a duplicate title was identified'); + $this->assertRaw(t('A feed with the URL %url already exists.', array('%url' => $feeds[0]['url'])), t('Verifying that a duplicate URL was identified')); + $this->assertRaw(t('A feed named %title already exists.', array('%title' => $feeds[1]['title'])), t('Verifying that a duplicate title was identified')); $after = db_query('SELECT COUNT(*) FROM {aggregator_feed}')->fetchField(); - $this->assertEqual($after, 2, 'Verifying that two distinct feeds were added.'); + $this->assertEqual($after, 2, t('Verifying that two distinct feeds were added.')); $feeds_from_db = db_query("SELECT f.title, f.url, f.refresh, cf.cid FROM {aggregator_feed} f LEFT JOIN {aggregator_category_feed} cf ON f.fid = cf.fid"); $refresh = $category = TRUE; @@ -690,10 +690,10 @@ class ImportOPMLTestCase extends AggregatorTestCase { $refresh = $refresh && $feed->refresh == 900; } - $this->assertEqual($title[$feeds[0]['url']], $feeds[0]['title'], 'First feed was added correctly.'); - $this->assertEqual($url[$feeds[1]['title']], $feeds[1]['url'], 'Second feed was added correctly.'); - $this->assertTrue($refresh, 'Refresh times are correct.'); - $this->assertTrue($category, 'Categories are correct.'); + $this->assertEqual($title[$feeds[0]['url']], $feeds[0]['title'], t('First feed was added correctly.')); + $this->assertEqual($url[$feeds[1]['title']], $feeds[1]['url'], t('Second feed was added correctly.')); + $this->assertTrue($refresh, t('Refresh times are correct.')); + $this->assertTrue($category, t('Categories are correct.')); } function testOPMLImport() { @@ -793,20 +793,20 @@ class AggregatorRenderingTestCase extends AggregatorTestCase { $this->assertFieldByName($block['module'] . '_' . $block['delta'] . '[region]', '', 'Aggregator feed block is available for positioning.'); // Position it. $this->drupalPost('admin/structure/block', $edit, t('Save blocks')); - $this->assertText(t('The block settings have been updated.'), 'Block successfully moved to ' . $region . ' region.'); + $this->assertText(t('The block settings have been updated.'), t('Block successfully moved to %region_name region.', array( '%region_name' => $region))); // Confirm that the block is now being displayed on pages. $this->drupalGet('node'); - $this->assertText(t($block['title']), 'Feed block is displayed on the page.'); + $this->assertText(t($block['title']), t('Feed block is displayed on the page.')); // Find the expected read_more link. $href = 'aggregator/sources/' . $feed->fid; $links = $this->xpath('//a[@href = :href]', array(':href' => url($href))); - $this->assert(isset($links[0]), 'Link to href ' . $href . ' found.'); + $this->assert(isset($links[0]), t('Link to href %href found.', array('%href' => $href))); // Visit that page. $this->drupalGet($href); $correct_titles = $this->xpath('//h1[normalize-space(text())=:title]', array(':title' => $feed->title)); - $this->assertFalse(empty($correct_titles), 'Aggregator feed page is available and has the correct title.'); + $this->assertFalse(empty($correct_titles), t('Aggregator feed page is available and has the correct title.')); } } @@ -837,7 +837,7 @@ class FeedParserTestCase extends AggregatorTestCase { $feed = $this->createFeed($this->getRSS091Sample()); aggregator_refresh($feed); $this->drupalGet('aggregator/sources/' . $feed->fid); - $this->assertResponse(200, 'Feed ' . $feed->title . ' exists.'); + $this->assertResponse(200, t('Feed %name exists.', array('%name' => $feed->title))); $this->assertText('First example feed item title'); $this->assertLinkByHref('http://example.com/example-turns-one'); $this->assertText('First example feed item description.'); @@ -850,7 +850,7 @@ class FeedParserTestCase extends AggregatorTestCase { $feed = $this->createFeed($this->getAtomSample()); aggregator_refresh($feed); $this->drupalGet('aggregator/sources/' . $feed->fid); - $this->assertResponse(200, 'Feed ' . $feed->title . ' exists.'); + $this->assertResponse(200, t('Feed %name exists.', array('%name' => $feed->title))); $this->assertText('Atom-Powered Robots Run Amok'); $this->assertLinkByHref('http://example.org/2003/12/13/atom03'); $this->assertText('Some text.'); |