summaryrefslogtreecommitdiff
path: root/modules/aggregator
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2010-08-03 01:59:18 +0000
committerDries Buytaert <dries@buytaert.net>2010-08-03 01:59:18 +0000
commitb601b26b77de75501b33b3de8ecfe6db965cc61c (patch)
tree3fb8d5b7540923a244fd0619646554f7d9b044ad /modules/aggregator
parentce17e244d46819e08ba7819bd43ea90f0044eaab (diff)
downloadbrdo-b601b26b77de75501b33b3de8ecfe6db965cc61c.tar.gz
brdo-b601b26b77de75501b33b3de8ecfe6db965cc61c.tar.bz2
- Patch #857402 by dman, andypost, cafuego: added test case for aggregator.
Diffstat (limited to 'modules/aggregator')
-rw-r--r--modules/aggregator/aggregator.test61
1 files changed, 61 insertions, 0 deletions
diff --git a/modules/aggregator/aggregator.test b/modules/aggregator/aggregator.test
index b37c0f933..5ef5e75f1 100644
--- a/modules/aggregator/aggregator.test
+++ b/modules/aggregator/aggregator.test
@@ -693,6 +693,67 @@ class AggregatorCronTestCase extends AggregatorTestCase {
}
}
+class AggregatorRenderingTestCase extends AggregatorTestCase {
+ public static function getInfo() {
+ return array(
+ 'name' => 'Checks display of aggregator items',
+ 'description' => 'Checks display of aggregator items on the page.',
+ 'group' => 'Aggregator'
+ );
+ }
+
+ /**
+ * Add a feed block to the page and checks its links.
+ *
+ * TODO: Test the category block as well.
+ */
+ public function testBlockLinks() {
+ // Create feed.
+ $this->createSampleNodes();
+ $feed = $this->createFeed();
+ $this->updateFeedItems($feed, $this->getDefaultFeedItemCount());
+
+ // Place block on page (@see block.test:moveBlockToRegion())
+ // Need admin user to be able to access block admin.
+ $this->admin_user = $this->drupalCreateUser(array(
+ 'administer blocks',
+ 'access administration pages',
+ 'administer news feeds',
+ 'access news feeds',
+ ));
+ $this->drupalLogin($this->admin_user);
+
+ // Prepare to use the block admin form.
+ $block = array(
+ 'module' => 'aggregator',
+ 'delta' => 'feed-' . $feed->fid,
+ 'title' => $feed->title,
+ );
+ $region = 'footer';
+ $edit = array();
+ $edit[$block['module'] . '_' . $block['delta'] . '[region]'] = $region;
+ // Check the feed block is available in the block list form.
+ $this->drupalGet('admin/structure/block');
+ $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)));
+ // 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.'));
+
+ // 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)));
+
+ // 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.'));
+ }
+}
+
/**
* Tests for feed parsing.
*/