You are here

public function DomainSiteSettingsUiTest::testAdminList in Domain Site Settings 8

Tests that the home page loads with a 200 response.

File

tests/src/Functional/DomainSiteSettingsUiTest.php, line 47

Class

DomainSiteSettingsUiTest
Tests UI pages.

Namespace

Drupal\Tests\domain_site_settings\Functional

Code

public function testAdminList() {

  // The anonymous user doesn't have the permission to access this page.
  $this
    ->drupalGet('admin/config/domain/domain_site_settings');
  $this
    ->assertSession()
    ->statusCodeEquals(403);
  $this
    ->drupalLogin($this->adminUser);
  $this
    ->drupalGet('admin/config/domain/domain_site_settings');
  $this
    ->assertSession()
    ->statusCodeEquals(200);
  $this
    ->assertSession()
    ->pageTextContains('Domains sites list');
  $this
    ->assertSession()
    ->pageTextNotContains('Foo');

  // Create a new domain.
  $domain = Domain::create([
    'id' => 'foo',
    'hostname' => 'foo.example.com',
    'name' => 'Foo',
    'scheme' => 'http',
  ]);
  $domain
    ->save();

  // Check domain specific content.
  $this
    ->drupalGet('admin/config/domain/domain_site_settings');
  $this
    ->assertSession()
    ->pageTextContains('Foo');
}