Security update for Core, with self-updated composer
[yaffs-website] / web / core / modules / content_moderation / tests / src / Functional / ModerationStateTestBase.php
index 1589a3ebd9d6db5b2ff578297f5d1b3af07582d5..5ee72ee2ad5af0ed7a65b7bf409a7c65c9a6c57f 100644 (file)
@@ -13,6 +13,8 @@ abstract class ModerationStateTestBase extends BrowserTestBase {
 
   /**
    * Profile to use.
+   *
+   * @var string
    */
   protected $profile = 'testing';
 
@@ -29,7 +31,7 @@ abstract class ModerationStateTestBase extends BrowserTestBase {
    * @var array
    */
   protected $permissions = [
-    'administer content moderation',
+    'administer workflows',
     'access administration pages',
     'administer content types',
     'administer nodes',
@@ -38,6 +40,9 @@ abstract class ModerationStateTestBase extends BrowserTestBase {
     'access content overview',
     'use editorial transition create_new_draft',
     'use editorial transition publish',
+    'use editorial transition archive',
+    'use editorial transition archived_draft',
+    'use editorial transition archived_published',
   ];
 
   /**
@@ -94,6 +99,11 @@ abstract class ModerationStateTestBase extends BrowserTestBase {
   protected function createContentTypeFromUi($content_type_name, $content_type_id, $moderated = FALSE, $workflow_id = 'editorial') {
     $this->drupalGet('admin/structure/types');
     $this->clickLink('Add content type');
+
+    // Check that the 'Create new revision' checkbox is checked and disabled.
+    $this->assertSession()->checkboxChecked('options[revision]');
+    $this->assertSession()->fieldDisabled('options[revision]');
+
     $edit = [
       'name' => $content_type_name,
       'type' => $content_type_id,
@@ -113,9 +123,11 @@ abstract class ModerationStateTestBase extends BrowserTestBase {
    * @param string $workflow_id
    *   The workflow to attach to the bundle.
    */
-  protected function enableModerationThroughUi($content_type_id, $workflow_id = 'editorial') {
-    $edit['workflow'] = $workflow_id;
-    $this->drupalPostForm('admin/structure/types/manage/' . $content_type_id . '/moderation', $edit, t('Save'));
+  public function enableModerationThroughUi($content_type_id, $workflow_id = 'editorial') {
+    $this->drupalGet('/admin/config/workflow/workflows');
+    $this->assertLinkByHref('admin/config/workflow/workflows/manage/' . $workflow_id);
+    $edit['bundles[' . $content_type_id . ']'] = TRUE;
+    $this->drupalPostForm('admin/config/workflow/workflows/manage/' . $workflow_id . '/type/node', $edit, t('Save'));
     // Ensure the parent environment is up-to-date.
     // @see content_moderation_workflow_insert()
     \Drupal::service('entity_type.bundle.info')->clearCachedBundles();