Skip to content
Snippets Groups Projects
Commit 2f16b56b authored by Alex Barth's avatar Alex Barth
Browse files

Fix Feeds News tests. add a 'description' field to the Feeds Item content type.

parent 9f755bc1
No related branches found
No related tags found
No related merge requests found
......@@ -3,6 +3,8 @@
Feeds 7.x 2.0 XXXXXXXXXXXXXXXXXXX
---------------------------------
- Fix Feeds News tests, add a 'description' field to the Feeds Item content
type.
- #728534 alex_b: Remove FeedsFeedNodeProcessor. If you have used
FeedsFeedNodeProcessor in the past, use FeedsNodeProcessor (Node Processor)
instead now. It supports all of FeedsFeedNodeProcessor's functionality and
......
......@@ -5,6 +5,7 @@
*/
function feeds_news_feeds_importer_default() {
$export = array();
$feeds_importer = new stdClass;
$feeds_importer->disabled = FALSE; /* Edit this to true to make a default feeds_importer disabled initially */
$feeds_importer->api_version = 1;
......@@ -53,7 +54,7 @@ function feeds_news_feeds_importer_default() {
),
4 => array(
'source' => 'description',
'target' => 'field_body',
'target' => 'field_feed_item_description',
'unique' => FALSE,
),
),
......@@ -66,9 +67,10 @@ function feeds_news_feeds_importer_default() {
'import_period' => '1800',
'expire_period' => 3600,
'import_on_create' => 1,
'process_in_background' => FALSE,
);
$export['feed'] = $feeds_importer;
$feeds_importer = new stdClass;
$feeds_importer->disabled = FALSE; /* Edit this to true to make a default feeds_importer disabled initially */
$feeds_importer->api_version = 1;
......@@ -112,7 +114,7 @@ function feeds_news_feeds_importer_default() {
'expire_period' => 3600,
'import_on_create' => 1,
);
$export['opml'] = $feeds_importer;
return $export;
}
core = "7.x"
dependencies[] = "features"
dependencies[] = "feeds"
dependencies[] = "views"
description = "A news aggregator built with feeds, creates nodes from imported feed items. With OPML import."
features[ctools][] = "feeds:feeds_importer_default:1"
features[feeds_importer][] = "feed"
features[feeds_importer][] = "opml"
features[field][] = "node-feed_item-field_body"
features[field][] = "node-feed_item-field_feed_item_description"
features[node][] = "feed"
features[node][] = "feed_item"
features[views][] = "feeds_defaults_feed_items"
features[views_api][] = "api:3.0-alpha1"
files[] = "feeds_news.module"
files[] = "feeds_news.test"
name = "Feeds News"
package = "Feeds"
php = "5.2.0"
project = "Feeds"
......@@ -6,40 +6,28 @@
* Tests for feeds_news feature.
*/
// Require FeedsWebTestCase class definition.
require_once(dirname(__FILE__) .'/../tests/feeds.test.inc');
/**
* Test Feed configuration.
*/
class FeedsExamplesFeedTestCase extends FeedsWebTestCase {
/**
* Set up test.
*/
public function setUp() {
parent::setUp('feeds', 'feeds_ui', 'ctools', 'job_scheduler', 'features', 'feeds_news');
$this->drupalLogin(
$this->drupalCreateUser(
array(
'administer feeds', 'administer nodes',
)
)
);
}
/**
* Describe this test.
*/
public function getInfo() {
return array(
'name' => t('Feature: Feed'),
'description' => t('Test "Feed" default configuration. <strong>Requires Features.</strong>'),
'description' => t('Test "Feed" default configuration.'),
'group' => t('Feeds'),
);
}
/**
* Enable feeds_news feature.
*/
public function setUp() {
parent::setUp(array('feeds_news'));
}
/**
* Run tests.
*/
......@@ -47,28 +35,28 @@ class FeedsExamplesFeedTestCase extends FeedsWebTestCase {
$nid = $this->createFeedNode('feed', NULL, '', 'feed');
// Assert results.
$count = db_result(db_query("SELECT COUNT(*) FROM {node} WHERE type = 'feed_item'"));
$count = db_query("SELECT COUNT(*) FROM {node} WHERE type = 'feed_item'")->fetchField();
$this->assertEqual($count, 10, 'Found the correct number of feed item nodes in database.');
$count = db_result(db_query("SELECT COUNT(*) FROM {feeds_item} WHERE entity_type = 'node'"));
$count = db_query("SELECT COUNT(*) FROM {feeds_item} WHERE entity_type = 'node'")->fetchField();
$this->assertEqual($count, 10, 'Found the correct number of records in feeds_item.');
$count = db_result(db_query("SELECT COUNT(*) FROM {node} WHERE title = 'Open Atrium Translation Workflow: Two Way Translation Updates'"));
$count = db_query("SELECT COUNT(*) FROM {node} WHERE title = 'Open Atrium Translation Workflow: Two Way Translation Updates'")->fetchField();
$this->assertEqual($count, 1, 'Found title.');
$count = db_result(db_query("SELECT COUNT(*) FROM {node} WHERE title = 'Week in DC Tech: October 5th Edition'"));
$count = db_query("SELECT COUNT(*) FROM {node} WHERE title = 'Week in DC Tech: October 5th Edition'")->fetchField();
$this->assertEqual($count, 1, 'Found title.');
$count = db_result(db_query("SELECT COUNT(*) FROM {node} WHERE title = 'Integrating the Siteminder Access System in an Open Atrium-based Intranet'"));
$count = db_query("SELECT COUNT(*) FROM {node} WHERE title = 'Integrating the Siteminder Access System in an Open Atrium-based Intranet'")->fetchField();
$this->assertEqual($count, 1, 'Found title.');
$count = db_result(db_query("SELECT COUNT(*) FROM {node} WHERE title = 'Scaling the Open Atrium UI'"));
$count = db_query("SELECT COUNT(*) FROM {node} WHERE title = 'Scaling the Open Atrium UI'")->fetchField();
$this->assertEqual($count, 1, 'Found title.');
$count = db_result(db_query("SELECT COUNT(*) FROM {feeds_item} WHERE entity_type = 'node' AND url = 'http://developmentseed.org/blog/2009/oct/06/open-atrium-translation-workflow-two-way-updating'"));
$count = db_query("SELECT COUNT(*) FROM {feeds_item} WHERE entity_type = 'node' AND url = 'http://developmentseed.org/blog/2009/oct/06/open-atrium-translation-workflow-two-way-updating'")->fetchField();
$this->assertEqual($count, 1, 'Found feed_node_item record.');
$count = db_result(db_query("SELECT COUNT(*) FROM {feeds_item} WHERE entity_type = 'node' AND url = 'http://developmentseed.org/blog/2009/oct/05/week-dc-tech-october-5th-edition'"));
$count = db_query("SELECT COUNT(*) FROM {feeds_item} WHERE entity_type = 'node' AND url = 'http://developmentseed.org/blog/2009/oct/05/week-dc-tech-october-5th-edition'")->fetchField();
$this->assertEqual($count, 1, 'Found feed_node_item record.');
$count = db_result(db_query("SELECT COUNT(*) FROM {feeds_item} WHERE entity_type = 'node' AND guid = '974 at http://developmentseed.org'"));
$count = db_query("SELECT COUNT(*) FROM {feeds_item} WHERE entity_type = 'node' AND guid = '974 at http://developmentseed.org'")->fetchField();
$this->assertEqual($count, 1, 'Found feed_node_item record.');
$count = db_result(db_query("SELECT COUNT(*) FROM {feeds_item} WHERE entity_type = 'node' AND guid = '970 at http://developmentseed.org'"));
$count = db_query("SELECT COUNT(*) FROM {feeds_item} WHERE entity_type = 'node' AND guid = '970 at http://developmentseed.org'")->fetchField();
$this->assertEqual($count, 1, 'Found feed_node_item record.');
// Remove all items
......@@ -82,17 +70,17 @@ class FeedsExamplesFeedTestCase extends FeedsWebTestCase {
// Delete and assert all items gone.
$this->drupalPost('node/'. $nid .'/delete-items', array(), 'Delete');
$count = db_result(db_query("SELECT COUNT(*) FROM {node} WHERE type = 'feed_item'"));
$count = db_query("SELECT COUNT(*) FROM {node} WHERE type = 'feed_item'")->fetchField();
$this->assertEqual($count, 0, 'Found the correct number of feed item nodes in database.');
$count = db_result(db_query("SELECT COUNT(*) FROM {feeds_item} WHERE entity_type = 'node'"));
$count = db_query("SELECT COUNT(*) FROM {feeds_item} WHERE entity_type = 'node'")->fetchField();
$this->assertEqual($count, 0, 'Found the correct number of records in feeds_item.');
// Create a batch of nodes.
$this->createFeedNodes('feed', 10, 'feed');
$count = db_result(db_query("SELECT COUNT(*) FROM {node} WHERE type = 'feed_item'"));
$count = db_query("SELECT COUNT(*) FROM {node} WHERE type = 'feed_item'")->fetchField();
$this->assertEqual($count, 100, 'Imported 100 nodes.');
$count = db_result(db_query("SELECT COUNT(*) FROM {feeds_item} WHERE entity_type = 'node'"));
$count = db_query("SELECT COUNT(*) FROM {feeds_item} WHERE entity_type = 'node'")->fetchField();
$this->assertEqual($count, 100, 'Found 100 records in feeds_item.');
}
}
......@@ -101,22 +89,6 @@ class FeedsExamplesFeedTestCase extends FeedsWebTestCase {
* Test OPML import configuration.
*/
class FeedsExamplesOPMLTestCase extends FeedsWebTestCase {
/**
* Set up test.
*/
public function setUp() {
parent::setUp('feeds', 'feeds_ui', 'ctools', 'job_scheduler', 'feeds_news');
$this->drupalLogin(
$this->drupalCreateUser(
array(
'administer feeds', 'administer nodes',
)
)
);
}
/**
* Describe this test.
*/
......@@ -128,6 +100,13 @@ class FeedsExamplesOPMLTestCase extends FeedsWebTestCase {
);
}
/**
* Enable feeds_news feature.
*/
public function setUp() {
parent::setUp(array('feeds_news'));
}
/**
* Run tests.
*/
......@@ -137,7 +116,7 @@ class FeedsExamplesOPMLTestCase extends FeedsWebTestCase {
$file = $this->generateOPML();
$this->importFile('opml', $file);
$this->assertText('Created 3 feed nodes.');
$count = db_result(db_query("SELECT COUNT(*) FROM {feeds_source}"));
$count = db_query("SELECT COUNT(*) FROM {feeds_source}")->fetchField();
$this->assertEqual($count, 4, 'Found correct number of items.');
// Import a feed and then delete all items from it.
......
......@@ -33,19 +33,37 @@ function feeds_news_views_default_views() {
$handler->display->display_options['empty']['text']['empty'] = FALSE;
$handler->display->display_options['empty']['text']['content'] = 'There are no items for this feed at the moment.';
$handler->display->display_options['empty']['text']['format'] = '1';
/* Relationship: Feeds Item: Owner feed */
$handler->display->display_options['relationships']['feed_nid']['id'] = 'feed_nid';
$handler->display->display_options['relationships']['feed_nid']['table'] = 'feeds_node_item';
$handler->display->display_options['relationships']['feed_nid']['field'] = 'feed_nid';
$handler->display->display_options['relationships']['feed_nid']['required'] = 1;
/* Field: Feeds Item: Item URL */
/* Relationship: Feeds item: Owner feed */
$handler->display->display_options['relationships']['feed_nid_1']['id'] = 'feed_nid_1';
$handler->display->display_options['relationships']['feed_nid_1']['table'] = 'feeds_item';
$handler->display->display_options['relationships']['feed_nid_1']['field'] = 'feed_nid';
$handler->display->display_options['relationships']['feed_nid_1']['required'] = 1;
/* Field: Node: Title */
$handler->display->display_options['fields']['title_1']['id'] = 'title_1';
$handler->display->display_options['fields']['title_1']['table'] = 'node';
$handler->display->display_options['fields']['title_1']['field'] = 'title';
$handler->display->display_options['fields']['title_1']['relationship'] = 'feed_nid_1';
$handler->display->display_options['fields']['title_1']['label'] = 'From';
$handler->display->display_options['fields']['title_1']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['title_1']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['title_1']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['title_1']['alter']['trim'] = 0;
$handler->display->display_options['fields']['title_1']['alter']['word_boundary'] = 1;
$handler->display->display_options['fields']['title_1']['alter']['ellipsis'] = 1;
$handler->display->display_options['fields']['title_1']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['title_1']['alter']['html'] = 0;
$handler->display->display_options['fields']['title_1']['hide_empty'] = 0;
$handler->display->display_options['fields']['title_1']['empty_zero'] = 0;
$handler->display->display_options['fields']['title_1']['link_to_node'] = 1;
/* Field: Feeds item: Item URL */
$handler->display->display_options['fields']['url']['id'] = 'url';
$handler->display->display_options['fields']['url']['table'] = 'feeds_node_item';
$handler->display->display_options['fields']['url']['table'] = 'feeds_item';
$handler->display->display_options['fields']['url']['field'] = 'url';
$handler->display->display_options['fields']['url']['label'] = '';
$handler->display->display_options['fields']['url']['exclude'] = TRUE;
$handler->display->display_options['fields']['url']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['url']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['url']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['url']['alter']['trim'] = 0;
$handler->display->display_options['fields']['url']['alter']['word_boundary'] = 1;
$handler->display->display_options['fields']['url']['alter']['ellipsis'] = 1;
......@@ -53,7 +71,7 @@ function feeds_news_views_default_views() {
$handler->display->display_options['fields']['url']['alter']['html'] = 0;
$handler->display->display_options['fields']['url']['hide_empty'] = 0;
$handler->display->display_options['fields']['url']['empty_zero'] = 0;
$handler->display->display_options['fields']['url']['display_as_link'] = 1;
$handler->display->display_options['fields']['url']['display_as_link'] = 0;
/* Field: Node: Title */
$handler->display->display_options['fields']['title']['id'] = 'title';
$handler->display->display_options['fields']['title']['table'] = 'node';
......@@ -62,6 +80,7 @@ function feeds_news_views_default_views() {
$handler->display->display_options['fields']['title']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['title']['alter']['make_link'] = 1;
$handler->display->display_options['fields']['title']['alter']['path'] = '[url]';
$handler->display->display_options['fields']['title']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['title']['alter']['prefix'] = '<h2>';
$handler->display->display_options['fields']['title']['alter']['suffix'] = '</h2>';
$handler->display->display_options['fields']['title']['alter']['trim'] = 0;
......@@ -72,40 +91,9 @@ function feeds_news_views_default_views() {
$handler->display->display_options['fields']['title']['hide_empty'] = 0;
$handler->display->display_options['fields']['title']['empty_zero'] = 0;
$handler->display->display_options['fields']['title']['link_to_node'] = 0;
/* Field: Node: Title */
$handler->display->display_options['fields']['title_1']['id'] = 'title_1';
$handler->display->display_options['fields']['title_1']['table'] = 'node';
$handler->display->display_options['fields']['title_1']['field'] = 'title';
$handler->display->display_options['fields']['title_1']['relationship'] = 'feed_nid';
$handler->display->display_options['fields']['title_1']['label'] = '';
$handler->display->display_options['fields']['title_1']['exclude'] = TRUE;
$handler->display->display_options['fields']['title_1']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['title_1']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['title_1']['alter']['trim'] = 0;
$handler->display->display_options['fields']['title_1']['alter']['word_boundary'] = 1;
$handler->display->display_options['fields']['title_1']['alter']['ellipsis'] = 1;
$handler->display->display_options['fields']['title_1']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['title_1']['alter']['html'] = 0;
$handler->display->display_options['fields']['title_1']['hide_empty'] = 0;
$handler->display->display_options['fields']['title_1']['empty_zero'] = 0;
$handler->display->display_options['fields']['title_1']['link_to_node'] = 1;
/* Field: Global: Custom text */
$handler->display->display_options['fields']['nothing']['id'] = 'nothing';
$handler->display->display_options['fields']['nothing']['table'] = 'views';
$handler->display->display_options['fields']['nothing']['field'] = 'nothing';
$handler->display->display_options['fields']['nothing']['label'] = '';
$handler->display->display_options['fields']['nothing']['alter']['text'] = 'From [title_1]';
$handler->display->display_options['fields']['nothing']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['nothing']['alter']['trim'] = 0;
$handler->display->display_options['fields']['nothing']['alter']['word_boundary'] = 1;
$handler->display->display_options['fields']['nothing']['alter']['ellipsis'] = 1;
$handler->display->display_options['fields']['nothing']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['nothing']['alter']['html'] = 0;
$handler->display->display_options['fields']['nothing']['hide_empty'] = 0;
$handler->display->display_options['fields']['nothing']['empty_zero'] = 0;
/* Field: Fields: field_body */
/* Field: Fields: field_feed_item_description */
$handler->display->display_options['fields']['entity_id']['id'] = 'entity_id';
$handler->display->display_options['fields']['entity_id']['table'] = 'field_data_field_body';
$handler->display->display_options['fields']['entity_id']['table'] = 'field_data_field_feed_item_description';
$handler->display->display_options['fields']['entity_id']['field'] = 'entity_id';
$handler->display->display_options['fields']['entity_id']['label'] = '';
$handler->display->display_options['fields']['entity_id']['alter']['alter_text'] = 0;
......@@ -116,7 +104,7 @@ function feeds_news_views_default_views() {
$handler->display->display_options['fields']['entity_id']['alter']['ellipsis'] = 1;
$handler->display->display_options['fields']['entity_id']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['entity_id']['alter']['html'] = 0;
$handler->display->display_options['fields']['entity_id']['hide_empty'] = 1;
$handler->display->display_options['fields']['entity_id']['hide_empty'] = 0;
$handler->display->display_options['fields']['entity_id']['empty_zero'] = 0;
/* Field: Node: Edit link */
$handler->display->display_options['fields']['edit_node']['id'] = 'edit_node';
......@@ -125,6 +113,7 @@ function feeds_news_views_default_views() {
$handler->display->display_options['fields']['edit_node']['label'] = '';
$handler->display->display_options['fields']['edit_node']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['edit_node']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['edit_node']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['edit_node']['alter']['trim'] = 0;
$handler->display->display_options['fields']['edit_node']['alter']['word_boundary'] = 1;
$handler->display->display_options['fields']['edit_node']['alter']['ellipsis'] = 1;
......@@ -137,7 +126,7 @@ function feeds_news_views_default_views() {
$handler->display->display_options['arguments']['nid']['id'] = 'nid';
$handler->display->display_options['arguments']['nid']['table'] = 'node';
$handler->display->display_options['arguments']['nid']['field'] = 'nid';
$handler->display->display_options['arguments']['nid']['relationship'] = 'feed_nid';
$handler->display->display_options['arguments']['nid']['relationship'] = 'feed_nid_1';
$handler->display->display_options['arguments']['nid']['default_action'] = 'empty';
$handler->display->display_options['arguments']['nid']['style_plugin'] = 'default_summary';
$handler->display->display_options['arguments']['nid']['title'] = 'Articles from %1';
......@@ -155,24 +144,6 @@ function feeds_news_views_default_views() {
/* Display: Page */
$handler = $view->new_display('page', 'Page', 'page_1');
$handler->display->display_options['defaults']['arguments'] = FALSE;
/* Argument: Node: Nid */
$handler->display->display_options['arguments']['nid']['id'] = 'nid';
$handler->display->display_options['arguments']['nid']['table'] = 'node';
$handler->display->display_options['arguments']['nid']['field'] = 'nid';
$handler->display->display_options['arguments']['nid']['relationship'] = 'feed_nid';
$handler->display->display_options['arguments']['nid']['default_action'] = 'empty';
$handler->display->display_options['arguments']['nid']['style_plugin'] = 'default_summary';
$handler->display->display_options['arguments']['nid']['title'] = 'All items from %1';
$handler->display->display_options['arguments']['nid']['default_argument_type'] = 'fixed';
$handler->display->display_options['arguments']['nid']['validate_type'] = 'node';
$handler->display->display_options['arguments']['nid']['validate_options']['types'] = array(
'feed' => 'feed',
'feed_item' => 0,
'article' => 0,
);
$handler->display->display_options['arguments']['nid']['break_phrase'] = 0;
$handler->display->display_options['arguments']['nid']['not'] = 0;
$handler->display->display_options['path'] = 'node/%/feed-items';
$handler->display->display_options['menu']['type'] = 'tab';
$handler->display->display_options['menu']['title'] = 'View items';
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment