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

Issue #3439831 by thebumik, pradhumanjain2311, vensires: Fix Config tests that...

Issue #3439831 by thebumik, pradhumanjain2311, vensires: Fix Config tests that rely on UID1's super user behavior
parent 8ac73be3
Loading
Loading
Loading
Loading
Loading
+12 −17
Original line number Diff line number Diff line
@@ -41,7 +41,6 @@ class ConfigExportImportUITest extends BrowserTestBase {
   */
  protected $newSlogan;


  /**
   * Holds a content type.
   *
@@ -70,14 +69,6 @@ class ConfigExportImportUITest extends BrowserTestBase {
   */
  protected static $modules = ['config', 'node', 'field'];

  /**
   * {@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}
   */
@@ -88,11 +79,18 @@ class ConfigExportImportUITest extends BrowserTestBase {
   */
  protected function setUp(): void {
    parent::setUp();
    // The initial import must be done with uid 1 because if separately named
    // roles are created then the role is lost after import. If the roles
    // created have the same name then the sync will fail because they will
    // have different UUIDs.
    $this->drupalLogin($this->rootUser);
    // Create a content type.
    $this->contentType = $this->drupalCreateContentType(['type' => 'test']);

    $this->drupalLogin($this->drupalCreateUser([
      'export configuration',
      'import configuration',
      'synchronize configuration',
      'access administration pages',
      'administer site configuration',
      'create test content',
      'view the administration theme',
    ]));
  }

  /**
@@ -112,9 +110,6 @@ public function testExportImport() {
      ->save();
    $this->assertEquals($this->newSlogan, $this->config('system.site')->get('slogan'));

    // Create a content type.
    $this->contentType = $this->drupalCreateContentType();

    // Create a field.
    $this->fieldName = $this->randomMachineName();
    $this->fieldStorage = FieldStorageConfig::create([
+7 −7
Original line number Diff line number Diff line
@@ -14,15 +14,10 @@
 */
class LanguageNegotiationFormOverrideTest extends BrowserTestBase {

  protected static $modules = ['language', 'locale', 'locale_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;
  protected static $modules = ['language', 'locale', 'locale_test'];

  /**
   * {@inheritdoc}
@@ -33,7 +28,12 @@ class LanguageNegotiationFormOverrideTest extends BrowserTestBase {
   * Tests that overrides do not affect language-negotiation form values.
   */
  public function testFormWithOverride() {
    $this->drupalLogin($this->rootUser);
    $this->drupalLogin($this->drupalCreateUser([
      'access administration pages',
      'administer site configuration',
      'administer languages',
      'view the administration theme',
    ]));
    $overridden_value_en = 'whatever';
    $overridden_value_es = 'loquesea';