Loading core/modules/big_pipe/tests/src/Functional/BigPipeTest.php +3 −3 Original line number Diff line number Diff line Loading @@ -376,13 +376,13 @@ protected function assertBigPipePlaceholders(array $expected_big_pipe_placeholde $placeholder_positions[$pos] = $big_pipe_placeholder_id; // Verify expected placeholder replacement. $expected_placeholder_replacement = '<script type="application/vnd.drupal-ajax" data-big-pipe-replacement-for-placeholder-with-id="' . $big_pipe_placeholder_id . '">'; $result = $this->xpath('//script[@data-big-pipe-replacement-for-placeholder-with-id=:id]', [':id' => Html::decodeEntities($big_pipe_placeholder_id)]); $xpath = '//script[@data-big-pipe-replacement-for-placeholder-with-id="' . Html::decodeEntities($big_pipe_placeholder_id) . '"]'; if ($expected_ajax_response === NULL) { $this->assertCount(0, $result); $this->assertSession()->elementNotExists('xpath', $xpath); $this->assertSession()->responseNotContains($expected_placeholder_replacement); continue; } $this->assertEquals($expected_ajax_response, trim($result[0]->getText())); $this->assertSession()->elementTextContains('xpath', $xpath, $expected_ajax_response); $this->assertSession()->responseContains($expected_placeholder_replacement); $pos = strpos($this->getSession()->getPage()->getContent(), $expected_placeholder_replacement); $placeholder_replacement_positions[$pos] = $big_pipe_placeholder_id; Loading core/modules/block/tests/src/Functional/AssertBlockAppearsTrait.php +2 −4 Original line number Diff line number Diff line Loading @@ -18,8 +18,7 @@ trait AssertBlockAppearsTrait { * The block entity to find on the page. */ protected function assertBlockAppears(Block $block) { $result = $this->findBlockInstance($block); $this->assertNotEmpty($result, sprintf('The block %s should appear on the page.', $block->id())); $this->assertSession()->elementExists('xpath', "//div[@id = 'block-{$block->id()}']"); } /** Loading @@ -29,8 +28,7 @@ protected function assertBlockAppears(Block $block) { * The block entity to find on the page. */ protected function assertNoBlockAppears(Block $block) { $result = $this->findBlockInstance($block); $this->assertEmpty($result, sprintf('The block %s should not appear on the page.', $block->id())); $this->assertSession()->elementNotExists('xpath', "//div[@id = 'block-{$block->id()}']"); } /** Loading core/modules/block/tests/src/Functional/BlockHtmlTest.php +1 −2 Original line number Diff line number Diff line Loading @@ -48,8 +48,7 @@ public function testHtml() { $this->assertSession()->elementExists('xpath', '//div[@id="block-test-html-block" and @data-custom-attribute="foo"]'); // Ensure expected markup for a menu block. $elements = $this->xpath('//nav[@id="block-test-menu-block"]/ul/li'); $this->assertNotEmpty($elements, 'The proper block markup was found.'); $this->assertSession()->elementExists('xpath', '//nav[@id="block-test-menu-block"]/ul/li'); } } core/modules/block/tests/src/Functional/BlockLanguageTest.php +1 −2 Original line number Diff line number Diff line Loading @@ -135,8 +135,7 @@ public function testLanguageBlockVisibilityLanguageDelete() { // Ensure that the block visibility for language is gone from the UI. $this->drupalGet('admin/structure/block'); $this->clickLink('Configure'); $elements = $this->xpath('//details[@id="edit-visibility-language"]'); $this->assertEmpty($elements); $this->assertSession()->elementNotExists('xpath', '//details[@id="edit-visibility-language"]'); } /** Loading core/modules/block/tests/src/Functional/BlockSystemBrandingTest.php +17 −21 Original line number Diff line number Diff line Loading @@ -44,12 +44,11 @@ public function testSystemBrandingSettings() { // Set default block settings. $this->drupalGet(''); $site_logo_element = $this->xpath($site_logo_xpath); $site_name_element = $this->xpath($site_name_xpath); // Test that all branding elements are displayed. $this->assertNotEmpty($site_logo_element, 'The branding block logo was found.'); $this->assertNotEmpty($site_name_element, 'The branding block site name was found.'); $this->assertSession()->elementExists('xpath', $site_logo_xpath); $this->assertSession()->elementExists('xpath', $site_name_xpath); $this->assertSession()->elementExists('xpath', $site_slogan_xpath); $this->assertSession()->elementTextContains('xpath', $site_slogan_xpath, 'Community plumbing'); $this->assertSession()->responseHeaderContains('X-Drupal-Cache-Tags', 'config:system.site'); // Just this once, assert that the img src of the logo is as expected. Loading @@ -61,18 +60,18 @@ public function testSystemBrandingSettings() { ->set('slogan', '<script>alert("Community carpentry");</script>') ->save(); $this->drupalGet(''); $this->assertSession()->elementTextContains('xpath', $site_slogan_xpath, 'alert("Community carpentry");'); $this->assertSession()->elementTextEquals('xpath', $site_slogan_xpath, 'alert("Community carpentry");'); $this->assertSession()->responseNotContains('<script>alert("Community carpentry");</script>'); // Turn just the logo off. $this->config('block.block.site-branding') ->set('settings.use_site_logo', 0) ->save(); $this->drupalGet(''); $site_logo_element = $this->xpath($site_logo_xpath); $site_name_element = $this->xpath($site_name_xpath); // Re-test all branding elements. $this->assertEmpty($site_logo_element, 'The branding block logo was disabled.'); $this->assertNotEmpty($site_name_element, 'The branding block site name was found.'); $this->assertSession()->elementNotExists('xpath', $site_logo_xpath); $this->assertSession()->elementExists('xpath', $site_name_xpath); $this->assertSession()->elementTextContains('xpath', $site_slogan_xpath, 'alert("Community carpentry");'); $this->assertSession()->responseNotContains('<script>alert("Community carpentry");</script>'); $this->assertSession()->responseHeaderContains('X-Drupal-Cache-Tags', 'config:system.site'); Loading @@ -83,11 +82,10 @@ public function testSystemBrandingSettings() { ->set('settings.use_site_name', 0) ->save(); $this->drupalGet(''); $site_logo_element = $this->xpath($site_logo_xpath); $site_name_element = $this->xpath($site_name_xpath); // Re-test all branding elements. $this->assertNotEmpty($site_logo_element, 'The branding block logo was found.'); $this->assertEmpty($site_name_element, 'The branding block site name was disabled.'); $this->assertSession()->elementExists('xpath', $site_logo_xpath); $this->assertSession()->elementNotExists('xpath', $site_name_xpath); $this->assertSession()->elementTextContains('xpath', $site_slogan_xpath, 'alert("Community carpentry");'); $this->assertSession()->responseNotContains('<script>alert("Community carpentry");</script>'); $this->assertSession()->responseHeaderContains('X-Drupal-Cache-Tags', 'config:system.site'); Loading @@ -98,11 +96,10 @@ public function testSystemBrandingSettings() { ->set('settings.use_site_slogan', 0) ->save(); $this->drupalGet(''); $site_logo_element = $this->xpath($site_logo_xpath); $site_name_element = $this->xpath($site_name_xpath); // Re-test all branding elements. $this->assertNotEmpty($site_logo_element, 'The branding block logo was found.'); $this->assertNotEmpty($site_name_element, 'The branding block site name was found.'); $this->assertSession()->elementExists('xpath', $site_logo_xpath); $this->assertSession()->elementExists('xpath', $site_name_xpath); $this->assertSession()->elementTextNotContains('xpath', $site_slogan_xpath, 'Community carpentry'); $this->assertSession()->responseHeaderContains('X-Drupal-Cache-Tags', 'config:system.site'); Loading @@ -112,11 +109,10 @@ public function testSystemBrandingSettings() { ->set('settings.use_site_slogan', 0) ->save(); $this->drupalGet(''); $site_logo_element = $this->xpath($site_logo_xpath); $site_name_element = $this->xpath($site_name_xpath); // Re-test all branding elements. $this->assertNotEmpty($site_logo_element, 'The branding block logo was found.'); $this->assertEmpty($site_name_element, 'The branding block site name was disabled.'); $this->assertSession()->elementExists('xpath', $site_logo_xpath); $this->assertSession()->elementNotExists('xpath', $site_name_xpath); $this->assertSession()->elementTextNotContains('xpath', $site_slogan_xpath, 'Community carpentry'); $this->assertSession()->responseHeaderContains('X-Drupal-Cache-Tags', 'config:system.site'); } Loading Loading
core/modules/big_pipe/tests/src/Functional/BigPipeTest.php +3 −3 Original line number Diff line number Diff line Loading @@ -376,13 +376,13 @@ protected function assertBigPipePlaceholders(array $expected_big_pipe_placeholde $placeholder_positions[$pos] = $big_pipe_placeholder_id; // Verify expected placeholder replacement. $expected_placeholder_replacement = '<script type="application/vnd.drupal-ajax" data-big-pipe-replacement-for-placeholder-with-id="' . $big_pipe_placeholder_id . '">'; $result = $this->xpath('//script[@data-big-pipe-replacement-for-placeholder-with-id=:id]', [':id' => Html::decodeEntities($big_pipe_placeholder_id)]); $xpath = '//script[@data-big-pipe-replacement-for-placeholder-with-id="' . Html::decodeEntities($big_pipe_placeholder_id) . '"]'; if ($expected_ajax_response === NULL) { $this->assertCount(0, $result); $this->assertSession()->elementNotExists('xpath', $xpath); $this->assertSession()->responseNotContains($expected_placeholder_replacement); continue; } $this->assertEquals($expected_ajax_response, trim($result[0]->getText())); $this->assertSession()->elementTextContains('xpath', $xpath, $expected_ajax_response); $this->assertSession()->responseContains($expected_placeholder_replacement); $pos = strpos($this->getSession()->getPage()->getContent(), $expected_placeholder_replacement); $placeholder_replacement_positions[$pos] = $big_pipe_placeholder_id; Loading
core/modules/block/tests/src/Functional/AssertBlockAppearsTrait.php +2 −4 Original line number Diff line number Diff line Loading @@ -18,8 +18,7 @@ trait AssertBlockAppearsTrait { * The block entity to find on the page. */ protected function assertBlockAppears(Block $block) { $result = $this->findBlockInstance($block); $this->assertNotEmpty($result, sprintf('The block %s should appear on the page.', $block->id())); $this->assertSession()->elementExists('xpath', "//div[@id = 'block-{$block->id()}']"); } /** Loading @@ -29,8 +28,7 @@ protected function assertBlockAppears(Block $block) { * The block entity to find on the page. */ protected function assertNoBlockAppears(Block $block) { $result = $this->findBlockInstance($block); $this->assertEmpty($result, sprintf('The block %s should not appear on the page.', $block->id())); $this->assertSession()->elementNotExists('xpath', "//div[@id = 'block-{$block->id()}']"); } /** Loading
core/modules/block/tests/src/Functional/BlockHtmlTest.php +1 −2 Original line number Diff line number Diff line Loading @@ -48,8 +48,7 @@ public function testHtml() { $this->assertSession()->elementExists('xpath', '//div[@id="block-test-html-block" and @data-custom-attribute="foo"]'); // Ensure expected markup for a menu block. $elements = $this->xpath('//nav[@id="block-test-menu-block"]/ul/li'); $this->assertNotEmpty($elements, 'The proper block markup was found.'); $this->assertSession()->elementExists('xpath', '//nav[@id="block-test-menu-block"]/ul/li'); } }
core/modules/block/tests/src/Functional/BlockLanguageTest.php +1 −2 Original line number Diff line number Diff line Loading @@ -135,8 +135,7 @@ public function testLanguageBlockVisibilityLanguageDelete() { // Ensure that the block visibility for language is gone from the UI. $this->drupalGet('admin/structure/block'); $this->clickLink('Configure'); $elements = $this->xpath('//details[@id="edit-visibility-language"]'); $this->assertEmpty($elements); $this->assertSession()->elementNotExists('xpath', '//details[@id="edit-visibility-language"]'); } /** Loading
core/modules/block/tests/src/Functional/BlockSystemBrandingTest.php +17 −21 Original line number Diff line number Diff line Loading @@ -44,12 +44,11 @@ public function testSystemBrandingSettings() { // Set default block settings. $this->drupalGet(''); $site_logo_element = $this->xpath($site_logo_xpath); $site_name_element = $this->xpath($site_name_xpath); // Test that all branding elements are displayed. $this->assertNotEmpty($site_logo_element, 'The branding block logo was found.'); $this->assertNotEmpty($site_name_element, 'The branding block site name was found.'); $this->assertSession()->elementExists('xpath', $site_logo_xpath); $this->assertSession()->elementExists('xpath', $site_name_xpath); $this->assertSession()->elementExists('xpath', $site_slogan_xpath); $this->assertSession()->elementTextContains('xpath', $site_slogan_xpath, 'Community plumbing'); $this->assertSession()->responseHeaderContains('X-Drupal-Cache-Tags', 'config:system.site'); // Just this once, assert that the img src of the logo is as expected. Loading @@ -61,18 +60,18 @@ public function testSystemBrandingSettings() { ->set('slogan', '<script>alert("Community carpentry");</script>') ->save(); $this->drupalGet(''); $this->assertSession()->elementTextContains('xpath', $site_slogan_xpath, 'alert("Community carpentry");'); $this->assertSession()->elementTextEquals('xpath', $site_slogan_xpath, 'alert("Community carpentry");'); $this->assertSession()->responseNotContains('<script>alert("Community carpentry");</script>'); // Turn just the logo off. $this->config('block.block.site-branding') ->set('settings.use_site_logo', 0) ->save(); $this->drupalGet(''); $site_logo_element = $this->xpath($site_logo_xpath); $site_name_element = $this->xpath($site_name_xpath); // Re-test all branding elements. $this->assertEmpty($site_logo_element, 'The branding block logo was disabled.'); $this->assertNotEmpty($site_name_element, 'The branding block site name was found.'); $this->assertSession()->elementNotExists('xpath', $site_logo_xpath); $this->assertSession()->elementExists('xpath', $site_name_xpath); $this->assertSession()->elementTextContains('xpath', $site_slogan_xpath, 'alert("Community carpentry");'); $this->assertSession()->responseNotContains('<script>alert("Community carpentry");</script>'); $this->assertSession()->responseHeaderContains('X-Drupal-Cache-Tags', 'config:system.site'); Loading @@ -83,11 +82,10 @@ public function testSystemBrandingSettings() { ->set('settings.use_site_name', 0) ->save(); $this->drupalGet(''); $site_logo_element = $this->xpath($site_logo_xpath); $site_name_element = $this->xpath($site_name_xpath); // Re-test all branding elements. $this->assertNotEmpty($site_logo_element, 'The branding block logo was found.'); $this->assertEmpty($site_name_element, 'The branding block site name was disabled.'); $this->assertSession()->elementExists('xpath', $site_logo_xpath); $this->assertSession()->elementNotExists('xpath', $site_name_xpath); $this->assertSession()->elementTextContains('xpath', $site_slogan_xpath, 'alert("Community carpentry");'); $this->assertSession()->responseNotContains('<script>alert("Community carpentry");</script>'); $this->assertSession()->responseHeaderContains('X-Drupal-Cache-Tags', 'config:system.site'); Loading @@ -98,11 +96,10 @@ public function testSystemBrandingSettings() { ->set('settings.use_site_slogan', 0) ->save(); $this->drupalGet(''); $site_logo_element = $this->xpath($site_logo_xpath); $site_name_element = $this->xpath($site_name_xpath); // Re-test all branding elements. $this->assertNotEmpty($site_logo_element, 'The branding block logo was found.'); $this->assertNotEmpty($site_name_element, 'The branding block site name was found.'); $this->assertSession()->elementExists('xpath', $site_logo_xpath); $this->assertSession()->elementExists('xpath', $site_name_xpath); $this->assertSession()->elementTextNotContains('xpath', $site_slogan_xpath, 'Community carpentry'); $this->assertSession()->responseHeaderContains('X-Drupal-Cache-Tags', 'config:system.site'); Loading @@ -112,11 +109,10 @@ public function testSystemBrandingSettings() { ->set('settings.use_site_slogan', 0) ->save(); $this->drupalGet(''); $site_logo_element = $this->xpath($site_logo_xpath); $site_name_element = $this->xpath($site_name_xpath); // Re-test all branding elements. $this->assertNotEmpty($site_logo_element, 'The branding block logo was found.'); $this->assertEmpty($site_name_element, 'The branding block site name was disabled.'); $this->assertSession()->elementExists('xpath', $site_logo_xpath); $this->assertSession()->elementNotExists('xpath', $site_name_xpath); $this->assertSession()->elementTextNotContains('xpath', $site_slogan_xpath, 'Community carpentry'); $this->assertSession()->responseHeaderContains('X-Drupal-Cache-Tags', 'config:system.site'); } Loading