Révision ed9a13f1
Ajouté par Assos Assos il y a plus de 3 ans
drupal7/sites/all/modules/feeds/tests/feeds_processor_node.test | ||
---|---|---|
10 | 10 |
*/ |
11 | 11 |
class FeedsRSStoNodesTest extends FeedsWebTestCase { |
12 | 12 |
|
13 |
/** |
|
14 |
* {@inheritdoc} |
|
15 |
*/ |
|
13 | 16 |
public static function getInfo() { |
14 | 17 |
return array( |
15 | 18 |
'name' => 'Processor: Node', |
... | ... | |
212 | 215 |
|
213 | 216 |
// Now create a second feed configuration that is not attached to a content |
214 | 217 |
// type and run tests on importing/purging. |
215 |
|
|
216 | 218 |
// Login with sufficient permissions. |
217 | 219 |
$this->drupalLogin($this->admin_user); |
218 | 220 |
// Remove all items again so that next test can check for them. |
... | ... | |
650 | 652 |
$this->assertEqual(0, db_query("SELECT COUNT(*) FROM {queue} WHERE name = 'feeds_source_clear'")->fetchField()); |
651 | 653 |
} |
652 | 654 |
|
655 |
/** |
|
656 |
* Tests unlocking a feed. |
|
657 |
*/ |
|
658 |
public function testUnlock() { |
|
659 |
// Just remove the mappings rather than creating a new importer. |
|
660 |
$this->removeMappings('syndication', $this->getCurrentMappings('syndication')); |
|
661 |
|
|
662 |
$this->setPlugin('syndication', 'FeedsFileFetcher'); |
|
663 |
$this->setPlugin('syndication', 'FeedsCSVParser'); |
|
664 |
|
|
665 |
$this->setSettings('syndication', NULL, array( |
|
666 |
'content_type' => '', |
|
667 |
'process_in_background' => TRUE, |
|
668 |
'import_period' => FEEDS_SCHEDULE_NEVER, |
|
669 |
)); |
|
670 |
|
|
671 |
$this->addMappings('syndication', array( |
|
672 |
0 => array( |
|
673 |
'source' => 'title', |
|
674 |
'target' => 'title', |
|
675 |
), |
|
676 |
1 => array( |
|
677 |
'source' => 'GUID', |
|
678 |
'target' => 'guid', |
|
679 |
'unique' => TRUE, |
|
680 |
), |
|
681 |
)); |
|
682 |
|
|
683 |
$this->importFile('syndication', $this->absolutePath() . '/tests/feeds/many_nodes_ordered.csv', 'Schedule import'); |
|
684 |
$this->assertEqual(0, db_query("SELECT COUNT(*) FROM {node}")->fetchField()); |
|
685 |
|
|
686 |
// Assert that the import button is disabled. |
|
687 |
$this->assertFieldDisabled('op'); |
|
688 |
|
|
689 |
// Assert that there is one import task in the queue. |
|
690 |
$this->assertEqual(1, db_query("SELECT COUNT(*) FROM {queue} WHERE name = 'feeds_source_import'")->fetchField()); |
|
691 |
|
|
692 |
// Now unlock the feed. |
|
693 |
$this->drupalPost('import/syndication/unlock', array(), 'Unlock'); |
|
694 |
$this->assertText('Importer unlocked.'); |
|
695 |
|
|
696 |
// Assert that the unlock button is now disabled. |
|
697 |
$this->drupalGet('import/syndication/unlock'); |
|
698 |
$this->assertFieldDisabled('op'); |
|
699 |
$this->assertText('This importer is not locked, therefore it cannot be unlocked.'); |
|
700 |
|
|
701 |
// And assert that the import button is no longer disabled. |
|
702 |
$this->drupalGet('import/syndication'); |
|
703 |
$this->assertFieldEnabled('op'); |
|
704 |
} |
|
705 |
|
|
653 | 706 |
/** |
654 | 707 |
* Tests skip new items. |
655 | 708 |
*/ |
Formats disponibles : Unified diff
Weekly update of contrib modules