You are here

function MediaInternetRemoteFileTestCase::testRemoteFileHandling in D7 Media 7.4

Same name and namespace in other branches
  1. 7.2 modules/media_internet/tests/media_internet.test \MediaInternetRemoteFileTestCase::testRemoteFileHandling()
  2. 7.3 modules/media_internet/tests/media_internet.test \MediaInternetRemoteFileTestCase::testRemoteFileHandling()

Tests the default remote file handler.

File

modules/media_internet/tests/media_internet.test, line 145
Tests for media_internet.module.

Class

MediaInternetRemoteFileTestCase
Test the default MediaInternetFileHandler provider.

Code

function testRemoteFileHandling() {

  // Step 1: Add a basic document file by providing a URL to the file.
  $edit = array();
  $edit['embed_code'] = file_create_url('README.txt');
  $this
    ->drupalPost('file/add/web', $edit, t('Next'));

  // Check that the file exists in the database.
  $fid = $this
    ->getLastFileId();
  $file = file_load($fid);
  $this
    ->assertTrue($file, t('File found in database.'));

  // Check that the video file has been uploaded.
  $this
    ->assertRaw(t('!type %name was uploaded.', array(
    '!type' => 'Document',
    '%name' => $file->filename,
  )), t('Document file uploaded.'));
}