You are here

protected function PanelizerUserFunctionalTest::setUp in Panelizer 8.3

Sets up a Drupal site for running functional and integration tests.

Installs Drupal with the installation profile specified in \Drupal\simpletest\WebTestBase::$profile into the prefixed database.

Afterwards, installs any additional modules specified in the static \Drupal\simpletest\WebTestBase::$modules property of each class in the class hierarchy.

After installation all caches are flushed and several configuration values are reset to the values of the parent site executing the test, since the default values may be incompatible with the environment in which tests are being executed.

Overrides WebTestBase::setUp

File

src/Tests/PanelizerUserFunctionalTest.php, line 37

Class

PanelizerUserFunctionalTest
Basic functional tests of using Panelizer with user entities.

Namespace

Drupal\panelizer\Tests

Code

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

  // Create the admin user.
  $user = $this
    ->drupalCreateUser([
    // Required for Panelizer.
    'administer panelizer',
    'access panels in-place editing',
    // Allow managing user entities.
    'administer users',
    // Allow managing user entity settings.
    'administer account settings',
    // View access to user profiles.
    'access user profiles',
    // Allow managing the user entity fields and display settings.
    'administer user display',
    'administer user fields',
  ]);
  $this
    ->drupalLogin($user);

  // Enable Panelizer for this entity.
  $this
    ->drupalGet('admin/config/people/accounts/display');
  $this
    ->assertResponse(200);
  $edit = [
    'panelizer[enable]' => TRUE,
    'panelizer[custom]' => TRUE,
  ];
  $this
    ->drupalPostForm(NULL, $edit, t('Save'));
  $this
    ->assertResponse(200);

  // Reload all caches.
  $this
    ->rebuildAll();
}