You are here

protected function ActiveDomainDefaultArgumentTest::createTestData in Domain Access 8

1 call to ActiveDomainDefaultArgumentTest::createTestData()
ActiveDomainDefaultArgumentTest::setUp in domain/tests/src/Functional/Views/ActiveDomainDefaultArgumentTest.php

File

domain/tests/src/Functional/Views/ActiveDomainDefaultArgumentTest.php, line 48

Class

ActiveDomainDefaultArgumentTest
Tests the active_domain default argument.

Namespace

Drupal\Tests\domain\Functional\Views

Code

protected function createTestData() {
  foreach ($this
    ->getDomains() as $domain_id => $domain) {
    $nodes_count = random_int(1, 5);
    while ($nodes_count !== 0) {
      $node = $this
        ->drupalCreateNode([
        'type' => 'article',
        'title' => $this
          ->randomString(),
        DomainAccessManagerInterface::DOMAIN_ACCESS_FIELD => $domain_id,
      ]);
      $this->data[$domain_id][] = $node
        ->id();
      $nodes_count--;
    }
  }
}