public function FeedsRSStoNodesTest::testUnlock in Feeds 7.2
Tests unlocking a feed.
File
- tests/
feeds_processor_node.test, line 658 - Tests for plugins/FeedsNodeProcessor.inc.
Class
- FeedsRSStoNodesTest
- Test aggregating a feed as node items.
Code
public function testUnlock() {
// Just remove the mappings rather than creating a new importer.
$this
->removeMappings('syndication', $this
->getCurrentMappings('syndication'));
$this
->setPlugin('syndication', 'FeedsFileFetcher');
$this
->setPlugin('syndication', 'FeedsCSVParser');
$this
->setSettings('syndication', NULL, array(
'content_type' => '',
'process_in_background' => TRUE,
'import_period' => FEEDS_SCHEDULE_NEVER,
));
$this
->addMappings('syndication', array(
0 => array(
'source' => 'title',
'target' => 'title',
),
1 => array(
'source' => 'GUID',
'target' => 'guid',
'unique' => TRUE,
),
));
$this
->importFile('syndication', $this
->absolutePath() . '/tests/feeds/many_nodes_ordered.csv', 'Schedule import');
$this
->assertEqual(0, db_query("SELECT COUNT(*) FROM {node}")
->fetchField());
// Assert that the import button is disabled.
$this
->assertFieldDisabled('op');
// Assert that there is one import task in the queue.
$this
->assertEqual(1, db_query("SELECT COUNT(*) FROM {queue} WHERE name = 'feeds_source_import'")
->fetchField());
// Now unlock the feed.
$this
->drupalPost('import/syndication/unlock', array(), 'Unlock');
$this
->assertText('Importer unlocked.');
// Assert that the unlock button is now disabled.
$this
->drupalGet('import/syndication/unlock');
$this
->assertFieldDisabled('op');
$this
->assertText('This importer is not locked, therefore it cannot be unlocked.');
// And assert that the import button is no longer disabled.
$this
->drupalGet('import/syndication');
$this
->assertFieldEnabled('op');
}