You are here

protected function FieldDefaultsTestBase::setUp in Field Defaults 8

Once installed, a content type with the desired field is created.

Overrides BrowserTestBase::setUp

File

src/Tests/FieldDefaultsTestBase.php, line 38

Class

FieldDefaultsTestBase
Class FieldDefaultsTestBase.

Namespace

Drupal\field_defaults\Tests

Code

protected function setUp() {

  // Install Drupal.
  parent::setUp();

  // Add the system menu blocks to appropriate regions.
  $this
    ->setupMenus();

  // Create a Content type and some nodes.
  $this
    ->drupalCreateContentType([
    'type' => 'page',
  ]);

  // Create and login a user that creates the content type.
  $permissions = [
    'administer nodes',
    'administer content types',
    'administer node fields',
    'edit any page content',
    'administer field defaults',
  ];
  $this->administratorAccount = $this
    ->drupalCreateUser($permissions);
  $this
    ->drupalLogin($this->administratorAccount);

  // Create some dummy content.
  for ($i = 0; $i < 20; $i++) {
    $this
      ->drupalCreateNode();
  }
}