You are here

private function VideoFieldTestCase::createFile in Video 7.2

7 calls to VideoFieldTestCase::createFile()
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

... See full list

File

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

Class

VideoFieldTestCase
Tests for the the Video field type

Code

private function createFile($name = 'file.mp4', $mime = 'video/mp4') {
  $dir = 'public://videos/original/';
  file_prepare_directory($dir, FILE_CREATE_DIRECTORY);
  $uri = $dir . $name;
  $filesize = 123;
  file_put_contents($uri, str_repeat('0', $filesize));
  $fid = db_insert('file_managed')
    ->fields(array(
    'filemime' => $mime,
    'uri' => $uri,
    'filename' => $name,
    'filesize' => $filesize,
    'status' => 0,
    'timestamp' => time(),
    'uid' => $this->user->uid,
  ))
    ->execute();
  return file_load(intval($fid));
}