diff --git a/core/modules/content_moderation/tests/src/FunctionalJavascript/WorkflowTypeEditFormTest.php b/core/modules/content_moderation/tests/src/FunctionalJavascript/ContentModerationConfigureEntityTypesFormTest.php similarity index 79% rename from core/modules/content_moderation/tests/src/FunctionalJavascript/WorkflowTypeEditFormTest.php rename to core/modules/content_moderation/tests/src/FunctionalJavascript/ContentModerationConfigureEntityTypesFormTest.php index bfd3a4f..f078e87 100644 --- a/core/modules/content_moderation/tests/src/FunctionalJavascript/WorkflowTypeEditFormTest.php +++ b/core/modules/content_moderation/tests/src/FunctionalJavascript/ContentModerationConfigureEntityTypesFormTest.php @@ -10,7 +10,7 @@ * * @group content_moderation */ -class WorkflowTypeEditFormTest extends JavascriptTestBase { +class ContentModerationConfigureEntityTypesFormTest extends JavascriptTestBase { /** * Modules to install. @@ -32,45 +32,45 @@ public function setUp() { $this->drupalLogin($user); // Create a custom block type. - $bundle = BlockContentType::create([ - 'id' => 'basic', - 'label' => 'Basic block', + BlockContentType::create([ + 'id' => 'epic', + 'label' => 'Epic block', 'revision' => FALSE, - ]); - $bundle->save(); + ])->save(); + } /** * Tests the workflow type edit form 'This workflow applies to:' section. */ - public function testWorkflowTypeEditForm() { + public function testContentModerationConfigureEntityTypesForm() { $this->drupalGet('admin/config/workflow/workflows/manage/editorial'); - // Open the 'Custom block types' modal and select 'Basic block'. + // Open the 'Custom block types' modal and select 'Epic block'. $this->click('[data-drupal-selector="edit-type-settings-entity-types-container-entity-types-block-content-operations"] a'); $this->assertSession()->assertWaitOnAjaxRequest(); $modal = $this->assertSession()->waitForElementVisible('css', '#drupal-modal'); $this->assertTrue($modal->isVisible(), 'Modal window found.'); - // Check the 'Basic block' checkbox. - $this->assertSession()->waitForElementVisible('css', '[data-drupal-selector="edit-bundles-basic"]')->check(); + // Check the 'Epic block' checkbox. + $this->assertSession()->waitForElementVisible('css', '[data-drupal-selector="edit-bundles-epic"]')->check(); // Save the form and assert that the modal closes. $save_button = $this->assertSession()->waitForElementVisible('css', '.ui-dialog button:contains(Save)'); $this->assertTrue($save_button->isVisible(), 'Save button found.'); $save_button->click(); $this->assertSession()->assertWaitOnAjaxRequest(); $this->assertFalse($modal->isVisible(), 'Modal window closed.'); - // Assert that 'Basic block' shows in the UI as the selected Custom block + // Assert that 'Epic block' shows in the UI as the selected Custom block // types. $selected_block_content = $this->assertSession()->waitForElementVisible('named', ['id', 'selected-block_content']); - $this->assertEquals('Basic block', $selected_block_content->getText()); + $this->assertEquals('Epic block', $selected_block_content->getText()); - // Open the 'Custom block types' modal again and deselect 'Basic block'. + // Open the 'Custom block types' modal again and deselect 'Epic block'. $this->click('[data-drupal-selector="edit-type-settings-entity-types-container-entity-types-block-content-operations"] a'); $this->assertSession()->assertWaitOnAjaxRequest(); $modal = $this->assertSession()->waitForElementVisible('css', '#drupal-modal'); $this->assertTrue($modal->isVisible(), 'Modal window found.'); - // Uncheck the 'Basic block' checkbox. - $this->assertSession()->waitForElementVisible('css', '[data-drupal-selector="edit-bundles-basic"]')->uncheck(); + // Uncheck the 'Epic block' checkbox. + $this->assertSession()->waitForElementVisible('css', '[data-drupal-selector="edit-bundles-epic"]')->uncheck(); // Save the form and assert that the modal closes. $save_button = $this->assertSession()->waitForElementVisible('css', '.ui-dialog button:contains(Save)'); $this->assertTrue($save_button->isVisible(), 'Save button found.'); diff --git a/core/modules/workflows/src/Form/DialogFormTrait.php b/core/modules/workflows/src/Form/DialogFormTrait.php index b688b1d..f4ee0f5 100644 --- a/core/modules/workflows/src/Form/DialogFormTrait.php +++ b/core/modules/workflows/src/Form/DialogFormTrait.php @@ -12,6 +12,9 @@ /** * Provides utilities for forms that want to be rendered in dialogs. + * + * @internal + * */ trait DialogFormTrait { @@ -103,7 +106,7 @@ public function submitFormDialog(array &$form, FormStateInterface $form_state) { } /** - * Close dialog #ajax callback. + * Closes dialog #ajax callback. * * @param array $form * An associative array containing the structure of the form. diff --git a/core/modules/workflows/src/Form/WorkflowStateAddForm.php b/core/modules/workflows/src/Form/WorkflowStateAddForm.php index 7699eda..5b6934d 100644 --- a/core/modules/workflows/src/Form/WorkflowStateAddForm.php +++ b/core/modules/workflows/src/Form/WorkflowStateAddForm.php @@ -7,6 +7,7 @@ use Drupal\Core\Form\SubformState; use Drupal\Core\Plugin\PluginFormFactoryInterface; use Drupal\workflows\StateInterface; +use Drupal\workflows\WorkflowInterface; use Symfony\Component\DependencyInjection\ContainerInterface; /** @@ -169,7 +170,7 @@ public function save(array $form, FormStateInterface $form_state) { /** * Route title callback. */ - public function getTitle($workflow = NULL) { + public function getTitle(WorkflowInterface $workflow = NULL) { return $this->t('Add a new state to the @workflow workflow', ['@workflow' => $workflow->label()]); } diff --git a/core/modules/workflows/src/Form/WorkflowStateEditForm.php b/core/modules/workflows/src/Form/WorkflowStateEditForm.php index b725182..5b4cbe1 100644 --- a/core/modules/workflows/src/Form/WorkflowStateEditForm.php +++ b/core/modules/workflows/src/Form/WorkflowStateEditForm.php @@ -7,6 +7,7 @@ use Drupal\Core\Form\SubformState; use Drupal\Core\Plugin\PluginFormFactoryInterface; use Drupal\workflows\StateInterface; +use Drupal\workflows\WorkflowInterface; use Symfony\Component\DependencyInjection\ContainerInterface; /** @@ -168,7 +169,7 @@ public function save(array $form, FormStateInterface $form_state) { /** * Route title callback. */ - public function getTitle($workflow = NULL, $workflow_state) { + public function getTitle(WorkflowInterface $workflow = NULL, $workflow_state) { $title = $this->t('Edit the @state state for the @workflow workflow', ['@state' => $workflow->getTypePlugin()->getState($workflow_state)->label(), '@workflow' => $workflow->label()]); return $title; } diff --git a/core/modules/workflows/src/Form/WorkflowTransitionAddForm.php b/core/modules/workflows/src/Form/WorkflowTransitionAddForm.php index 022dec1..eccf40b 100644 --- a/core/modules/workflows/src/Form/WorkflowTransitionAddForm.php +++ b/core/modules/workflows/src/Form/WorkflowTransitionAddForm.php @@ -8,6 +8,7 @@ use Drupal\Core\Plugin\PluginFormFactoryInterface; use Drupal\workflows\State; use Drupal\workflows\TransitionInterface; +use Drupal\workflows\WorkflowInterface; use Symfony\Component\DependencyInjection\ContainerInterface; /** @@ -196,7 +197,7 @@ public function save(array $form, FormStateInterface $form_state) { /** * Route title callback. */ - public function getTitle($workflow = NULL) { + public function getTitle(WorkflowInterface $workflow = NULL) { $title = $this->t('Add a new transition to the @workflow workflow', ['@workflow' => $workflow->label()]); return $title; } diff --git a/core/modules/workflows/src/Form/WorkflowTransitionEditForm.php b/core/modules/workflows/src/Form/WorkflowTransitionEditForm.php index 1c3e3cf..4447b98 100644 --- a/core/modules/workflows/src/Form/WorkflowTransitionEditForm.php +++ b/core/modules/workflows/src/Form/WorkflowTransitionEditForm.php @@ -9,6 +9,7 @@ use Drupal\Core\Url; use Drupal\workflows\State; use Drupal\workflows\TransitionInterface; +use Drupal\workflows\WorkflowInterface; use Symfony\Component\DependencyInjection\ContainerInterface; /** @@ -205,7 +206,7 @@ public function save(array $form, FormStateInterface $form_state) { /** * Route title callback. */ - public function getTitle($workflow = NULL, $workflow_transition) { + public function getTitle(WorkflowInterface $workflow = NULL, $workflow_transition) { $title = $this->t('Edit the @transition transition for the @workflow workflow', ['@transition' => $workflow->getTypePlugin()->getTransition($workflow_transition)->label(), '@workflow' => $workflow->label()]); return $title; }