public function FileEntityAdminTest::setUp in File Entity (fieldable files) 8.2
Overrides FileEntityTestBase::setUp
File
- tests/
src/ Functional/ FileEntityAdminTest.php, line 44
Class
- FileEntityAdminTest
- Test file administration page functionality.
Namespace
Drupal\Tests\file_entity\FunctionalCode
public function setUp() {
parent::setUp();
// Add the tasks and actions blocks.
$this
->drupalPlaceBlock('local_actions_block');
$this
->drupalPlaceBlock('local_tasks_block');
// Remove the "view files" permission which is set
// by default for all users so we can test this permission
// correctly.
$roles = user_roles();
foreach ($roles as $rid => $role) {
user_role_revoke_permissions($rid, array(
'view files',
));
}
$this->userAdmin = $this
->drupalCreateUser(array(
'administer files',
'bypass file access',
));
$this->userBasic = $this
->drupalCreateUser(array(
'administer files',
));
$this->userViewOwn = $this
->drupalCreateUser(array(
'administer files',
'view own private files',
));
$this->userViewPrivate = $this
->drupalCreateUser(array(
'administer files',
'view private files',
));
$this->userEditDelete = $this
->drupalCreateUser(array(
'administer files',
'edit any document files',
'delete any document files',
'edit any image files',
'delete any image files',
));
// Enable the enhanced Files view.
View::load('files')
->disable()
->save();
View::load('file_entity_files')
->enable()
->save();
}