feeds_ui.test in Feeds 7
Tests for Feeds Admin UI module.
File
feeds_ui/tests/feeds_ui.testView source
<?php
/**
* @file
* Tests for Feeds Admin UI module.
*/
// Require FeedsWebTestCase class definition.
require_once dirname(__FILE__) . '/../../tests/feeds.test.inc';
/**
* Test basic Feeds UI functionality.
*/
class FeedsUIUserInterfaceTestCase extends FeedsWebTestCase {
/**
* Describe this test.
*/
public function getInfo() {
return array(
'name' => t('Feeds UI user interface'),
'description' => t('Tests Feeds Admin UI module\'s GUI.'),
'group' => t('Feeds'),
);
}
/**
* Set up test.
*/
public function setUp() {
parent::setUp('feeds', 'feeds_ui', 'ctools', 'job_scheduler');
$this
->drupalLogin($this
->drupalCreateUser(array(
'administer feeds',
'create article content',
'create page content',
)));
}
/**
* UI functionality tests on
* feeds_ui_overview(),
* feeds_ui_create_form(),
* Change plugins on feeds_ui_edit_page().
*/
public function testEditFeedConfiguration() {
// Create an importer.
$this
->createImporterConfiguration('Test feed', 'test_feed');
// Assert UI elements.
$this
->drupalGet('admin/structure/feeds/edit/test_feed');
$this
->assertText('Basic settings');
$this
->assertText('Fetcher');
$this
->assertText('HTTP Fetcher');
$this
->assertText('Parser');
$this
->assertText('Common syndication parser');
$this
->assertText('Processor');
$this
->assertText('Node processor');
$this
->assertText('Getting started');
$this
->assertRaw('admin/structure/feeds/edit/test_feed/settings');
$this
->assertRaw('admin/structure/feeds/edit/test_feed/settings/FeedsNodeProcessor');
$this
->assertRaw('admin/structure/feeds/edit/test_feed/fetcher');
$this
->assertRaw('admin/structure/feeds/edit/test_feed/parser');
$this
->assertRaw('admin/structure/feeds/edit/test_feed/processor');
$this
->drupalGet('import');
$this
->assertText('Page');
// Select some other plugins.
$this
->drupalGet('admin/structure/feeds/edit/test_feed');
$this
->clickLink('Change', 0);
$this
->assertText('Select a fetcher');
$edit = array(
'plugin_key' => 'FeedsFileFetcher',
);
$this
->drupalPost('admin/structure/feeds/edit/test_feed/fetcher', $edit, 'Save');
$this
->clickLink('Change', 1);
$this
->assertText('Select a parser');
$edit = array(
'plugin_key' => 'FeedsCSVParser',
);
$this
->drupalPost('admin/structure/feeds/edit/test_feed/parser', $edit, 'Save');
$this
->clickLink('Change', 2);
$this
->assertText('Select a processor');
$edit = array(
'plugin_key' => 'FeedsFeedNodeProcessor',
);
$this
->drupalPost('admin/structure/feeds/edit/test_feed/processor', $edit, 'Save');
// Assert changed configuration.
$this
->assertPlugins('test_feed', 'FeedsFileFetcher', 'FeedsCSVParser', 'FeedsFeedNodeProcessor');
// Delete feed.
$this
->drupalPost('admin/structure/feeds/delete/test_feed', array(), 'Delete');
$this
->drupalGet('import');
$this
->assertNoText('Test feed');
// Create the same importer again.
$this
->createImporterConfiguration('Test feed', 'test_feed');
// Test basic settings settings.
$edit = array(
'name' => 'Syndication feed',
'content_type' => 'page',
'import_period' => 3600,
);
$this
->drupalPost('admin/structure/feeds/edit/test_feed/settings', $edit, 'Save');
// Assert results of change.
$this
->assertText('Edit importer: Syndication');
$this
->assertText('Attached to: Page');
$this
->assertText('Refresh: every 1 hour');
$this
->drupalGet('admin/structure/feeds');
$this
->assertLink('Page');
// See whether string 'Page' shows up in table.
// Configure processor.
$edit = array(
'content_type' => 'article',
);
$this
->drupalPost('admin/structure/feeds/edit/test_feed/settings/FeedsNodeProcessor', $edit, 'Save');
$this
->assertRaw('value="article" selected="selected"');
// Create a feed node.
$edit = array(
'title' => 'Development Seed',
'feeds[FeedsHTTPFetcher][source]' => $GLOBALS['base_url'] . '/' . drupal_get_path('module', 'feeds') . '/tests/feeds/developmentseed.rss2',
);
$this
->drupalPost('node/add/page', $edit, 'Save');
$this
->assertText('Page Development Seed has been created.');
// @todo Refreshing/deleting feed items. Needs to live in feeds.test
}
}
Classes
Name![]() |
Description |
---|---|
FeedsUIUserInterfaceTestCase | Test basic Feeds UI functionality. |