You are here

public function FeedsWebTestCase::editFeedNode in Feeds 7

Same name and namespace in other branches
  1. 6 tests/feeds.test \FeedsWebTestCase::editFeedNode()
  2. 7.2 tests/feeds.test \FeedsWebTestCase::editFeedNode()

Edit the configuration of a feed node to test update behavior.

Parameters

$nid: The nid to edit.

$feed_url: The new (absolute) feed URL to use.

$title: Optional parameter to change title of feed node.

1 call to FeedsWebTestCase::editFeedNode()
FeedsRSStoNodesTest::test in tests/feeds_processor_node.test
Test node creation, refreshing/deleting feeds and feed items.

File

tests/feeds.test.inc, line 210
Common functionality for all Feeds tests.

Class

FeedsWebTestCase
Test basic Data API functionality.

Code

public function editFeedNode($nid, $feed_url, $title = '') {
  $edit = array(
    'title' => $title,
    'feeds[FeedsHTTPFetcher][source]' => $feed_url,
  );

  // Check that the update was saved.
  $this
    ->drupalPost('node/' . $nid . '/edit', $edit, 'Save');
  $this
    ->assertText('has been updated.');

  // Check that the URL was updated in the feeds_source table.

  //$source = db_query("SELECT * FROM {feeds_source} WHERE feed_nid = :nid", array(':nid' => $nid))->fetch();
  $source = db_select('feeds_source', 's')
    ->condition('s.feed_nid', $nid, '=')
    ->fields('s', array(
    'config',
  ))
    ->execute()
    ->fetch();
  $config = unserialize($source->config);
  $this
    ->assertEqual($config['FeedsHTTPFetcher']['source'], $feed_url, t('URL in DB correct.'));
}