public function DomainContentTestBase::createDomainUsers in Domain Access 8
Creates dummy content for testing.
25 users, 5 per domain and 5 to all affiliates.
2 calls to DomainContentTestBase::createDomainUsers()
- 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 63
Class
- DomainContentTestBase
- Base class and helper methods for testing domain content.
Namespace
Drupal\Tests\domain_content\FunctionalCode
public function createDomainUsers() {
foreach ($this->domains as $id => $domain) {
for ($i = 0; $i < 5; $i++) {
$account[$id] = $this
->drupalCreateUser([
'access administration pages',
'access domain content',
'access domain content editors',
'publish to any domain',
'assign editors to any domain',
]);
$this
->addDomainsToEntity('user', $account[$id]
->id(), $id, DomainAccessManagerInterface::DOMAIN_ACCESS_FIELD);
if ($id == 'one_example_com') {
$this
->addDomainsToEntity('user', $account[$id]
->id(), 1, DomainAccessManagerInterface::DOMAIN_ACCESS_ALL_FIELD);
}
}
}
}