You are here

protected function DomainAccessPermissionsTest::setUp in Domain Access 8

Overrides DomainTestBase::setUp

File

domain_access/tests/src/Functional/DomainAccessPermissionsTest.php, line 56

Class

DomainAccessPermissionsTest
Tests the domain access integration with node_access callbacks.

Namespace

Drupal\Tests\domain_access\Functional

Code

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

  // Clear permissions for authenticated users.
  $this
    ->config('user.role.' . RoleInterface::AUTHENTICATED_ID)
    ->set('permissions', [])
    ->save();

  // Create Basic page node type.
  if ($this->profile != 'standard') {
    $this
      ->drupalCreateContentType([
      'type' => 'page',
      'name' => 'Basic page',
      'display_submitted' => FALSE,
    ]);
    $this
      ->drupalCreateContentType([
      'type' => 'article',
      'name' => 'Article',
      'display_submitted' => FALSE,
    ]);
  }
  $this->accessHandler = \Drupal::entityTypeManager()
    ->getAccessControlHandler('node');
  $this->manager = \Drupal::service('domain_access.manager');
  $this->userStorage = \Drupal::entityTypeManager()
    ->getStorage('user');

  // Create 5 domains.
  $this
    ->domainCreateTestDomains(5);
  $this->domains = $domains = \Drupal::entityTypeManager()
    ->getStorage('domain')
    ->loadMultiple();
}