public function DomainAliasTestTrait::domainAliasCreateTestAlias in Domain Access 8
Creates an alias for testing without passing values.
Parameters
\Drupal\domain\DomainInterface $domain: A domain entity.
string $pattern: An optional alias pattern.
int $redirect: An optional redirect (301 or 302).
int $environment: An optional environment string.
bool $save: Whether to save the alias or return for validation.
Return value
\Drupal\domain_alias\Entity\DomainAlias A domain alias entity.
2 calls to DomainAliasTestTrait::domainAliasCreateTestAlias()
- DomainAliasNegotiatorTest::testDomainAliasNegotiator in domain_alias/
tests/ src/ Functional/ DomainAliasNegotiatorTest.php - Tests the handling of aliased requests.
- DomainAliasValidatorTest::testDomainAliasValidator in domain_alias/
tests/ src/ Functional/ DomainAliasValidatorTest.php - Tests that a domain hostname validates.
File
- domain_alias/
tests/ src/ Traits/ DomainAliasTestTrait.php, line 53
Class
- DomainAliasTestTrait
- Contains helper classes for tests to set up various configuration.
Namespace
Drupal\Tests\domain_alias\TraitsCode
public function domainAliasCreateTestAlias(DomainInterface $domain, $pattern = NULL, $redirect = 0, $environment = 'default', $save = TRUE) {
if (empty($pattern)) {
$pattern = '*.' . $domain
->getHostname();
}
$values = [
'domain_id' => $domain
->id(),
'pattern' => $pattern,
'redirect' => $redirect,
'environment' => $environment,
];
return $this
->createDomainAlias($values, $save);
}