You are here

private function VideoFieldTestCase::transcodeVideo in Video 7.2

Makes changes in the database such that a video looks transcoded.

@todo use a fake transcoder class to transcode the file

5 calls to VideoFieldTestCase::transcodeVideo()
VideoFieldTestCase::testDeleteVideoFieldItem in tests/VideoField.test
Tests basic behavior for deleting a video from a node
VideoFieldTestCase::testDeleteVideoFieldItemTwice in tests/VideoField.test
Tests adding a video to two different nodes and deleting them one by one
VideoFieldTestCase::testDeleteVideoFieldItemTwice_EntityDelete in tests/VideoField.test
Tests adding a video to two different nodes and deleting the nodes
VideoFieldTestCase::testSaveVideoFieldItem in tests/VideoField.test
Tests basic behavior for saving a new video and adding it to a node.
VideoFieldTestCase::testSaveVideoFieldItemTwice in tests/VideoField.test
Tests saving a new video and adding it to two different nodes

File

tests/VideoField.test, line 415
Tests for the the Video field type

Class

VideoFieldTestCase
Tests for the the Video field type

Code

private function transcodeVideo(stdClass &$node, $vid, $fid) {
  db_update('video_queue')
    ->fields(array(
    'status' => VIDEO_RENDERING_COMPLETE,
    'started' => time(),
    'completed' => time(),
  ))
    ->execute();

  // Converted file
  $of = $this
    ->createFile('video_' . $fid . '_transcoded.mp4');
  $of->status = FILE_STATUS_PERMANENT;
  file_save($of);
  db_insert('video_output')
    ->fields(array(
    'vid' => $vid,
    'original_fid' => $fid,
    'output_fid' => $of->fid,
  ))
    ->execute();

  // Thumbnails
  for ($i = 0; $i < variable_get('video_thumbnail_count', 5); $i++) {
    $tnf = $this
      ->createFile('thumbnail-' . $fid . '_' . sprintf('%04d', $i) . '.jpg', 'image/jpeg');
    $tnf->status = FILE_STATUS_PERMANENT;
    file_save($tnf);
    db_insert('video_thumbnails')
      ->fields(array(
      'videofid' => $fid,
      'thumbnailfid' => $tnf->fid,
    ))
      ->execute();
  }

  // Save the node to trigger usage generation
  node_save($node);
  $node = node_load($node->nid);
}