You are here

function MediaInternetProviderTestCase::testMediaInternetCustomProviderWizardSchemes in D7 Media 7.2

Same name and namespace in other branches
  1. 7.4 modules/media_internet/tests/media_internet.test \MediaInternetProviderTestCase::testMediaInternetCustomProviderWizardSchemes()
  2. 7.3 modules/media_internet/tests/media_internet.test \MediaInternetProviderTestCase::testMediaInternetCustomProviderWizardSchemes()

Test the file upload wizard scheme step.

File

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

Class

MediaInternetProviderTestCase
Tests custom media provider APIs.

Code

function testMediaInternetCustomProviderWizardSchemes() {

  // Enable the private file system.
  variable_set('file_private_path', $this->private_files_directory);

  // Step 1: Upload a basic video file.
  $edit = array();
  $edit['embed_code'] = 'http://www.example.com/video/123';
  $this
    ->drupalPost('file/add/web', $edit, t('Next'));

  // Step 3: Users should not be able to select a scheme for files with
  // read-only stream wrappers.
  $this
    ->assertNoFieldByName('scheme');

  // 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' => 'Video',
    '%name' => $file->filename,
  )), t('Video file uploaded.'));
}