Skip to content
Snippets Groups Projects
Verified Commit 7606575b authored by quietone's avatar quietone
Browse files

Issue #3439833 by pooja_sharma, smustgrave, vensires: Fix Content Translation...

Issue #3439833 by pooja_sharma, smustgrave, vensires: Fix Content Translation tests that rely on UID1's super user behavior

(cherry picked from commit 9e76aa57)
parent 04d9ff13
No related branches found
No related tags found
2 merge requests!11185Issue #3477324 by andypost, alexpott: Fix usage of str_getcsv() and fgetcsv() for PHP 8.4,!9944Issue #3483353: Consider making the createCopy config action optionally fail...
Pipeline #274162 passed with warnings
Pipeline: drupal

#274179

    Pipeline: drupal

    #274175

      Pipeline: drupal

      #274169

        +1
        ...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
        namespace Drupal\Tests\content_translation\Functional; namespace Drupal\Tests\content_translation\Functional;
        use Drupal\Tests\BrowserTestBase; use Drupal\Tests\BrowserTestBase;
        use Drupal\user\Entity\Role;
        /** /**
        * Test enabling content translation module. * Test enabling content translation module.
        ...@@ -20,14 +21,6 @@ class ContentTranslationEnableTest extends BrowserTestBase { ...@@ -20,14 +21,6 @@ class ContentTranslationEnableTest extends BrowserTestBase {
        */ */
        protected static $modules = ['entity_test', 'menu_link_content', 'node']; protected static $modules = ['entity_test', 'menu_link_content', 'node'];
        /**
        * {@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} * {@inheritdoc}
        */ */
        ...@@ -37,6 +30,11 @@ class ContentTranslationEnableTest extends BrowserTestBase { ...@@ -37,6 +30,11 @@ class ContentTranslationEnableTest extends BrowserTestBase {
        * Tests that entity schemas are up-to-date after enabling translation. * Tests that entity schemas are up-to-date after enabling translation.
        */ */
        public function testEnable(): void { public function testEnable(): void {
        $this->rootUser = $this->drupalCreateUser([
        'administer modules',
        'administer site configuration',
        'administer content types',
        ]);
        $this->drupalLogin($this->rootUser); $this->drupalLogin($this->rootUser);
        // Enable modules and make sure the related config entity type definitions // Enable modules and make sure the related config entity type definitions
        // are installed. // are installed.
        ...@@ -46,6 +44,7 @@ public function testEnable(): void { ...@@ -46,6 +44,7 @@ public function testEnable(): void {
        ]; ];
        $this->drupalGet('admin/modules'); $this->drupalGet('admin/modules');
        $this->submitForm($edit, 'Install'); $this->submitForm($edit, 'Install');
        $this->rebuildContainer();
        // Status messages are shown. // Status messages are shown.
        $this->assertSession()->statusMessageContains('This site has only a single language enabled. Add at least one more language in order to translate content.', 'warning'); $this->assertSession()->statusMessageContains('This site has only a single language enabled. Add at least one more language in order to translate content.', 'warning');
        ...@@ -55,6 +54,10 @@ public function testEnable(): void { ...@@ -55,6 +54,10 @@ public function testEnable(): void {
        $this->drupalGet('admin/reports/status'); $this->drupalGet('admin/reports/status');
        $this->assertSession()->elementTextEquals('css', "details.system-status-report__entry summary:contains('Entity/field definitions') + div", 'Up to date'); $this->assertSession()->elementTextEquals('css', "details.system-status-report__entry summary:contains('Entity/field definitions') + div", 'Up to date');
        $this->grantPermissions(Role::load(Role::AUTHENTICATED_ID), [
        'administer content translation',
        'administer languages',
        ]);
        $this->drupalGet('admin/config/regional/content-language'); $this->drupalGet('admin/config/regional/content-language');
        // The node entity type should not be an option because it has no bundles. // The node entity type should not be an option because it has no bundles.
        $this->assertSession()->responseNotContains('entity_types[node]'); $this->assertSession()->responseNotContains('entity_types[node]');
        ......
        ...@@ -25,14 +25,6 @@ class ContentTranslationNewTranslationWithExistingRevisionsTest extends ContentT ...@@ -25,14 +25,6 @@ class ContentTranslationNewTranslationWithExistingRevisionsTest extends ContentT
        'node', 'node',
        ]; ];
        /**
        * {@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} * {@inheritdoc}
        */ */
        ......
        ...@@ -14,14 +14,6 @@ ...@@ -14,14 +14,6 @@
        */ */
        class ContentTranslationOutdatedRevisionTranslationTest extends ContentTranslationPendingRevisionTestBase { class ContentTranslationOutdatedRevisionTranslationTest extends ContentTranslationPendingRevisionTestBase {
        /**
        * {@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} * {@inheritdoc}
        */ */
        ......
        ...@@ -79,6 +79,11 @@ protected function setUp(): void { ...@@ -79,6 +79,11 @@ protected function setUp(): void {
        * Enables content moderation for the test entity type and bundle. * Enables content moderation for the test entity type and bundle.
        */ */
        protected function enableContentModeration() { protected function enableContentModeration() {
        $perms = array_merge(parent::getAdministratorPermissions(), [
        'administer workflows',
        'view latest version',
        ]);
        $this->rootUser = $this->drupalCreateUser($perms);
        $this->drupalLogin($this->rootUser); $this->drupalLogin($this->rootUser);
        $workflow_id = 'editorial'; $workflow_id = 'editorial';
        $this->drupalGet('/admin/config/workflow/workflows'); $this->drupalGet('/admin/config/workflow/workflows');
        ......
        ...@@ -14,14 +14,6 @@ ...@@ -14,14 +14,6 @@
        */ */
        class ContentTranslationRevisionTranslationDeletionTest extends ContentTranslationPendingRevisionTestBase { class ContentTranslationRevisionTranslationDeletionTest extends ContentTranslationPendingRevisionTestBase {
        /**
        * {@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} * {@inheritdoc}
        */ */
        ......
        ...@@ -24,14 +24,6 @@ class ContentTranslationUntranslatableFieldsTest extends ContentTranslationPendi ...@@ -24,14 +24,6 @@ class ContentTranslationUntranslatableFieldsTest extends ContentTranslationPendi
        */ */
        protected static $modules = ['field_test']; protected static $modules = ['field_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} * {@inheritdoc}
        */ */
        ......
        0% Loading or .
        You are about to add 0 people to the discussion. Proceed with caution.
        Finish editing this message first!
        Please register or to comment