Verified Commit fa70c760 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #3439917 by sukr_s, smustgrave, adwivedi008, alexpott, vensires,...

Issue #3439917 by sukr_s, smustgrave, adwivedi008, alexpott, vensires, quietone: Fix Views tests that rely on UID1's super user behavior

(cherry picked from commit 30c8e324)
parent 13f9986e
Loading
Loading
Loading
Loading
+4 −8
Original line number Diff line number Diff line
@@ -27,13 +27,6 @@ class FieldEntityLinkBaseTest extends ViewTestBase {
   */
  protected static $modules = ['node', 'language'];

  /**
   * {@inheritdoc}
   *
   * @todo Remove and fix test to not rely on super user.
   * @see https://www.drupal.org/project/drupal/issues/3437620
   */
  protected bool $usesSuperUserAccessPolicy = TRUE;

  /**
   * {@inheritdoc}
@@ -67,7 +60,10 @@ protected function setUp($import_test_views = TRUE, $modules = ['views_test_conf
      $translation->save();
    }

    $this->drupalLogin($this->rootUser);
    $this->drupalLogin($this->createUser([
      'delete any article content',
      'edit any article content',
    ]));

  }

+1 −9
Original line number Diff line number Diff line
@@ -23,14 +23,6 @@ class ContextualFiltersStringTest extends ViewTestBase {
    'views_test_config',
  ];

  /**
   * {@inheritdoc}
   *
   * @todo Remove and fix test to not rely on super user.
   * @see https://www.drupal.org/project/drupal/issues/3437620
   */
  protected bool $usesSuperUserAccessPolicy = TRUE;

  /**
   * {@inheritdoc}
   */
@@ -73,7 +65,7 @@ protected function setUp($import_test_views = TRUE, $modules = ['views_test_conf
    $this->createUser([], 'user4', FALSE, ['roles' => [$this->role2]]);
    $this->createUser([], 'user5', FALSE, ['roles' => [$this->role1, $this->role2]]);

    $this->drupalLogin($this->rootUser);
    $this->drupalLogin($this->createUser(['administer views']));
  }

  /**
+1 −9
Original line number Diff line number Diff line
@@ -31,14 +31,6 @@ class DisplayPageWebTest extends ViewTestBase {
   */
  protected static $modules = ['block', 'views_ui'];

  /**
   * {@inheritdoc}
   *
   * @todo Remove and fix test to not rely on super user.
   * @see https://www.drupal.org/project/drupal/issues/3437620
   */
  protected bool $usesSuperUserAccessPolicy = TRUE;

  /**
   * {@inheritdoc}
   */
@@ -151,7 +143,7 @@ public function testTitleOutput() {
   * Tests the views page path functionality.
   */
  public function testPagePaths() {
    $this->drupalLogin($this->rootUser);
    $this->drupalLogin($this->createUser(['administer views']));
    $this->assertPagePath('0');
    $this->assertPagePath('9999');
    $this->assertPagePath('☺');
+1 −8
Original line number Diff line number Diff line
@@ -25,13 +25,6 @@ class UserBatchActionTest extends BrowserTestBase {
    'views',
  ];

  /**
   * {@inheritdoc}
   *
   * @todo Remove and fix test to not rely on super user.
   * @see https://www.drupal.org/project/drupal/issues/3437620
   */
  protected bool $usesSuperUserAccessPolicy = TRUE;

  /**
   * {@inheritdoc}
@@ -45,7 +38,7 @@ public function testUserAction() {
    $themes = ['stark', 'olivero', 'claro'];
    $this->container->get('theme_installer')->install($themes);

    $this->drupalLogin($this->rootUser);
    $this->drupalLogin($this->createUser(['administer users']));

    foreach ($themes as $theme) {
      $this->config('system.theme')->set('default', $theme)->save();
+4 −10
Original line number Diff line number Diff line
@@ -9,6 +9,7 @@
use Drupal\entity_test\Entity\EntityTestRev;
use Drupal\field\Entity\FieldConfig;
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\Tests\user\Traits\UserCreationTrait;
use Drupal\user\Entity\User;
use Drupal\views\Plugin\views\field\EntityField;
use Drupal\Tests\views\Kernel\ViewsKernelTestBase;
@@ -24,6 +25,8 @@
 */
class FieldFieldTest extends ViewsKernelTestBase {

  use UserCreationTrait;

  /**
   * {@inheritdoc}
   */
@@ -35,14 +38,6 @@ class FieldFieldTest extends ViewsKernelTestBase {
    'views_entity_test',
  ];

  /**
   * {@inheritdoc}
   *
   * @todo Remove and fix test to not rely on super user.
   * @see https://www.drupal.org/project/drupal/issues/3437620
   */
  protected bool $usesSuperUserAccessPolicy = TRUE;

  /**
   * {@inheritdoc}
   */
@@ -90,8 +85,7 @@ protected function setUp($import_test_views = TRUE): void {
    ViewTestData::createTestViews(static::class, ['views_test_config']);

    // Bypass any field access.
    $this->adminUser = User::create(['name' => $this->randomString()]);
    $this->adminUser->save();
    $this->adminUser = $this->createUser(['administer users'], $this->randomString());
    $this->container->get('current_user')->setAccount($this->adminUser);

    $this->testUsers = [];
Loading