You are here

public function VideoSchedulingTestCase::testTranscodeTimeout in Video 7.2

Tests for the transcode timeout setting

File

tests/VideoScheduling.test, line 26
Tests for the PHPVideoToolkit class

Class

VideoSchedulingTestCase
Tests for the Video module scheduling options

Code

public function testTranscodeTimeout() {

  // Create a file with state ACTIVE.
  $node = new stdClass();
  $node->uid = 1;
  $node->type = 'page';
  $node->title = 'Test node';
  node_save($node);
  $node = node_load($node->nid);
  $fid = db_insert('file_managed')
    ->fields(array(
    'filemime' => 'video/mp4',
    'uri' => 'public://test.mp4',
    'filename' => 'test.mp4',
    'filesize' => 1234,
    'status' => 1,
    'timestamp' => time(),
    'uid' => 1,
  ))
    ->execute();
  $vid = db_insert('video_queue')
    ->fields(array(
    'status' => VIDEO_RENDERING_ACTIVE,
    'started' => time() - 11 * 60,
    'statusupdated' => time() - 10.5 * 60,
    'completed' => 0,
    'fid' => $fid,
    'entity_type' => 'node',
    'entity_id' => $node->nid,
  ))
    ->execute();

  // Run cron
  video_cron();

  // Check if the status was updated to failed
  $queue = db_query('SELECT status FROM {video_queue} WHERE vid = ?', array(
    $vid,
  ))
    ->fetch();
  $this
    ->assertEqual(VIDEO_RENDERING_FAILED, $queue->status, 'The status of the video must be changed to FAILED.');
}