Commit 22d46a60 authored by webchick's avatar webchick

Issue #1940306 by dawehner: Convert the node RSS feed to a display of the frontpage view.

parent 7690b07b
......@@ -81,9 +81,10 @@ public function testBlockLinks() {
public function testFeedPage() {
// Increase the number of items published in the rss.xml feed so we have
// enough articles to test paging.
$config = config('system.rss');
$config->set('items.limit', 30);
$config->save();
$view = entity_load('view', 'frontpage');
$display = &$view->getDisplay('feed_1');
$display['display_options']['pager']['options']['items_per_page'] = 30;
$view->save();
// Create a feed with 30 items.
$this->createSampleNodes(30);
......@@ -94,9 +95,5 @@ public function testFeedPage() {
$this->drupalGet('aggregator/sources/' . $feed->id());
$elements = $this->xpath("//ul[@class=:class]", array(':class' => 'pager'));
$this->assertTrue(!empty($elements), 'Individual source page contains a pager.');
// Reset the number of items in rss.xml to the default value.
$config->set('items.limit', 10);
$config->save();
}
}
......@@ -20,7 +20,7 @@ abstract class AggregatorTestBase extends WebTestBase {
*
* @var array
*/
public static $modules = array('node', 'aggregator', 'aggregator_test');
public static $modules = array('node', 'aggregator', 'aggregator_test', 'views');
function setUp() {
parent::setUp();
......
......@@ -11,6 +11,14 @@
* Tests for Comment module integration with RSS feeds.
*/
class CommentRssTest extends CommentTestBase {
/**
* Modules to enable.
*
* @var array
*/
public static $modules = array('views');
public static function getInfo() {
return array(
'name' => 'Comment RSS',
......
......@@ -12,6 +12,13 @@
*/
class FileFieldRSSContentTest extends FileFieldTestBase {
/**
* Modules to enable.
*
* @var array
*/
public static $modules = array('node', 'views');
public static function getInfo() {
return array(
'name' => 'File field RSS content',
......
langcode: en
status: '1'
base_field: nid
base_table: node
core: 8.x
description: 'A list of nodes marked for display on the front page.'
status: '1'
display:
default:
display_options:
......@@ -138,8 +137,19 @@ display:
display_title: Page
id: page_1
position: { }
feed_1:
display_plugin: feed
id: feed_1
display_title: Feed
position: ''
display_options:
sitename_title: '1'
path: rss.xml
displays:
page_1: page_1
default: '0'
human_name: Frontpage
langcode: und
module: node
id: frontpage
tag: ''
langcode: en
<?php
/**
* @file
* Definition of Drupal\node\Tests\NodeFeedTest.
*/
namespace Drupal\node\Tests;
use Drupal\simpletest\WebTestBase;
/**
* Test the node_feed() functionality.
*/
class NodeFeedTest extends WebTestBase {
public static function getInfo() {
return array(
'name' => 'Node feed',
'description' => 'Ensures that node_feed() functions correctly.',
'group' => 'Node',
);
}
/**
* Ensures that node_feed() accepts and prints extra channel elements.
*/
function testNodeFeedExtraChannelElements() {
$response = node_feed(array(), array('copyright' => 'Drupal is a registered trademark of Dries Buytaert.'));
$this->assertTrue(strpos($response->getContent(), '<copyright>Drupal is a registered trademark of Dries Buytaert.</copyright>') !== FALSE);
}
}
......@@ -21,7 +21,7 @@ class NodeRSSContentTest extends NodeTestBase {
*
* @var array
*/
public static $modules = array('node_test');
public static $modules = array('node_test', 'views');
public static function getInfo() {
return array(
......
......@@ -1719,15 +1719,6 @@ function node_menu() {
'access callback' => '_node_add_access',
'file' => 'node.pages.inc',
);
$items['rss.xml'] = array(
'title' => 'RSS feed',
'page callback' => 'node_feed',
// Pass a FALSE and array argument to ensure that additional path components
// are not passed to node_feed().
'page arguments' => array(FALSE, array()),
'access arguments' => array('access content'),
'type' => MENU_CALLBACK,
);
$items['node/add/%node_type'] = array(
'title callback' => 'node_type_get_clean_name',
'title arguments' => array(2),
......@@ -2075,6 +2066,9 @@ function node_block_access($block) {
* @link http://cyber.law.harvard.edu/rss/rss.html RSS 2.0 Specification. @endlink
* The link should be an absolute URL.
*
* @todo Convert taxonomy_term_feed() to a view, so this method is not needed
* anymore.
*
* @return Symfony\Component\HttpFoundation\Response
* A response object.
*
......
......@@ -2,4 +2,4 @@ channel:
description: ''
items:
limit: '10'
view_mode: fulltext
view_mode: rss
......@@ -17,7 +17,7 @@ class RssTest extends TaxonomyTestBase {
*
* @var array
*/
public static $modules = array('node', 'field_ui');
public static $modules = array('node', 'field_ui', 'views');
public static function getInfo() {
return array(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment