function MediaBulkUploadEditTestCase::testBulkFileEditing in D7 Media 7.3
Same name and namespace in other branches
- 7.4 modules/media_bulk_upload/tests/media_bulk_upload.test \MediaBulkUploadEditTestCase::testBulkFileEditing()
- 7.2 modules/media_bulk_upload/tests/media_bulk_upload.test \MediaBulkUploadEditTestCase::testBulkFileEditing()
Tests editing with multiple files.
File
- modules/
media_bulk_upload/ tests/ media_bulk_upload.test, line 79 - Tests for media_bulk_upload.module.
Class
- MediaBulkUploadEditTestCase
- Test bulk file editing.
Code
function testBulkFileEditing() {
$files = array();
// Create multiple files for testing.
foreach (array(
'image',
'text',
) as $type_name) {
$test_file = $this
->getTestFile($type_name);
$file = file_save($test_file);
$files[$file->fid] = $file;
}
// Visit the bulk file edit page and verify that it performs as expected.
$path = media_bulk_upload_file_edit_url(array_keys($files));
$this
->drupalGet($path);
foreach ($files as $file) {
// Verify that a filename for each file is present on the page.
$title = t('<em>Edit @type</em> @title', array(
'@type' => $file->type,
'@title' => $file->filename,
));
$this
->assertRaw('<h2>' . $title . '</h2>', 'The file has the correct filename.');
// Verify that the 'replace file' functionality is disabled.
$this
->assertNoField('multiform[media_edit_' . $file->fid . '_' . ($file->fid - 1) . '][files][replace_upload]', 'Replace file field found.');
// Verify that the action buttons have been removed.
$this
->assertNoLinkByHref('file/' . $file->fid);
}
}