function BigPipeRegressionTest::testMessages_2712935
Same name in other branches
- 9 core/modules/big_pipe/tests/src/FunctionalJavascript/BigPipeRegressionTest.php \Drupal\Tests\big_pipe\FunctionalJavascript\BigPipeRegressionTest::testMessages_2712935()
- 8.9.x core/modules/big_pipe/tests/src/FunctionalJavascript/BigPipeRegressionTest.php \Drupal\Tests\big_pipe\FunctionalJavascript\BigPipeRegressionTest::testMessages_2712935()
- 10 core/modules/big_pipe/tests/src/FunctionalJavascript/BigPipeRegressionTest.php \Drupal\Tests\big_pipe\FunctionalJavascript\BigPipeRegressionTest::testMessages_2712935()
Ensure messages set in placeholders always appear.
See also
https://www.drupal.org/node/2712935
File
-
core/
modules/ big_pipe/ tests/ src/ FunctionalJavascript/ BigPipeRegressionTest.php, line 82
Class
- BigPipeRegressionTest
- BigPipe regression tests.
Namespace
Drupal\Tests\big_pipe\FunctionalJavascriptCode
public function testMessages_2712935() : void {
$this->assertTrue($this->container
->get('module_installer')
->install([
'render_placeholder_message_test',
], TRUE), 'Installed modules.');
$this->drupalLogin($this->drupalCreateUser());
$messages_markup = '<div class="messages messages--status" role="status"';
$test_routes = [
// Messages placeholder rendered first.
'render_placeholder_message_test.first',
// Messages placeholder rendered after one, before another.
'render_placeholder_message_test.middle',
// Messages placeholder rendered last.
'render_placeholder_message_test.last',
];
$assert = $this->assertSession();
foreach ($test_routes as $route) {
// Verify that we start off with zero messages queued.
$this->drupalGet(Url::fromRoute('render_placeholder_message_test.queued'));
$assert->responseNotContains($messages_markup);
// Verify the test case at this route behaves as expected.
$this->drupalGet(Url::fromRoute($route));
$assert->elementContains('css', 'p.logged-message:nth-of-type(1)', 'Message: P1');
$assert->elementContains('css', 'p.logged-message:nth-of-type(2)', 'Message: P2');
$assert->responseContains($messages_markup);
$assert->elementExists('css', 'div[aria-label="Status message"]');
$assert->responseContains('aria-label="Status message">P1');
$assert->responseContains('aria-label="Status message">P2');
// Verify that we end with all messages printed, hence again zero queued.
$this->drupalGet(Url::fromRoute('render_placeholder_message_test.queued'));
$assert->responseNotContains($messages_markup);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.