- Patch #857402 by dman, andypost, cafuego: added test case for aggregator.
parent
ce17e244d4
commit
b601b26b77
|
@ -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.
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue