public function DomainConfigUiSavedConfigTest::testSavedConfig in Domain Access 8
Tests that we can save domain and language-specific settings.
File
- domain_config_ui/
tests/ src/ FunctionalJavascript/ DomainConfigUiSavedConfigTest.php, line 64
Class
- DomainConfigUiSavedConfigTest
- Tests the domain config inspector.
Namespace
Drupal\Tests\domain_config_ui\FunctionalJavascriptCode
public function testSavedConfig() {
$this
->drupalLogin($this->adminUser);
$path = '/admin/config/system/site-information';
// Visit the site information page.
$this
->drupalGet($path);
$page = $this
->getSession()
->getPage();
// Test our form.
$page
->findField('domain');
$page
->findField('language');
$page
->selectFieldOption('domain', 'one_example_com');
$this
->assertSession()
->assertWaitOnAjaxRequest();
$this
->htmlOutput($page
->getHtml());
$page = $this
->getSession()
->getPage();
$page
->fillField('site_name', 'New name');
$page
->fillField('site_frontpage', '/user');
$this
->htmlOutput($page
->getHtml());
$page
->pressButton('Save configuration');
$this
->htmlOutput($page
->getHtml());
// Now let's save a language.
// Visit the site information page.
$this
->drupalGet($path);
$page = $this
->getSession()
->getPage();
// Test our form.
$page
->selectFieldOption('domain', 'one_example_com');
$this
->assertSession()
->assertWaitOnAjaxRequest();
$this
->htmlOutput($page
->getHtml());
$page = $this
->getSession()
->getPage();
$page
->selectFieldOption('language', 'es');
$this
->assertSession()
->assertWaitOnAjaxRequest();
$this
->htmlOutput($page
->getHtml());
$page = $this
->getSession()
->getPage();
$page
->fillField('site_name', 'Neuvo nombre');
$page
->fillField('site_frontpage', '/user');
$this
->htmlOutput($page
->getHtml());
$page
->pressButton('Save configuration');
$this
->htmlOutput($page
->getHtml());
// Now, head to /admin/config/domain/config-ui/list.
$path = '/admin/config/domain/config-ui/list';
$this
->drupalGet($path);
$page = $this
->getSession()
->getPage();
$this
->htmlOutput($page
->getHtml());
$this
->assertSession()
->pageTextContains('Saved configuration');
$this
->assertSession()
->pageTextContains('domain.config.one_example_com.system.site');
$this
->assertSession()
->pageTextContains('domain.config.one_example_com.es.system.site');
$this
->assertSession()
->pageTextNotContains('domain.config.example_com.en.system.site');
$page
->findLink('Inspect');
$page
->clickLink('Inspect');
$page = $this
->getSession()
->getPage();
$this
->htmlOutput($page
->getHtml());
$this
->assertSession()
->pageTextContains('domain.config.one_example_com.es.system.site');
$this
->assertSession()
->pageTextContains('Neuvo nombre');
$path = '/admin/config/domain/config_ui/inspect/domain.config.one_example_com.system.site';
$this
->drupalGet($path);
$page = $this
->getSession()
->getPage();
$this
->htmlOutput($page
->getHtml());
$this
->assertSession()
->pageTextContains('domain.config.one_example_com.system.site');
$this
->assertSession()
->pageTextContains('New name');
$path = '/admin/config/domain/config_ui/delete/domain.config.one_example_com.system.site';
$this
->drupalGet($path);
$page = $this
->getSession()
->getPage();
$this
->htmlOutput($page
->getHtml());
$this
->assertSession()
->pageTextContains('Are you sure you want to delete the configuration override: domain.config.one_example_com.system.site?');
$page
->findButton('Delete configuration');
$page
->pressButton('Delete configuration');
// Now, head to /admin/config/domain/config-ui/list.
$path = '/admin/config/domain/config-ui/list';
$this
->drupalGet($path);
$page = $this
->getSession()
->getPage();
$this
->htmlOutput($page
->getHtml());
$this
->assertSession()
->pageTextContains('Saved configuration');
$this
->assertSession()
->pageTextNotContains('domain.config.one_example_com.system.site');
$this
->assertSession()
->pageTextContains('domain.config.one_example_com.es.system.site');
$this
->assertSession()
->pageTextNotContains('domain.config.example_com.en.system.site');
}