You are here

public function DomainContentTestBase::createDomainContent in Domain Access 8

Creates dummy content for testing.

25 nodes, 5 per domain and 5 to all affiliates.

3 calls to DomainContentTestBase::createDomainContent()
DomainContentActionsTest::testDomainContentActions in domain_content/tests/src/Functional/DomainContentActionsTest.php
Tests domain content actions.
DomainContentCountTest::testDomainContentCount in domain_content/tests/src/Functional/DomainContentCountTest.php
Tests domain content count.
DomainContentPermissionsTest::testDomainContentPermissions in domain_content/tests/src/Functional/DomainContentPermissionsTest.php
Tests domain content permissions.

File

domain_content/tests/src/Functional/DomainContentTestBase.php, line 44

Class

DomainContentTestBase
Base class and helper methods for testing domain content.

Namespace

Drupal\Tests\domain_content\Functional

Code

public function createDomainContent() {
  foreach ($this->domains as $id => $domain) {
    for ($i = 0; $i < 5; $i++) {
      $this
        ->drupalCreateNode([
        'type' => 'article',
        DomainAccessManagerInterface::DOMAIN_ACCESS_FIELD => [
          $id,
        ],
        DomainAccessManagerInterface::DOMAIN_ACCESS_ALL_FIELD => $id == 'one_example_com' ? 1 : 0,
      ]);
    }
  }

  // Rebuild node access rules.
  node_access_rebuild();
}