public function FeedsRulesTest::testFeedsSkipItemAction in Feeds 7.2
Tests the Rules action 'feeds_skip_item'.
File
- tests/
feeds_rules.test, line 169 - Contains FeedsRulesTest.
Class
- FeedsRulesTest
- Tests for Rules integration.
Code
public function testFeedsSkipItemAction() {
$rule = $this
->createTestRule('feeds_import_node', FALSE);
// Setup rule to not save the first item (which title is 'Lorem Ipsum').
$rule
->condition('data_is', array(
'data:select' => 'node:title',
'value' => 'Lorem ipsum',
));
$rule
->action('feeds_skip_item', array(
'entity:select' => '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 1 node');
// Assert that only the second item was imported.
$node = node_load(1);
$this
->assertEqual('Ut wisi enim ad minim veniam', $node->title);
}