X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;ds=sidebyside;f=web%2Fcore%2Fmodules%2Fcontent_moderation%2Ftests%2Fsrc%2FFunctional%2FModerationStateTestBase.php;fp=web%2Fcore%2Fmodules%2Fcontent_moderation%2Ftests%2Fsrc%2FFunctional%2FModerationStateTestBase.php;h=5ee72ee2ad5af0ed7a65b7bf409a7c65c9a6c57f;hb=9917807b03b64faf00f6a1f29dcb6eafc454efa5;hp=1589a3ebd9d6db5b2ff578297f5d1b3af07582d5;hpb=aea91e65e895364e460983b890e295aa5d5540a5;p=yaffs-website diff --git a/web/core/modules/content_moderation/tests/src/Functional/ModerationStateTestBase.php b/web/core/modules/content_moderation/tests/src/Functional/ModerationStateTestBase.php index 1589a3ebd..5ee72ee2a 100644 --- a/web/core/modules/content_moderation/tests/src/Functional/ModerationStateTestBase.php +++ b/web/core/modules/content_moderation/tests/src/Functional/ModerationStateTestBase.php @@ -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();