diff -u b/core/modules/content_moderation/src/Tests/ModerationStateDuplicateLabelTest.php b/core/modules/content_moderation/src/Tests/ModerationStateDuplicateLabelTest.php --- b/core/modules/content_moderation/src/Tests/ModerationStateDuplicateLabelTest.php +++ b/core/modules/content_moderation/src/Tests/ModerationStateDuplicateLabelTest.php @@ -12,34 +12,17 @@ class ModerationStateDuplicateLabelTest extends ModerationStateTestBase { /** - * Tests route access/permissions. + * {@inheritdoc} */ - public function testAccess() { - $paths = [ - 'admin/config/workflow/moderation', - 'admin/config/workflow/moderation/states', - 'admin/config/workflow/moderation/states/add', - ]; - - foreach ($paths as $path) { - $this->drupalGet($path); - // No access. - $this->assertResponse(403); - } - $this->drupalLogin($this->adminUser); - foreach ($paths as $path) { - $this->drupalGet($path); - // User has access. - $this->assertResponse(200); - } + protected function setUp() { + parent::setUp(); } /** * Tests administration of moderation state transition entity. */ public function testDuplicateLabel() { - $duplicate_label = 'Duplicate Label'; - $unique_label = 'Unique Label'; + $duplicate_label = 'Draft'; $this->drupalLogin($this->adminUser); $this->drupalGet('admin/config/workflow/moderation'); @@ -49,38 +32,18 @@ // Add two states with the same label and one unique. $this->drupalPostForm(NULL, [ 'label' => $duplicate_label, - 'id' => 'duplciate_one', - ], t('Save')); - $this->clickLink('Add Moderation state'); - $this->drupalPostForm(NULL, [ - 'label' => $duplicate_label, - 'id' => 'duplicate_two', + 'id' => 'duplicate', ], t('Save')); - $this->clickLink('Add Moderation state'); - $this->drupalPostForm(NULL, [ - 'label' => $unique_label, - 'id' => 'unique_label', - ], t('Save')); - - $this->drupalGet('admin/config/workflow/moderation/states'); /** @var ModerationState $state */ - $state = ModerationState::load('duplciate_one'); - // The label includes machine_name. - $this->assertNotIdentical($state->label(), $duplicate_label, 'The labels are different.'); - $this->assertIdentical($state->label(FALSE), $duplicate_label, 'The labels are identical.'); - // Which should be displayed on the the screen. - $this->assertText($state->label()); - - /** @var ModerationState $state_u */ - $state_u = ModerationState::load('unique_label'); - // Unique labels don't change. - $this->assertTrue($state_u->label(), $unique_label, 'The labels are identical.'); - $this->assertText($state_u->label()); - - $this->drupalGet('admin/config/workflow/moderation/transitions/add'); - $this->assertOptionByText('edit-stateto', $state_u->label()); - $this->assertOptionByText('edit-stateto', $state->label()); + foreach (ModerationState::loadMultiple() as $state) { + if ($state->id() === 'duplicate' || $state->id() === 'draft') { + $this->assertNotIdentical($state->label(FALSE), $state->label(), 'The labels are different.'); + } + else { + $this->assertIdentical($state->label(FALSE), $state->label(), 'The labels are identical.'); + } + } } }