Loading core/modules/content_moderation/tests/src/Functional/ModerationContentTranslationTest.php +8 −10 Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ use Drupal\Tests\BrowserTestBase; use Drupal\Tests\content_moderation\Traits\ContentModerationTestTrait; use Drupal\Tests\content_translation\Traits\ContentTranslationTestTrait; use Drupal\user\Entity\Role; /** * Test content_moderation functionality with content_translation. Loading Loading @@ -34,14 +35,6 @@ class ModerationContentTranslationTest extends BrowserTestBase { 'content_translation', ]; /** * {@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} */ Loading @@ -52,7 +45,12 @@ class ModerationContentTranslationTest extends BrowserTestBase { */ protected function setUp(): void { parent::setUp(); $this->drupalLogin($this->rootUser); $this->adminUser = $this->drupalCreateUser([ 'bypass node access', 'create content translations', 'translate any entity', ]); $this->drupalLogin($this->adminUser); // Create an Article content type. $this->drupalCreateContentType(['type' => 'article', 'name' => 'Article'])->save(); static::createLanguageFromLangcode('fr'); Loading Loading @@ -91,7 +89,7 @@ public function testModerationWithExistingContent(): void { $workflow = $this->createEditorialWorkflow(); $workflow->getTypePlugin()->addEntityTypeAndBundle('node', 'article'); $workflow->save(); $this->drupalLogin($this->rootUser); $this->grantPermissions(Role::load(Role::AUTHENTICATED_ID), ['use editorial transition publish']); // Edit the English node. $this->drupalGet('node/' . $english_node->id() . '/edit'); Loading core/modules/content_moderation/tests/src/Functional/ModerationFormTest.php +13 −7 Original line number Diff line number Diff line Loading @@ -29,16 +29,20 @@ class ModerationFormTest extends ModerationStateTestBase { /** * {@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 $defaultTheme = 'stark'; /** * {@inheritdoc} */ protected $defaultTheme = 'stark'; protected function getAdministratorPermissions(): array { return array_merge($this->permissions, [ 'administer entity_test content', 'view test entity', 'translate any entity', 'bypass node access', ]); } /** * {@inheritdoc} Loading Loading @@ -196,7 +200,8 @@ public function testModerationForm(): void { * Tests moderation non-bundle entity type. */ public function testNonBundleModerationForm(): void { $this->drupalLogin($this->rootUser); $this->adminUser = $this->drupalCreateUser($this->getAdministratorPermissions()); $this->drupalLogin($this->adminUser); $this->workflow->getTypePlugin()->addEntityTypeAndBundle('entity_test_mulrevpub', 'entity_test_mulrevpub'); $this->workflow->save(); Loading Loading @@ -290,7 +295,8 @@ public function testModerationFormSetsRevisionAuthor(): void { * Tests translated and moderated nodes. */ public function testContentTranslationNodeForm(): void { $this->drupalLogin($this->rootUser); $this->adminUser = $this->drupalCreateUser($this->getAdministratorPermissions()); $this->drupalLogin($this->adminUser); // Add French language. static::createLanguageFromLangcode('fr'); Loading core/modules/content_moderation/tests/src/Functional/ModerationLocaleTest.php +10 −7 Original line number Diff line number Diff line Loading @@ -29,16 +29,19 @@ class ModerationLocaleTest extends ModerationStateTestBase { /** * {@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 $defaultTheme = 'stark'; /** * {@inheritdoc} */ protected $defaultTheme = 'stark'; protected function getAdministratorPermissions(): array { return array_merge($this->permissions, [ 'create content translations', 'bypass node access', 'translate any entity', ]); } /** * {@inheritdoc} Loading @@ -46,8 +49,8 @@ class ModerationLocaleTest extends ModerationStateTestBase { protected function setUp(): void { parent::setUp(); $this->drupalLogin($this->rootUser); $this->adminUser = $this->drupalCreateUser($this->getAdministratorPermissions()); $this->drupalLogin($this->adminUser); // Enable moderation on Article node type. $this->createContentTypeFromUi('Article', 'article', TRUE); Loading core/modules/content_moderation/tests/src/Functional/ModerationStateBlockTest.php +9 −6 Original line number Diff line number Diff line Loading @@ -16,16 +16,18 @@ class ModerationStateBlockTest extends ModerationStateTestBase { /** * {@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 $defaultTheme = 'stark'; /** * {@inheritdoc} */ protected $defaultTheme = 'stark'; protected function getAdministratorPermissions(): array { return array_merge($this->permissions, [ 'administer blocks', 'administer block content', ]); } /** * {@inheritdoc} Loading Loading @@ -64,7 +66,8 @@ protected function setUp(): void { * @see \Drupal\content_moderation\Tests\ModerationFormTest::testModerationForm */ public function testCustomBlockModeration(): void { $this->drupalLogin($this->rootUser); $this->adminUser = $this->drupalCreateUser($this->getAdministratorPermissions()); $this->drupalLogin($this->adminUser); // Enable moderation for content blocks. $edit['bundles[basic]'] = TRUE; Loading core/modules/content_moderation/tests/src/Functional/WorkspaceContentModerationIntegrationTest.php +9 −6 Original line number Diff line number Diff line Loading @@ -24,16 +24,18 @@ class WorkspaceContentModerationIntegrationTest extends ModerationStateTestBase /** * {@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 $defaultTheme = 'stark'; /** * {@inheritdoc} */ protected $defaultTheme = 'stark'; protected function getAdministratorPermissions(): array { return array_merge($this->permissions, [ 'bypass node access', 'view any workspace', ]); } /** * {@inheritdoc} Loading @@ -41,7 +43,8 @@ class WorkspaceContentModerationIntegrationTest extends ModerationStateTestBase protected function setUp(): void { parent::setUp(); $this->drupalLogin($this->rootUser); $this->adminUser = $this->drupalCreateUser($this->getAdministratorPermissions()); $this->drupalLogin($this->adminUser); // Enable moderation on Article node type. $this->createContentTypeFromUi('Article', 'article', TRUE); Loading Loading
core/modules/content_moderation/tests/src/Functional/ModerationContentTranslationTest.php +8 −10 Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ use Drupal\Tests\BrowserTestBase; use Drupal\Tests\content_moderation\Traits\ContentModerationTestTrait; use Drupal\Tests\content_translation\Traits\ContentTranslationTestTrait; use Drupal\user\Entity\Role; /** * Test content_moderation functionality with content_translation. Loading Loading @@ -34,14 +35,6 @@ class ModerationContentTranslationTest extends BrowserTestBase { 'content_translation', ]; /** * {@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} */ Loading @@ -52,7 +45,12 @@ class ModerationContentTranslationTest extends BrowserTestBase { */ protected function setUp(): void { parent::setUp(); $this->drupalLogin($this->rootUser); $this->adminUser = $this->drupalCreateUser([ 'bypass node access', 'create content translations', 'translate any entity', ]); $this->drupalLogin($this->adminUser); // Create an Article content type. $this->drupalCreateContentType(['type' => 'article', 'name' => 'Article'])->save(); static::createLanguageFromLangcode('fr'); Loading Loading @@ -91,7 +89,7 @@ public function testModerationWithExistingContent(): void { $workflow = $this->createEditorialWorkflow(); $workflow->getTypePlugin()->addEntityTypeAndBundle('node', 'article'); $workflow->save(); $this->drupalLogin($this->rootUser); $this->grantPermissions(Role::load(Role::AUTHENTICATED_ID), ['use editorial transition publish']); // Edit the English node. $this->drupalGet('node/' . $english_node->id() . '/edit'); Loading
core/modules/content_moderation/tests/src/Functional/ModerationFormTest.php +13 −7 Original line number Diff line number Diff line Loading @@ -29,16 +29,20 @@ class ModerationFormTest extends ModerationStateTestBase { /** * {@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 $defaultTheme = 'stark'; /** * {@inheritdoc} */ protected $defaultTheme = 'stark'; protected function getAdministratorPermissions(): array { return array_merge($this->permissions, [ 'administer entity_test content', 'view test entity', 'translate any entity', 'bypass node access', ]); } /** * {@inheritdoc} Loading Loading @@ -196,7 +200,8 @@ public function testModerationForm(): void { * Tests moderation non-bundle entity type. */ public function testNonBundleModerationForm(): void { $this->drupalLogin($this->rootUser); $this->adminUser = $this->drupalCreateUser($this->getAdministratorPermissions()); $this->drupalLogin($this->adminUser); $this->workflow->getTypePlugin()->addEntityTypeAndBundle('entity_test_mulrevpub', 'entity_test_mulrevpub'); $this->workflow->save(); Loading Loading @@ -290,7 +295,8 @@ public function testModerationFormSetsRevisionAuthor(): void { * Tests translated and moderated nodes. */ public function testContentTranslationNodeForm(): void { $this->drupalLogin($this->rootUser); $this->adminUser = $this->drupalCreateUser($this->getAdministratorPermissions()); $this->drupalLogin($this->adminUser); // Add French language. static::createLanguageFromLangcode('fr'); Loading
core/modules/content_moderation/tests/src/Functional/ModerationLocaleTest.php +10 −7 Original line number Diff line number Diff line Loading @@ -29,16 +29,19 @@ class ModerationLocaleTest extends ModerationStateTestBase { /** * {@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 $defaultTheme = 'stark'; /** * {@inheritdoc} */ protected $defaultTheme = 'stark'; protected function getAdministratorPermissions(): array { return array_merge($this->permissions, [ 'create content translations', 'bypass node access', 'translate any entity', ]); } /** * {@inheritdoc} Loading @@ -46,8 +49,8 @@ class ModerationLocaleTest extends ModerationStateTestBase { protected function setUp(): void { parent::setUp(); $this->drupalLogin($this->rootUser); $this->adminUser = $this->drupalCreateUser($this->getAdministratorPermissions()); $this->drupalLogin($this->adminUser); // Enable moderation on Article node type. $this->createContentTypeFromUi('Article', 'article', TRUE); Loading
core/modules/content_moderation/tests/src/Functional/ModerationStateBlockTest.php +9 −6 Original line number Diff line number Diff line Loading @@ -16,16 +16,18 @@ class ModerationStateBlockTest extends ModerationStateTestBase { /** * {@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 $defaultTheme = 'stark'; /** * {@inheritdoc} */ protected $defaultTheme = 'stark'; protected function getAdministratorPermissions(): array { return array_merge($this->permissions, [ 'administer blocks', 'administer block content', ]); } /** * {@inheritdoc} Loading Loading @@ -64,7 +66,8 @@ protected function setUp(): void { * @see \Drupal\content_moderation\Tests\ModerationFormTest::testModerationForm */ public function testCustomBlockModeration(): void { $this->drupalLogin($this->rootUser); $this->adminUser = $this->drupalCreateUser($this->getAdministratorPermissions()); $this->drupalLogin($this->adminUser); // Enable moderation for content blocks. $edit['bundles[basic]'] = TRUE; Loading
core/modules/content_moderation/tests/src/Functional/WorkspaceContentModerationIntegrationTest.php +9 −6 Original line number Diff line number Diff line Loading @@ -24,16 +24,18 @@ class WorkspaceContentModerationIntegrationTest extends ModerationStateTestBase /** * {@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 $defaultTheme = 'stark'; /** * {@inheritdoc} */ protected $defaultTheme = 'stark'; protected function getAdministratorPermissions(): array { return array_merge($this->permissions, [ 'bypass node access', 'view any workspace', ]); } /** * {@inheritdoc} Loading @@ -41,7 +43,8 @@ class WorkspaceContentModerationIntegrationTest extends ModerationStateTestBase protected function setUp(): void { parent::setUp(); $this->drupalLogin($this->rootUser); $this->adminUser = $this->drupalCreateUser($this->getAdministratorPermissions()); $this->drupalLogin($this->adminUser); // Enable moderation on Article node type. $this->createContentTypeFromUi('Article', 'article', TRUE); Loading