function AjaxMaintenanceModeTest::testAjaxCallMaintenanceMode

Same name in other branches
  1. 10 core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxMaintenanceModeTest.php \Drupal\FunctionalJavascriptTests\Ajax\AjaxMaintenanceModeTest::testAjaxCallMaintenanceMode()

Tests maintenance message only appears once on an AJAX call.

File

core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxMaintenanceModeTest.php, line 56

Class

AjaxMaintenanceModeTest
Tests maintenance message during an AJAX call.

Namespace

Drupal\FunctionalJavascriptTests\Ajax

Code

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');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.