class AjaxMaintenanceModeTest
Same name and namespace in other branches
- 11.x core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxMaintenanceModeTest.php \Drupal\FunctionalJavascriptTests\Ajax\AjaxMaintenanceModeTest
Tests maintenance message during an AJAX call.
@group Ajax
Hierarchy
- class \Drupal\FunctionalJavascriptTests\Ajax\AjaxMaintenanceModeTest
Expanded class hierarchy of AjaxMaintenanceModeTest
File
-
core/
tests/ Drupal/ FunctionalJavascriptTests/ Ajax/ AjaxMaintenanceModeTest.php, line 17
Namespace
Drupal\FunctionalJavascriptTests\AjaxView source
class AjaxMaintenanceModeTest extends WebDriverTestBase {
use FieldUiTestTrait;
use FileFieldCreationTrait;
use TestFileCreationTrait;
/**
* An user with administration permissions.
*
* @var \Drupal\user\UserInterface
*/
protected $adminUser;
/**
* {@inheritdoc}
*/
protected static $modules = [
'ajax_test',
];
/**
* {@inheritdoc}
*/
protected $defaultTheme = 'stark';
/**
* {@inheritdoc}
*/
protected function setUp() : void {
parent::setUp();
$this->adminUser = $this->drupalCreateUser([
'access administration pages',
'administer site configuration',
'access site in maintenance mode',
]);
$this->drupalLogin($this->adminUser);
}
/**
* Tests maintenance message only appears once on an AJAX call.
*/
public function testAjaxCallMaintenanceMode() : void {
$page = $this->getSession()
->getPage();
$assert_session = $this->assertSession();
\Drupal::state()->set('system.maintenance_mode', TRUE);
$this->drupalGet('ajax-test/insert-inline-wrapper');
$assert_session->pageTextContains('Target inline');
$page->clickLink('Link html pre-wrapped-div');
$this->assertSession()
->assertWaitOnAjaxRequest();
$this->assertSession()
->pageTextContainsOnce('Operating in maintenance mode');
}
}
Members
Title Sort descending | Modifiers | Object type | Summary |
---|---|---|---|
AjaxMaintenanceModeTest::$adminUser | protected | property | An user with administration permissions. |
AjaxMaintenanceModeTest::$defaultTheme | protected | property | The theme to install as the default for testing. |
AjaxMaintenanceModeTest::$modules | protected static | property | Modules to install. |
AjaxMaintenanceModeTest::setUp | protected | function | |
AjaxMaintenanceModeTest::testAjaxCallMaintenanceMode | public | function | Tests maintenance message only appears once on an AJAX call. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.