You are here

function FileEntityUploadWizardTestCase::testFileEntityUploadWizardBasic in File Entity (fieldable files) 7.2

Same name and namespace in other branches
  1. 7.3 file_entity.test \FileEntityUploadWizardTestCase::testFileEntityUploadWizardBasic()

Test the basic file upload wizard functionality.

File

./file_entity.test, line 443
Test integration for the file_entity module.

Class

FileEntityUploadWizardTestCase
Tests creating new file entities through the file upload wizard.

Code

function testFileEntityUploadWizardBasic() {
  $test_file = $this
    ->getTestFile('text');

  // Step 1: Upload a basic document file.
  $edit = array();
  $edit['files[upload]'] = drupal_realpath($test_file->uri);
  $this
    ->drupalPost('file/add', $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 document file has been uploaded.
  $this
    ->assertRaw(t('!type %name was uploaded.', array(
    '!type' => 'Document',
    '%name' => $file->filename,
  )), t('Document file uploaded.'));
}