You are here

protected function FileFieldSourcesTestBase::setUp in FileField Sources 8

Sets up for file field sources test cases.

Overrides FileFieldTestBase::setUp

3 calls to FileFieldSourcesTestBase::setUp()
EmptyValuesTest::setUp in tests/src/Functional/EmptyValuesTest.php
Sets up for empty values test case.
ImceSourceTest::setUp in tests/src/Functional/ImceSourceTest.php
Sets up for imce source test case.
MultipleValuesTest::setUp in tests/src/Functional/MultipleValuesTest.php
Sets up for multiple values test case.
3 methods override FileFieldSourcesTestBase::setUp()
EmptyValuesTest::setUp in tests/src/Functional/EmptyValuesTest.php
Sets up for empty values test case.
ImceSourceTest::setUp in tests/src/Functional/ImceSourceTest.php
Sets up for imce source test case.
MultipleValuesTest::setUp in tests/src/Functional/MultipleValuesTest.php
Sets up for multiple values test case.

File

tests/src/Functional/FileFieldSourcesTestBase.php, line 45

Class

FileFieldSourcesTestBase
Base class for File Field Sources test cases.

Namespace

Drupal\Tests\filefield_sources\Functional

Code

protected function setUp() {
  parent::setUp();

  // Grant "administer node form display" permission.
  $roles = $this->adminUser
    ->getRoles(TRUE);
  $rid = array_pop($roles);
  $role = Role::load($rid);
  $this
    ->grantPermissions($role, [
    'administer node form display',
  ]);

  // Add node.
  $this->node = $this
    ->drupalCreateNode();

  // Add file field.
  $this->fieldName = strtolower($this
    ->randomMachineName());
  $this
    ->createFileField($this->fieldName, 'node', $this->typeName);
}