Commit db201633 authored by Pravin Gaikwad's avatar Pravin Gaikwad Committed by Sascha Grossenbacher
Browse files

Issue #3357833 by Rajeshreeputra, ankitv18, Kristen Pol, andre.bonon,...

Issue #3357833 by Rajeshreeputra, ankitv18, Kristen Pol, andre.bonon, vishalkhode, Berdir, deepakkm, heddn: PHP 8.2 compatibility
parent 85657e06
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -33,6 +33,13 @@ class Redirect404Operations extends FieldPluginBase {
   */
  protected $renderer;

  /**
   * The current user.
   *
   * @var \Drupal\Core\Session\AccountInterface
   */
  protected $currentUser;

  /**
   * Constructor for the redirect operations view field.
   *
+25 −5
Original line number Diff line number Diff line
@@ -19,24 +19,44 @@ class RedirectUITest extends BrowserTestBase {
  use AssertRedirectTrait;

  /**
   * The admin user.
   *
   * @var \Drupal\Core\Session\AccountInterface
   */
  protected $adminUser;

  /**
   * The redirect repository.
   *
   * @var \Drupal\redirect\RedirectRepository
   */
  protected $repository;

  /**
   * The Sql conntent entity storage.
   *
   * @var \Drupal\Core\Entity\Sql\SqlContentEntityStorage
   */
  protected $storage;

  /**
   * The maximum redirects.
   *
   * @var int
   */
  public $maximumRedirects;

  /**
   * {@inheritdoc}
   */
  protected static $modules = ['redirect', 'node', 'path', 'dblog', 'views', 'taxonomy'];
  protected static $modules = [
    'redirect',
    'node',
    'path',
    'dblog',
    'views',
    'taxonomy',
  ];

  /**
   * {@inheritdoc}
@@ -156,7 +176,7 @@ class RedirectUITest extends BrowserTestBase {
  /**
   * Test the redirect loop protection and logging.
   */
  function testRedirectLoop() {
  public function testRedirectLoop() {
    // Redirect loop redirection only works when page caching is disabled.
    \Drupal::service('module_installer')->uninstall(['page_cache']);

@@ -194,7 +214,7 @@ class RedirectUITest extends BrowserTestBase {
  /**
   * Returns a new vocabulary with random properties.
   */
  function createVocabulary() {
  public function createVocabulary() {
    // Create a vocabulary.
    $vocabulary = Vocabulary::create([
      'name' => $this->randomMachineName(),
@@ -210,7 +230,7 @@ class RedirectUITest extends BrowserTestBase {
  /**
   * Returns a new term with random properties in vocabulary $vid.
   */
  function createTerm($vocabulary) {
  public function createTerm($vocabulary) {
    $filter_formats = filter_formats();
    $format = array_pop($filter_formats);
    $term = Term::create([
+28 −20
Original line number Diff line number Diff line
@@ -13,16 +13,22 @@ use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
class RedirectJavascriptTest extends WebDriverTestBase {

  /**
   * The admin user.
   *
   * @var \Drupal\Core\Session\AccountInterface
   */
  protected $adminUser;

  /**
   * The redirect repository.
   *
   * @var \Drupal\redirect\RedirectRepository
   */
  protected $repository;

  /**
   * The Sql conntent entity storage.
   *
   * @var \Drupal\Core\Entity\Sql\SqlContentEntityStorage
   */
  protected $storage;
@@ -75,7 +81,7 @@ class RedirectJavascriptTest extends WebDriverTestBase {
          'source_query' => ['key' => 'val', 'key1' => 'val1'],
          'redirect' => 'node',
          'redirect_options' => ['query' => ['key' => 'val', 'key1' => 'val1']],
      ]
        ],
      ]
    );
    $this->assertSession()->fieldValueEquals('redirect_source[0][path]', 'non-existing?key=val&key1=val1');
@@ -183,7 +189,7 @@ class RedirectJavascriptTest extends WebDriverTestBase {
    $page->pressButton('Save');
    $this->assertSession()->responseContains('The anchor fragments are not allowed.');

    // Adding path that starts with /
    // Adding path that starts with /.
    $this->drupalGet('admin/config/search/redirect/add');
    $page = $this->getSession()->getPage();
    $page->fillField('redirect_source[0][path]', '/page-to-redirect');
@@ -247,6 +253,7 @@ class RedirectJavascriptTest extends WebDriverTestBase {
      'redirect_bulk_form[0]' => TRUE,
      'redirect_bulk_form[1]' => TRUE,
    ];
    $this->getSession()->getPage()->selectFieldOption("action", "redirect_delete_action", TRUE);
    $this->submitForm($edit, 'Apply to selected items');
    $this->assertSession()->pageTextContains('Are you sure you want to delete these redirects?');
    $this->clickLink('Cancel');
@@ -261,6 +268,7 @@ class RedirectJavascriptTest extends WebDriverTestBase {
    $this->assertSession()->addressEquals('admin/config/search/redirect');

    // Test the bulk delete action.
    $this->getSession()->getPage()->selectFieldOption("action", "redirect_delete_action", TRUE);
    $this->submitForm(['redirect_bulk_form[0]' => TRUE], 'Apply to selected items');
    $this->assertSession()->pageTextContains('Are you sure you want to delete this redirect?');
    $this->assertSession()->pageTextContains('test27');