You are here

protected function ComponentFormTest::setUp in Module Builder 8.3

Overrides BrowserTestBase::setUp

File

tests/src/Functional/ComponentFormTest.php, line 53

Class

ComponentFormTest
Tests the component edit form.

Namespace

Drupal\Tests\module_builder\Functional

Code

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

  // Enable error output to the browser.
  $settings = [];
  $settings['config']['system.logging']['error_level'] = (object) [
    'value' => ERROR_REPORTING_DISPLAY_VERBOSE,
    'required' => TRUE,
  ];
  $this
    ->writeSettings($settings);
  $this
    ->drupalPlaceBlock('local_actions_block');
  $this
    ->drupalPlaceBlock('local_tasks_block');
  $this->entityTypeManager = $this->container
    ->get('entity_type.manager');
  $this->testComponentStorage = $this->entityTypeManager
    ->getStorage('test_component');

  // Add permissions to the anonymous role so we don't need to log in.
  user_role_change_permissions(RoleInterface::ANONYMOUS_ID, [
    'create modules' => TRUE,
  ]);
  $component_entity = $this->testComponentStorage
    ->create([
    'id' => 'my_component',
    'name' => 'My Component',
  ]);
  $component_entity
    ->save();
}