You are here

public function FeedsWebTestBase::editFeedNode in Feeds 8.2

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 FeedsWebTestBase::editFeedNode()
FeedsRSStoNodesTest::test in lib/Drupal/feeds/Tests/FeedsRSStoNodesTest.php
Test node creation, refreshing/deleting feeds and feed items.

File

lib/Drupal/feeds/Tests/FeedsWebTestBase.php, line 295
Common functionality for all Feeds tests.

Class

FeedsWebTestBase
Test basic Data API functionality.

Namespace

Drupal\feeds\Tests

Code

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

  // Check that the update was saved.
  $this
    ->drupalPost('node/' . $nid . '/edit', $edit, 'Save and keep published');
  $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,
  ))
    ->fetchObject();
  $config = unserialize($source->config);
  $this
    ->assertEqual($config['Drupal\\feeds\\Plugin\\feeds\\fetcher\\FeedsHTTPFetcher']['source'], $feed_url, t('URL in DB correct.'));
}