Commit b69d7546 authored by Paulo Henrique Cota Starling's avatar Paulo Henrique Cota Starling Committed by Sascha Grossenbacher
Browse files

Issue #3244924 by paulocs: Fix tests on Drupal 9

parent da8abde3
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -55,6 +55,10 @@ function redirect_404_form_redirect_settings_form_alter(&$form, FormStateInterfa
    $ignored_pages .= $path_to_ignore;
  }

  // Replace '\r\n' with '\n' to keep consistency in tests.
  // See: https://www.drupal.org/project/redirect/issues/3244924
  $ignored_pages = str_replace("\r\n", "\n", $ignored_pages);

  $form['ignore_pages'] = [
    '#type' => 'textarea',
    '#title' => t('Pages to ignore'),
+3 −3
Original line number Diff line number Diff line
@@ -158,7 +158,7 @@ class Fix404RedirectUITest extends Redirect404TestBase {
    $this->clickLink('Ignore');
    $this->assertUrl('admin/config/search/redirect/settings?ignore=' . $path_to_ignore . $destination);
    $this->assertText('Resolved the path ' . $path_to_ignore . ' in the database. Please check the ignored list and save the settings.');
    $this->assertSession()->fieldValueEquals('ignore_pages', $node_to_ignore . "\r\n/term/*\n/node/2/test");
    $this->assertSession()->fieldValueEquals('ignore_pages', $node_to_ignore . "\n/term/*\n/node/2/test");
    $this->assertSession()->elementContains('css', '#edit-ignore-pages', $node_to_ignore);
    $this->assertSession()->elementContains('css', '#edit-ignore-pages', $terms_to_ignore);
    $this->assertSession()->elementContains('css', '#edit-ignore-pages', $path_to_ignore);
@@ -187,10 +187,10 @@ class Fix404RedirectUITest extends Redirect404TestBase {
    $this->drupalGet('admin/config/search/redirect/404');
    $this->assertText('llama_page');
    $this->clickLink('Ignore');
    $this->assertSession()->fieldValueEquals('ignore_pages', "/node/*\r\n/term/*\n/llama_page");
    $this->assertSession()->fieldValueEquals('ignore_pages', "/node/*\n/term/*\n/llama_page");
    $this->getSession()->getPage()->pressButton('Save configuration');
    $this->drupalGet('admin/config/search/redirect/settings');
    $this->assertSession()->fieldValueEquals('ignore_pages', "/node/*\r\n/term/*\n/llama_page");
    $this->assertSession()->fieldValueEquals('ignore_pages', "/node/*\n/term/*\n/llama_page");
  }

  /**