function FeedAPIExpireTestsCase::testFeedAPIAllExpire in FeedAPI 6
Checks cron feed scheduling functionality
File
- tests/
feedapi_expire.test, line 24
Class
- FeedAPIExpireTestsCase
- Class for testing FeedAPI cron scheduling.
Code
function testFeedAPIAllExpire() {
$this
->create_type(array_pop($this
->get_parsers()));
$this
->feedapi_user();
$num = db_result(db_query("SELECT COUNT(*) FROM {feedapi_node_item}"));
$this
->assertTrue($num == 0, 'At the beginning there are no items');
$feed_url = $this
->testFileURL('test_feed.rss');
$edit = array(
'feedapi[feedapi_url]' => $feed_url,
'feedapi[refresh_time]' => FEEDAPI_NEVER_DELETE_OLD,
);
$this
->drupalPost('node/add/' . $this->info->type, $edit, 'Save');
$node = db_fetch_object(db_query("SELECT nid FROM {feedapi} WHERE url = '%s'", $feed_url));
$this
->drupalGet("node/{$node->nid}/refresh");
$num = db_result(db_query("SELECT COUNT(*) FROM {feedapi_node_item}"));
$this
->assertTrue($num > 0, 'The feed has at least one item');
db_query("UPDATE {feedapi_node_item} SET timestamp = %d", time() - 51840000);
$edit = array(
'feedapi[feedapi_url]' => 'http://novaak.net/empty.rss',
'feedapi[items_delete]' => 31536000,
);
$this
->drupalPost("node/{$node->nid}/edit", $edit, 'Save');
// Make sure that the feed will be refreshed
$this
->drupalGet("node/{$node->nid}/refresh");
$num = db_result(db_query("SELECT COUNT(*) FROM {feedapi_node_item}"));
$this
->assertTrue($num == 0, 'The feed hasn\'t got any items');
}