DomainPathTestBase.php in Domain Path 8
File
tests/src/Functional/DomainPathTestBase.php
View source
<?php
namespace Drupal\Tests\domain_path\Functional;
use Drupal\Tests\domain\Functional\DomainTestBase;
abstract class DomainPathTestBase extends DomainTestBase {
protected $domains;
public $base_hostname;
public static $modules = [
'domain_path',
'field',
'node',
'user',
'path',
'system',
];
protected $profile = 'standard';
protected function setUp() {
parent::setUp();
if ($this->profile != 'standard') {
$this
->drupalCreateContentType([
'type' => 'page',
'name' => 'Basic page',
]);
}
$this
->domainCreateTestDomains(2);
$this->domains = $this
->getDomains();
$this
->domainPathBasicSetup();
}
public function domainPathBasicSetup() {
$admin = $this
->drupalCreateUser([
'bypass node access',
'administer content types',
'administer users',
'administer node fields',
'administer node display',
'administer domains',
'administer url aliases',
'administer domain paths',
'edit domain path entity',
'add domain paths',
'edit domain paths',
'delete domain paths',
]);
$this
->drupalLogin($admin);
$this
->config('domain_path.settings')
->set('entity_types', [
'node' => TRUE,
])
->save();
$this
->drupalGet('admin/config/domain_path/domain_path_settings');
$this
->assertSession()
->statusCodeEquals(200);
}
public function domainPathTableIsEmpty() {
$domain_path_storage = \Drupal::service('entity_type.manager')
->getStorage('domain_path');
$domain_paths = $domain_path_storage
->loadMultiple();
$this
->assertTrue(empty($domain_paths), 'No domain paths have been created.');
}
}