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 30c8e32404
)
merge-requests/7807/head
parent
13f9986e51
commit
fa70c760be
|
@ -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 @@ class FieldEntityLinkBaseTest extends ViewTestBase {
|
|||
$translation->save();
|
||||
}
|
||||
|
||||
$this->drupalLogin($this->rootUser);
|
||||
$this->drupalLogin($this->createUser([
|
||||
'delete any article content',
|
||||
'edit any article content',
|
||||
]));
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -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 @@ class ContextualFiltersStringTest extends ViewTestBase {
|
|||
$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']));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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 @@ class DisplayPageWebTest extends ViewTestBase {
|
|||
* 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('☺');
|
||||
|
|
|
@ -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 @@ class UserBatchActionTest extends BrowserTestBase {
|
|||
$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();
|
||||
|
|
|
@ -9,6 +9,7 @@ use Drupal\entity_test\Entity\EntityTest;
|
|||
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 @@ use Drupal\views\Views;
|
|||
*/
|
||||
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 @@ class FieldFieldTest extends ViewsKernelTestBase {
|
|||
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 = [];
|
||||
|
|
|
@ -25,14 +25,6 @@ class RssFieldsTest extends ViewsKernelTestBase {
|
|||
*/
|
||||
protected static $modules = ['node', 'field', 'text', 'filter'];
|
||||
|
||||
/**
|
||||
* {@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}
|
||||
*/
|
||||
|
@ -58,9 +50,7 @@ class RssFieldsTest extends ViewsKernelTestBase {
|
|||
* subdirectory.
|
||||
*/
|
||||
public function testRssFields() {
|
||||
// Set up the current user as uid 1 so the test doesn't need to deal with
|
||||
// permission.
|
||||
$this->setUpCurrentUser(['uid' => 1]);
|
||||
$this->setUpCurrentUser([], ['access content']);
|
||||
|
||||
$date = '1975-05-18';
|
||||
|
||||
|
|
Loading…
Reference in New Issue