You are here

public function FeedsSchedulerTestCase::testNextImportTime in Feeds 7.2

Tests if the expected next import time is shown for scheduled imports.

File

tests/feeds_scheduler.test, line 219
Feeds tests.

Class

FeedsSchedulerTestCase
Test cron scheduling.

Code

public function testNextImportTime() {
  $this
    ->initSyndication();
  $this
    ->drupalLogin($this->admin_user);

  // Set schedule to be 25 minutes in the future.
  $next = REQUEST_TIME + 1500;
  db_query("UPDATE {job_schedule} SET next = :time", array(
    ':time' => $next,
  ));
  $this
    ->drupalGet('node/1/import');
  $this
    ->assertText(format_date($next));

  // Set schedule to import on next cron run.
  db_query("UPDATE {job_schedule} SET next = :time", array(
    ':time' => REQUEST_TIME,
  ));
  $this
    ->drupalGet('node/1/import');
  $this
    ->assertText('Next import: on next cron run');

  // Now remove all jobs.
  db_truncate('job_schedule')
    ->execute();

  // Assert that the import is not scheduled now.
  $this
    ->drupalGet('node/1/import');
  $this
    ->assertText('Next import: not scheduled');
}