public function FeedsRulesTest::testFeedsAfterImportEvent in Feeds 7.2
Tests if the Rules event 'feeds_after_import' is invoked.
File
- tests/
feeds_rules.test, line 108 - Contains FeedsRulesTest.
Class
- FeedsRulesTest
- Tests for Rules integration.
Code
public function testFeedsAfterImportEvent() {
$rule = $this
->createTestRule('feeds_after_import');
$rule
->condition('data_is', array(
'data:select' => 'source:id',
'value' => 'node',
));
$rule
->integrityCheck()
->save();
// Set source file to import.
$source_url = $GLOBALS['base_url'] . '/' . drupal_get_path('module', 'feeds') . '/tests/feeds/content.csv';
$edit = array(
'feeds[FeedsHTTPFetcher][source]' => $source_url,
);
$this
->drupalPost('import/node', $edit, t('Import'));
$this
->assertText('Created 2 nodes');
// Assert that a test node was created *after* the import.
$node = node_load(3);
$this
->assertEqual('Test node', $node->title);
// Assert titles of imported nodes as well.
$node = node_load(1);
$this
->assertEqual('Lorem ipsum', $node->title);
$node = node_load(2);
$this
->assertEqual('Ut wisi enim ad minim veniam', $node->title);
}