public function FeedsTokenTest::testPerformance in Feeds 7.2
Tests if a feed node does not get loaded if *not* replacing tokens like [node:feeds-source:x].
File
- tests/
feeds_tokens.test, line 76
Class
- FeedsTokenTest
- Test cases for token replacement.
Code
public function testPerformance() {
// Import a RSS feed.
$edit = array(
'feeds[FeedsHTTPFetcher][source]' => $GLOBALS['base_url'] . '/' . drupal_get_path('module', 'feeds') . '/tests/feeds/developmentseed.rss2',
);
$this
->drupalPost('node/add/page', $edit, 'Save');
// Keep track of loaded nodes from now on.
variable_set('feeds_track_node_loads', TRUE);
// Load an imported node.
$data = array(
'node' => node_load(2),
);
// Replace a single token.
token_replace('[node:title]', $data);
// Ensure only node 2 was loaded.
$loaded_nodes = variable_get('feeds_loaded_nodes');
$this
->assertEqual(array(
2,
), $loaded_nodes, format_string('The feed node (1) did not get loaded during token replacement, only node 2. Actual: @actual', array(
'@actual' => var_export($loaded_nodes, TRUE),
)));
}