Commit cef0c900 authored by catch's avatar catch
Browse files

Issue #3227060 by mondrake, ankithashetty, daffie, catch: [backport] Replace...

Issue #3227060 by mondrake, ankithashetty, daffie, catch: [backport] Replace usages of AssertLegacyTrait::assertNoRaw, that is deprecated
parent e7e84162
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -66,7 +66,7 @@ public function testFeedLabelEscaping() {
    $this->assertSession()->statusCodeEquals(200);

    $this->assertSession()->assertEscaped('Test feed title <script>alert(123);</script>');
    $this->assertNoRaw('Test feed title <script>alert(123);</script>');
    $this->assertSession()->responseNotContains('Test feed title <script>alert(123);</script>');

    // Ensure the feed icon title is escaped.
    $this->assertStringContainsString('class="feed-icon">  Subscribe to Test feed title &lt;script&gt;alert(123);&lt;/script&gt; feed</a>', str_replace(["\n", "\r"], '', $this->getSession()->getPage()->getContent()));
+22 −22
Original line number Diff line number Diff line
@@ -87,18 +87,18 @@ public function testNoJsDetection() {
    $this->drupalGet(Url::fromRoute('<front>'));
    $this->assertSessionCookieExists(FALSE);
    $this->assertBigPipeNoJsCookieExists(FALSE);
    $this->assertNoRaw('<noscript><meta http-equiv="Refresh" content="0; URL=');
    $this->assertNoRaw($no_js_to_js_markup);
    $this->assertSession()->responseNotContains('<noscript><meta http-equiv="Refresh" content="0; URL=');
    $this->assertSession()->responseNotContains($no_js_to_js_markup);

    // 2. Session (authenticated).
    $this->drupalLogin($this->rootUser);
    $this->assertSessionCookieExists(TRUE);
    $this->assertBigPipeNoJsCookieExists(FALSE);
    $this->assertRaw('<noscript><meta http-equiv="Refresh" content="0; URL=' . base_path() . 'big_pipe/no-js?destination=' . base_path() . 'user/1" />' . "\n" . '</noscript>');
    $this->assertNoRaw($no_js_to_js_markup);
    $this->assertSession()->responseNotContains($no_js_to_js_markup);
    $this->assertBigPipeNoJsMetaRefreshRedirect();
    $this->assertBigPipeNoJsCookieExists(TRUE);
    $this->assertNoRaw('<noscript><meta http-equiv="Refresh" content="0; URL=');
    $this->assertSession()->responseNotContains('<noscript><meta http-equiv="Refresh" content="0; URL=');
    $this->assertRaw($no_js_to_js_markup);
    $this->drupalLogout();

@@ -111,10 +111,10 @@ public function testNoJsDetection() {
    $this->assertSessionCookieExists(TRUE);
    $this->assertBigPipeNoJsCookieExists(FALSE);
    $this->assertRaw('<noscript><meta http-equiv="Refresh" content="0; URL=' . base_path() . 'big_pipe/no-js?destination=' . base_path() . 'user/login" />' . "\n" . '</noscript>');
    $this->assertNoRaw($no_js_to_js_markup);
    $this->assertSession()->responseNotContains($no_js_to_js_markup);
    $this->assertBigPipeNoJsMetaRefreshRedirect();
    $this->assertBigPipeNoJsCookieExists(TRUE);
    $this->assertNoRaw('<noscript><meta http-equiv="Refresh" content="0; URL=');
    $this->assertSession()->responseNotContains('<noscript><meta http-equiv="Refresh" content="0; URL=');
    $this->assertRaw($no_js_to_js_markup);

    // Close the prior connection and remove the collected state.
@@ -124,14 +124,14 @@ public function testNoJsDetection() {
    $this->drupalGet(Url::fromRoute('no_big_pipe'));
    $this->assertSessionCookieExists(FALSE);
    $this->assertBigPipeNoJsCookieExists(FALSE);
    $this->assertNoRaw('<noscript><meta http-equiv="Refresh" content="0; URL=');
    $this->assertNoRaw($no_js_to_js_markup);
    $this->assertSession()->responseNotContains('<noscript><meta http-equiv="Refresh" content="0; URL=');
    $this->assertSession()->responseNotContains($no_js_to_js_markup);
    $this->drupalLogin($this->rootUser);
    $this->drupalGet(Url::fromRoute('no_big_pipe'));
    $this->assertSessionCookieExists(TRUE);
    $this->assertBigPipeNoJsCookieExists(FALSE);
    $this->assertNoRaw('<noscript><meta http-equiv="Refresh" content="0; URL=');
    $this->assertNoRaw($no_js_to_js_markup);
    $this->assertSession()->responseNotContains('<noscript><meta http-equiv="Refresh" content="0; URL=');
    $this->assertSession()->responseNotContains($no_js_to_js_markup);
  }

  /**
@@ -214,8 +214,8 @@ public function testBigPipe() {
    $this->assertRaw('The website encountered an unexpected error. Please try again later');
    $this->assertRaw('You are not allowed to say llamas are not cool!');
    // Check that stop signal and closing body tag are absent.
    $this->assertNoRaw(BigPipe::STOP_SIGNAL);
    $this->assertNoRaw('</body>');
    $this->assertSession()->responseNotContains(BigPipe::STOP_SIGNAL);
    $this->assertSession()->responseNotContains('</body>');
    // The exception is expected. Do not interpret it as a test failure.
    unlink($this->root . '/' . $this->siteDirectory . '/error.log');
  }
@@ -265,8 +265,8 @@ public function testBigPipeNoJs() {
    // Verifying there are no BigPipe placeholders & replacements.
    $this->assertSession()->responseHeaderEquals('BigPipe-Test-Placeholders', '<none>');
    // Verifying BigPipe start/stop signals are absent.
    $this->assertNoRaw(BigPipe::START_SIGNAL);
    $this->assertNoRaw(BigPipe::STOP_SIGNAL);
    $this->assertSession()->responseNotContains(BigPipe::START_SIGNAL);
    $this->assertSession()->responseNotContains(BigPipe::STOP_SIGNAL);

    // Verifying BigPipe assets are absent.
    $this->assertArrayNotHasKey('bigPipePlaceholderIds', $this->getDrupalSettings());
@@ -285,7 +285,7 @@ public function testBigPipeNoJs() {
    // The 'edge_case__html_exception' case throws an exception.
    $this->assertRaw('The website encountered an unexpected error. Please try again later');
    $this->assertRaw('You are not allowed to say llamas are not cool!');
    $this->assertNoRaw('</body>');
    $this->assertSession()->responseNotContains('</body>');
    // The exception is expected. Do not interpret it as a test failure.
    unlink($this->root . '/' . $this->siteDirectory . '/error.log');
  }
@@ -308,8 +308,8 @@ public function testBigPipeMultiOccurrencePlaceholders() {
    $big_pipe_placeholder_id = 'callback=Drupal%5CCore%5CRender%5CElement%5CStatusMessages%3A%3ArenderMessages&amp;args%5B0%5D&amp;token=_HAdUpwWmet0TOTe2PSiJuMntExoshbm1kh2wQzzzAA';
    $expected_placeholder_replacement = '<script type="application/vnd.drupal-ajax" data-big-pipe-replacement-for-placeholder-with-id="' . $big_pipe_placeholder_id . '">';
    $this->assertRaw('The count is 1.');
    $this->assertNoRaw('The count is 2.');
    $this->assertNoRaw('The count is 3.');
    $this->assertSession()->responseNotContains('The count is 2.');
    $this->assertSession()->responseNotContains('The count is 3.');
    $raw_content = $this->getSession()->getPage()->getContent();
    $this->assertSame(1, substr_count($raw_content, $expected_placeholder_replacement), 'Only one placeholder replacement was found for the duplicate #lazy_builder arrays.');

@@ -322,8 +322,8 @@ public function testBigPipeMultiOccurrencePlaceholders() {
    $this->assertBigPipeNoJsCookieExists(TRUE);
    $this->drupalGet(Url::fromRoute('big_pipe_test_multi_occurrence'));
    $this->assertRaw('The count is 1.');
    $this->assertNoRaw('The count is 2.');
    $this->assertNoRaw('The count is 3.');
    $this->assertSession()->responseNotContains('The count is 2.');
    $this->assertSession()->responseNotContains('The count is 3.');
  }

  protected function assertBigPipeResponseHeadersPresent() {
@@ -345,7 +345,7 @@ protected function assertBigPipeNoJsPlaceholders(array $expected_big_pipe_nojs_p
    foreach ($expected_big_pipe_nojs_placeholders as $big_pipe_nojs_placeholder => $expected_replacement) {
      // Checking whether the replacement for the BigPipe no-JS placeholder
      // $big_pipe_nojs_placeholder is present.
      $this->assertNoRaw($big_pipe_nojs_placeholder);
      $this->assertSession()->responseNotContains($big_pipe_nojs_placeholder);
      if ($expected_replacement !== NULL) {
        $this->assertRaw($expected_replacement);
      }
@@ -376,7 +376,7 @@ protected function assertBigPipePlaceholders(array $expected_big_pipe_placeholde
      $result = $this->xpath('//script[@data-big-pipe-replacement-for-placeholder-with-id=:id]', [':id' => Html::decodeEntities($big_pipe_placeholder_id)]);
      if ($expected_ajax_response === NULL) {
        $this->assertCount(0, $result);
        $this->assertNoRaw($expected_placeholder_replacement);
        $this->assertSession()->responseNotContains($expected_placeholder_replacement);
        continue;
      }
      $this->assertEquals($expected_ajax_response, trim($result[0]->getText()));
@@ -494,7 +494,7 @@ protected function assertBigPipeNoJsMetaRefreshRedirect() {
    $this->assertEquals('no-store, content="BigPipe/1.0"', $headers[1]['Surrogate-Control'][0], 'The second response has a "Surrogate-Control" header.');

    // Check that the <meta> refresh is absent, only one redirect ever happens.
    $this->assertNoRaw('<noscript><meta http-equiv="Refresh" content="0; URL=');
    $this->assertSession()->responseNotContains('<noscript><meta http-equiv="Refresh" content="0; URL=');
  }

}
+2 −2
Original line number Diff line number Diff line
@@ -80,8 +80,8 @@ public function testSevenAdminTheme() {
    $this->drupalGet('admin');

    // Check if contextual link classes are unavailable.
    $this->assertNoRaw('<div data-contextual-id="block:block=' . $block->id() . ':langcode=en"></div>');
    $this->assertNoRaw('contextual-region');
    $this->assertSession()->responseNotContains('<div data-contextual-id="block:block=' . $block->id() . ':langcode=en"></div>');
    $this->assertSession()->responseNotContains('contextual-region');
  }

}
+2 −2
Original line number Diff line number Diff line
@@ -65,7 +65,7 @@ public function testBlockVisibility() {

    // Confirm that an empty block is not displayed.
    $this->assertSession()->pageTextNotContains('Powered by Drupal');
    $this->assertNoRaw('sidebar-first');
    $this->assertSession()->responseNotContains('sidebar-first');
  }

  /**
@@ -256,7 +256,7 @@ public function testBlock() {
    $this->submitForm([], 'Remove');
    $this->assertRaw(t('The block %name has been removed.', ['%name' => $block->label()]));
    $this->assertSession()->addressEquals('admin');
    $this->assertNoRaw($block->id());
    $this->assertSession()->responseNotContains($block->id());
  }

  /**
+2 −2
Original line number Diff line number Diff line
@@ -217,7 +217,7 @@ public function testContextAwareBlocks() {
    $expected_text = '<div id="test_context_aware--username">' . \Drupal::currentUser()->getAccountName() . '</div>';
    $this->drupalGet('');
    $this->assertSession()->pageTextNotContains('Test context-aware block');
    $this->assertNoRaw($expected_text);
    $this->assertSession()->responseNotContains($expected_text);

    $block_url = 'admin/structure/block/add/test_context_aware/classy';
    $arguments = [
@@ -264,7 +264,7 @@ public function testContextAwareBlocks() {

    // Tests that conditions with missing context are not displayed.
    $this->drupalGet('admin/structure/block/manage/testcontextawareblock');
    $this->assertNoRaw('No existing type');
    $this->assertSession()->responseNotContains('No existing type');
    $this->assertSession()->elementNotExists('xpath', '//*[@name="visibility[condition_test_no_existing_type][negate]"]');
  }

Loading