function FormatFormViewModesTest::testAllowedFormatFormViewModes in D7 Media 7.4
Same name and namespace in other branches
- 7.2 modules/media_wysiwyg/media_wysiwyg.test \FormatFormViewModesTest::testAllowedFormatFormViewModes()
- 7.3 modules/media_wysiwyg/media_wysiwyg.test \FormatFormViewModesTest::testAllowedFormatFormViewModes()
Configure format form view mode restrictions and ensure that they are followed.
File
- modules/
media_wysiwyg/ media_wysiwyg.test, line 136 - Tests for media.module.
Class
- FormatFormViewModesTest
- Test configuring view modes available on the format form.
Code
function testAllowedFormatFormViewModes() {
// Create an image file to test with.
$files = $this
->drupalGetTestFiles('image');
$files[0]->status = FILE_STATUS_PERMANENT;
$file = file_save($files[0]);
$fid = $file->fid;
// Teaser view mode should be selectable.
$this
->drupalGet('media/' . $fid . '/format-form');
$this
->assertResponse(200);
$this
->assertOption('edit-view-mode', 'teaser');
// Restrict the use of the default view mode.
$this
->drupalGet('admin/structure/file-types/manage/image/file-display/teaser');
$this
->assertResponse(200);
$edit = array(
'restrict_wysiwyg' => 1,
);
$this
->drupalPost(NULL, $edit, t('Save configuration'));
$this
->assertResponse(200);
// Teaser view mode should be restricted.
$this
->drupalGet('media/' . $fid . '/format-form');
$this
->assertResponse(200);
$this
->assertNoOption('edit-format', 'teaser');
}