function MediaLibraryAdminTestCase::testFilesAdminPages in Media Library 7
Tests files overview with different user permissions.
File
- ./
media_library.test, line 111 - Test integration for the Media Library module.
Class
- MediaLibraryAdminTestCase
- Test file administration page functionality.
Code
function testFilesAdminPages() {
$this
->drupalLogin($this->admin_user);
$files['standard_file'] = $this
->createFileEntity(array(
'library' => 0,
));
$files['library_file'] = $this
->createFileEntity(array(
'library' => 1,
));
// Verify all files are displayed on the standard file listing page.
$this
->drupalGet('admin/content/file');
$this
->assertResponse(200);
foreach ($files as $file) {
$this
->assertLinkByHref('file/' . $file->fid);
// Verify tableselect.
$this
->assertFieldByName('files[' . $file->fid . ']', '', t('Tableselect found.'));
}
// Verify only library files are displayed on the library file listing page.
$this
->drupalGet('admin/content/file/library');
$this
->assertResponse(200);
$this
->assertNoLinkByHref('file/' . $files['standard_file']->fid);
$this
->assertLinkByHref('file/' . $files['library_file']->fid);
// Verify tableselect.
$this
->assertFieldByName('files[' . $file->fid . ']', '', t('Tableselect found.'));
}