diff --git a/composer.json b/composer.json index c4dfe27..32bdb87 100644 --- a/composer.json +++ b/composer.json @@ -16,11 +16,14 @@ "localgovdrupal/localgov_paragraphs": "^2.3", "localgovdrupal/localgov_topics": "^1.0" }, + "require-dev": { + "localgovdrupal/localgov_workflows": "^1.3" + }, "extra": { "enable-patching": true, "patches": { "drupal/core": { - "node_access filters out accessible nodes when node is left joined (1349080)" : "https://git.drupalcode.org/project/drupal/-/commit/c271adb.diff" + "node_access filters out accessible nodes when node is left joined (1349080)": "https://git.drupalcode.org/project/drupal/-/commit/c271adb.diff" } } } diff --git a/modules/localgov_services_landing/config/install/core.entity_form_display.node.localgov_services_landing.default.yml b/modules/localgov_services_landing/config/install/core.entity_form_display.node.localgov_services_landing.default.yml index 2f9701e..976d0d0 100644 --- a/modules/localgov_services_landing/config/install/core.entity_form_display.node.localgov_services_landing.default.yml +++ b/modules/localgov_services_landing/config/install/core.entity_form_display.node.localgov_services_landing.default.yml @@ -19,7 +19,6 @@ dependencies: - field.field.node.localgov_services_landing.localgov_twitter - node.type.localgov_services_landing module: - - content_moderation - field_group - link - localgov_services @@ -295,12 +294,6 @@ content: size: 60 placeholder: '' third_party_settings: { } - moderation_state: - type: moderation_state_default - weight: 9 - region: content - settings: { } - third_party_settings: { } path: type: path weight: 7 diff --git a/modules/localgov_services_landing/config/install/core.entity_view_display.node.localgov_services_landing.default.yml b/modules/localgov_services_landing/config/install/core.entity_view_display.node.localgov_services_landing.default.yml index 86a0c0b..f6a80d4 100644 --- a/modules/localgov_services_landing/config/install/core.entity_view_display.node.localgov_services_landing.default.yml +++ b/modules/localgov_services_landing/config/install/core.entity_view_display.node.localgov_services_landing.default.yml @@ -127,7 +127,6 @@ content: link_to_entity: false third_party_settings: { } hidden: - content_moderation_control: true localgov_common_tasks: true localgov_contact_us_online: true localgov_other_team_contacts: true diff --git a/modules/localgov_services_landing/config/install/core.entity_view_display.node.localgov_services_landing.search_index.yml b/modules/localgov_services_landing/config/install/core.entity_view_display.node.localgov_services_landing.search_index.yml index adc8b4b..2619905 100644 --- a/modules/localgov_services_landing/config/install/core.entity_view_display.node.localgov_services_landing.search_index.yml +++ b/modules/localgov_services_landing/config/install/core.entity_view_display.node.localgov_services_landing.search_index.yml @@ -156,6 +156,5 @@ content: link_to_entity: false third_party_settings: { } hidden: - content_moderation_control: true links: true search_api_excerpt: true diff --git a/modules/localgov_services_landing/config/install/core.entity_view_display.node.localgov_services_landing.search_result.yml b/modules/localgov_services_landing/config/install/core.entity_view_display.node.localgov_services_landing.search_result.yml index 83418a7..2bdaea2 100644 --- a/modules/localgov_services_landing/config/install/core.entity_view_display.node.localgov_services_landing.search_result.yml +++ b/modules/localgov_services_landing/config/install/core.entity_view_display.node.localgov_services_landing.search_result.yml @@ -32,7 +32,6 @@ content: region: content hidden: body: true - content_moderation_control: true links: true localgov_address: true localgov_address_first_line: true diff --git a/modules/localgov_services_landing/config/install/core.entity_view_display.node.localgov_services_landing.teaser.yml b/modules/localgov_services_landing/config/install/core.entity_view_display.node.localgov_services_landing.teaser.yml index 5213884..e7806ff 100644 --- a/modules/localgov_services_landing/config/install/core.entity_view_display.node.localgov_services_landing.teaser.yml +++ b/modules/localgov_services_landing/config/install/core.entity_view_display.node.localgov_services_landing.teaser.yml @@ -34,7 +34,6 @@ content: third_party_settings: { } region: content hidden: - content_moderation_control: true localgov_address: true localgov_address_first_line: true localgov_common_tasks: true diff --git a/modules/localgov_services_navigation/tests/src/FunctionalJavascript/LandingPageChildrenTest.php b/modules/localgov_services_navigation/tests/src/FunctionalJavascript/LandingPageChildrenTest.php index b9d4f02..b000845 100644 --- a/modules/localgov_services_navigation/tests/src/FunctionalJavascript/LandingPageChildrenTest.php +++ b/modules/localgov_services_navigation/tests/src/FunctionalJavascript/LandingPageChildrenTest.php @@ -20,7 +20,7 @@ class LandingPageChildrenTest extends WebDriverTestBase { /** * {@inheritdoc} */ - protected $defaultTheme = 'stark'; + protected $defaultTheme = 'claro'; /** * A user to edit landing pages. diff --git a/modules/localgov_services_page/config/install/core.entity_form_display.node.localgov_services_page.default.yml b/modules/localgov_services_page/config/install/core.entity_form_display.node.localgov_services_page.default.yml index 3d48db7..8214731 100644 --- a/modules/localgov_services_page/config/install/core.entity_form_display.node.localgov_services_page.default.yml +++ b/modules/localgov_services_page/config/install/core.entity_form_display.node.localgov_services_page.default.yml @@ -13,7 +13,6 @@ dependencies: - field.field.node.localgov_services_page.localgov_topic_classified - node.type.localgov_services_page module: - - content_moderation - entity_browser - field_group - link_attributes @@ -177,12 +176,6 @@ content: size: 60 placeholder: '' third_party_settings: { } - moderation_state: - type: moderation_state_default - weight: 3 - region: content - settings: { } - third_party_settings: { } path: type: path weight: 8 diff --git a/modules/localgov_services_page/config/install/core.entity_view_display.node.localgov_services_page.default.yml b/modules/localgov_services_page/config/install/core.entity_view_display.node.localgov_services_page.default.yml index 71a5f15..d897eca 100644 --- a/modules/localgov_services_page/config/install/core.entity_view_display.node.localgov_services_page.default.yml +++ b/modules/localgov_services_page/config/install/core.entity_view_display.node.localgov_services_page.default.yml @@ -37,7 +37,6 @@ content: type: entity_reference_entity_view region: content hidden: - content_moderation_control: true localgov_common_tasks: true localgov_download_links: true localgov_hide_related_topics: true diff --git a/modules/localgov_services_page/config/install/core.entity_view_display.node.localgov_services_page.search_index.yml b/modules/localgov_services_page/config/install/core.entity_view_display.node.localgov_services_page.search_index.yml index 1c29b7f..a5f9b91 100644 --- a/modules/localgov_services_page/config/install/core.entity_view_display.node.localgov_services_page.search_index.yml +++ b/modules/localgov_services_page/config/install/core.entity_view_display.node.localgov_services_page.search_index.yml @@ -91,7 +91,6 @@ content: link: false third_party_settings: { } hidden: - content_moderation_control: true links: true localgov_hide_related_topics: true localgov_override_related_links: true diff --git a/modules/localgov_services_page/config/install/core.entity_view_display.node.localgov_services_page.search_result.yml b/modules/localgov_services_page/config/install/core.entity_view_display.node.localgov_services_page.search_result.yml index 39694ef..80e425b 100644 --- a/modules/localgov_services_page/config/install/core.entity_view_display.node.localgov_services_page.search_result.yml +++ b/modules/localgov_services_page/config/install/core.entity_view_display.node.localgov_services_page.search_result.yml @@ -28,7 +28,6 @@ content: region: content hidden: body: true - content_moderation_control: true links: true localgov_common_tasks: true localgov_download_links: true diff --git a/modules/localgov_services_page/config/install/core.entity_view_display.node.localgov_services_page.teaser.yml b/modules/localgov_services_page/config/install/core.entity_view_display.node.localgov_services_page.teaser.yml index fa6a431..7c556d2 100644 --- a/modules/localgov_services_page/config/install/core.entity_view_display.node.localgov_services_page.teaser.yml +++ b/modules/localgov_services_page/config/install/core.entity_view_display.node.localgov_services_page.teaser.yml @@ -30,7 +30,6 @@ content: third_party_settings: { } region: content hidden: - content_moderation_control: true localgov_common_tasks: true localgov_download_links: true localgov_hide_related_topics: true diff --git a/modules/localgov_services_page/localgov_services_page.info.yml b/modules/localgov_services_page/localgov_services_page.info.yml index afba5f9..02b447d 100644 --- a/modules/localgov_services_page/localgov_services_page.info.yml +++ b/modules/localgov_services_page/localgov_services_page.info.yml @@ -5,7 +5,6 @@ type: module package: LocalGov Drupal dependencies: - - drupal:content_moderation - drupal:field - drupal:link - drupal:menu_ui diff --git a/modules/localgov_services_status/config/install/core.entity_form_display.node.localgov_services_status.default.yml b/modules/localgov_services_status/config/install/core.entity_form_display.node.localgov_services_status.default.yml index 31ff612..d50ccdb 100644 --- a/modules/localgov_services_status/config/install/core.entity_form_display.node.localgov_services_status.default.yml +++ b/modules/localgov_services_status/config/install/core.entity_form_display.node.localgov_services_status.default.yml @@ -11,7 +11,6 @@ dependencies: - node.type.localgov_services_status module: - condition_field - - content_moderation - path - text id: node.localgov_services_status.default @@ -71,12 +70,6 @@ content: size: 60 placeholder: '' third_party_settings: { } - moderation_state: - type: moderation_state_default - weight: 9 - region: content - settings: { } - third_party_settings: { } path: type: path weight: 14 diff --git a/modules/localgov_services_status/config/install/core.entity_view_display.node.localgov_services_status.default.yml b/modules/localgov_services_status/config/install/core.entity_view_display.node.localgov_services_status.default.yml index 236edf3..c764d80 100644 --- a/modules/localgov_services_status/config/install/core.entity_view_display.node.localgov_services_status.default.yml +++ b/modules/localgov_services_status/config/install/core.entity_view_display.node.localgov_services_status.default.yml @@ -25,7 +25,6 @@ content: third_party_settings: { } region: content hidden: - content_moderation_control: true localgov_service_status_visibile: true links: true localgov_service_status: true diff --git a/modules/localgov_services_status/config/install/core.entity_view_display.node.localgov_services_status.message.yml b/modules/localgov_services_status/config/install/core.entity_view_display.node.localgov_services_status.message.yml index e5522b5..203902c 100644 --- a/modules/localgov_services_status/config/install/core.entity_view_display.node.localgov_services_status.message.yml +++ b/modules/localgov_services_status/config/install/core.entity_view_display.node.localgov_services_status.message.yml @@ -26,7 +26,6 @@ content: third_party_settings: { } region: content hidden: - content_moderation_control: true links: true localgov_service_status: true localgov_service_status_on_landi: true diff --git a/modules/localgov_services_status/config/install/core.entity_view_display.node.localgov_services_status.search_index.yml b/modules/localgov_services_status/config/install/core.entity_view_display.node.localgov_services_status.search_index.yml index 39fe2da..7a1f8f6 100644 --- a/modules/localgov_services_status/config/install/core.entity_view_display.node.localgov_services_status.search_index.yml +++ b/modules/localgov_services_status/config/install/core.entity_view_display.node.localgov_services_status.search_index.yml @@ -41,7 +41,6 @@ content: link: true third_party_settings: { } hidden: - content_moderation_control: true links: true localgov_service_status_on_landi: true localgov_service_status_on_list: true diff --git a/modules/localgov_services_status/config/install/core.entity_view_display.node.localgov_services_status.search_result.yml b/modules/localgov_services_status/config/install/core.entity_view_display.node.localgov_services_status.search_result.yml index 7624a6c..4f94479 100644 --- a/modules/localgov_services_status/config/install/core.entity_view_display.node.localgov_services_status.search_result.yml +++ b/modules/localgov_services_status/config/install/core.entity_view_display.node.localgov_services_status.search_result.yml @@ -24,7 +24,6 @@ content: region: content hidden: body: true - content_moderation_control: true links: true localgov_service_status: true localgov_service_status_on_landi: true diff --git a/modules/localgov_services_sublanding/config/install/core.entity_form_display.node.localgov_services_sublanding.default.yml b/modules/localgov_services_sublanding/config/install/core.entity_form_display.node.localgov_services_sublanding.default.yml index f80edb8..7863f91 100644 --- a/modules/localgov_services_sublanding/config/install/core.entity_form_display.node.localgov_services_sublanding.default.yml +++ b/modules/localgov_services_sublanding/config/install/core.entity_form_display.node.localgov_services_sublanding.default.yml @@ -7,7 +7,6 @@ dependencies: - field.field.node.localgov_services_sublanding.localgov_topics - node.type.localgov_services_sublanding module: - - content_moderation - field_group - paragraphs - path @@ -106,12 +105,6 @@ content: form_display_mode: default default_paragraph_type: '' third_party_settings: { } - moderation_state: - type: moderation_state_default - weight: 4 - region: content - settings: { } - third_party_settings: { } path: type: path weight: 10 diff --git a/modules/localgov_services_sublanding/config/install/core.entity_view_display.node.localgov_services_sublanding.default.yml b/modules/localgov_services_sublanding/config/install/core.entity_view_display.node.localgov_services_sublanding.default.yml index 2429242..a9ac13a 100644 --- a/modules/localgov_services_sublanding/config/install/core.entity_view_display.node.localgov_services_sublanding.default.yml +++ b/modules/localgov_services_sublanding/config/install/core.entity_view_display.node.localgov_services_sublanding.default.yml @@ -25,6 +25,5 @@ content: region: content hidden: body: true - content_moderation_control: true links: true localgov_services_parent: true diff --git a/modules/localgov_services_sublanding/config/install/core.entity_view_display.node.localgov_services_sublanding.search_index.yml b/modules/localgov_services_sublanding/config/install/core.entity_view_display.node.localgov_services_sublanding.search_index.yml index 11046ac..1a4db1d 100644 --- a/modules/localgov_services_sublanding/config/install/core.entity_view_display.node.localgov_services_sublanding.search_index.yml +++ b/modules/localgov_services_sublanding/config/install/core.entity_view_display.node.localgov_services_sublanding.search_index.yml @@ -41,6 +41,5 @@ content: third_party_settings: { } region: content hidden: - content_moderation_control: true links: true search_api_excerpt: true diff --git a/modules/localgov_services_sublanding/config/install/core.entity_view_display.node.localgov_services_sublanding.search_result.yml b/modules/localgov_services_sublanding/config/install/core.entity_view_display.node.localgov_services_sublanding.search_result.yml index 2b39b0a..a3701c7 100644 --- a/modules/localgov_services_sublanding/config/install/core.entity_view_display.node.localgov_services_sublanding.search_result.yml +++ b/modules/localgov_services_sublanding/config/install/core.entity_view_display.node.localgov_services_sublanding.search_result.yml @@ -22,7 +22,6 @@ content: region: content hidden: body: true - content_moderation_control: true links: true localgov_services_parent: true localgov_topics: true diff --git a/modules/localgov_services_sublanding/config/install/core.entity_view_display.node.localgov_services_sublanding.teaser.yml b/modules/localgov_services_sublanding/config/install/core.entity_view_display.node.localgov_services_sublanding.teaser.yml index d83a9bc..072069f 100644 --- a/modules/localgov_services_sublanding/config/install/core.entity_view_display.node.localgov_services_sublanding.teaser.yml +++ b/modules/localgov_services_sublanding/config/install/core.entity_view_display.node.localgov_services_sublanding.teaser.yml @@ -24,7 +24,6 @@ content: third_party_settings: { } region: content hidden: - content_moderation_control: true localgov_topics: true links: true localgov_services_parent: true diff --git a/modules/localgov_services_sublanding/localgov_services_sublanding.info.yml b/modules/localgov_services_sublanding/localgov_services_sublanding.info.yml index c675c6b..855c428 100644 --- a/modules/localgov_services_sublanding/localgov_services_sublanding.info.yml +++ b/modules/localgov_services_sublanding/localgov_services_sublanding.info.yml @@ -5,7 +5,6 @@ type: module package: LocalGov Drupal dependencies: - - drupal:content_moderation - drupal:field - drupal:menu_ui - drupal:node diff --git a/tests/src/Functional/WorkflowsIntegrationTest.php b/tests/src/Functional/WorkflowsIntegrationTest.php new file mode 100644 index 0000000..0fbf550 --- /dev/null +++ b/tests/src/Functional/WorkflowsIntegrationTest.php @@ -0,0 +1,142 @@ +drupalPlaceBlock('system_breadcrumb_block'); + // LocalGov Workflows includes access and other checks. + $this->adminUser = $this->drupalCreateUser([ + 'bypass node access', + 'administer nodes', + 'use localgov_editorial transition approve', + 'use localgov_editorial transition archive', + 'use localgov_editorial transition archived_draft', + 'use localgov_editorial transition archived_published', + 'use localgov_editorial transition create_new_draft', + 'use localgov_editorial transition publish', + 'use localgov_editorial transition reject', + 'use localgov_editorial transition submit_for_review', + 'view all scheduled transitions', + 'view any unpublished content', + 'view latest version', + ]); + $this->nodeStorage = $this->container->get('entity_type.manager')->getStorage('node'); + } + + /** + * Post and link test, change workflow status. + * + * Post a service landing page. + * Post a service sub landing page, and link to landing page. + * Link landing page to sublanding page. + * Post a page, put it in the landing and sublanding services. + * Link page from sublanding page. + */ + public function testPostLink() { + $this->drupalLogin($this->adminUser); + $this->drupalGet('node/add/localgov_services_landing'); + $form = $this->getSession()->getPage(); + $form->fillField('edit-title-0-value', 'Service 1'); + $form->fillField('edit-body-0-summary', 'Service 1 summary'); + $form->fillField('edit-body-0-value', 'Service 1 description'); + $form->pressButton('edit-submit'); + // Should default to Draft. + $this->drupalGet('node/add/localgov_services_sublanding'); + $form = $this->getSession()->getPage(); + $form->fillField('edit-title-0-value', 'Sub Service 1'); + $form->fillField('edit-body-0-summary', 'Sub Service 1 summary'); + $form->fillField('edit-body-0-value', 'Sub Service 1 description'); + $form->fillField('edit-localgov-services-parent-0-target-id', 'Service 1 (1)'); + $form->pressButton('edit-submit'); + // Also Draft. + $this->drupalGet('node/1/edit'); + $form = $this->getSession()->getPage(); + // Check is in Draft. + $state = $form->findField('edit-moderation-state-0-state'); + $this->assertEquals('draft', $state->getValue()); + // Change to Published. + $state->setValue('published'); + $form->fillField('edit-localgov-destinations-0-target-id', 'Sub landing 1 (2)'); + $form->pressButton('edit-submit'); + + $this->drupalGet('node/add/localgov_services_page'); + $assert = $this->assertSession(); + $form = $this->getSession()->getPage(); + $form->fillField('edit-title-0-value', 'Service 1 Page 1'); + $form->fillField('edit-body-0-summary', 'Service 1 summary 1 '); + $form->fillField('edit-body-0-value', 'Service 1 description 1'); + $form->fillField('edit-localgov-services-parent-0-target-id', 'Service 1 » Sub landing 1 (2)'); + $form->pressButton('edit-submit'); + + $this->drupalGet('node/2/edit'); + $form = $this->getSession()->getPage(); + $state = $form->findField('edit-moderation-state-0-state'); + $this->assertEquals('draft', $state->getValue()); + // Change to Published. + $state->setValue('published'); + $form->fillField('edit-localgov-topics-0-subform-topic-list-links-0-uri', '/node/3'); + $form->pressButton('edit-submit'); + + $assert = $this->assertSession(); + $assert->pageTextContains('Service 1 Page 1'); + + $this->drupalLogout(); + $this->drupalGet('node/2'); + $assert->pageTextNotContains('Service 1 Page 1'); + $this->drupalGet('node/3'); + $this->assertSession()->statusCodeEquals(403); + } + +} diff --git a/tests/src/Functional/WorkspacesIntegrationTest.php b/tests/src/Functional/WorkspacesIntegrationTest.php new file mode 100644 index 0000000..647c0c2 --- /dev/null +++ b/tests/src/Functional/WorkspacesIntegrationTest.php @@ -0,0 +1,229 @@ +drupalPlaceBlock('system_breadcrumb_block'); + $this->adminUser = $this->drupalCreateUser([ + 'access administration pages', + 'bypass node access', + 'administer nodes', + 'administer workspaces', + 'create url aliases', + ]); + $this->nodeStorage = $this->container->get('entity_type.manager')->getStorage('node'); + $this->setupWorkspaceSwitcherBlock(); + } + + /** + * Post and link test. + * + * Post a service landing page. + * Post a service sub landing page, and link to landing page. + * Link landing page to sublanding page. + * Post a page, put it in the landing and sublanding services. + * Link page from sublanding page. + */ + public function testPostLink() { + $assert = $this->assertSession(); + $this->drupalLogin($this->adminUser); + + $test_1 = $this->createWorkspaceThroughUi('Test 1', 'test_1'); + $this->switchToWorkspace($test_1); + + $this->drupalGet('node/add/localgov_services_landing'); + $form = $this->getSession()->getPage(); + $form->fillField('edit-title-0-value', 'Service 1'); + $form->fillField('edit-body-0-summary', 'Service 1 summary'); + $form->fillField('edit-body-0-value', 'Service 1 description'); + $form->checkField('edit-status-value'); + $form->pressButton('edit-submit'); + $service_landing = $this->drupalGetNodeByTitle('Service 1'); + + $this->drupalGet('node/add/localgov_services_sublanding'); + $form = $this->getSession()->getPage(); + $form->fillField('edit-title-0-value', 'Sub Service 1'); + $form->fillField('edit-body-0-summary', 'Sub Service 1 summary'); + $form->fillField('edit-body-0-value', 'Sub Service 1 description'); + $form->fillField('edit-localgov-services-parent-0-target-id', 'Service 1 (1)'); + $form->checkField('edit-status-value'); + $form->pressButton('edit-submit'); + $service_sublanding = $this->drupalGetNodeByTitle('Sub Service 1'); + + $this->drupalGet($service_landing->toUrl('edit-form')->toString()); + $form = $this->getSession()->getPage(); + $form->fillField('edit-localgov-destinations-0-target-id', 'Sub landing 1 (2)'); + $form->pressButton('edit-submit'); + + $this->drupalGet('node/add/localgov_services_page'); + $form = $this->getSession()->getPage(); + $form->fillField('edit-title-0-value', 'Service 1 Page 1'); + $form->fillField('edit-body-0-summary', 'Service 1 summary 1 '); + $form->fillField('edit-body-0-value', 'Service 1 description 1'); + $form->fillField('edit-localgov-services-parent-0-target-id', 'Service 1 » Sub landing 1 (2)'); + $form->checkField('edit-status-value'); + $form->pressButton('edit-submit'); + $service_page = $this->drupalGetNodeByTitle('Service 1 Page 1'); + + $this->drupalGet($service_sublanding->toUrl('edit-form')->toString()); + $form = $this->getSession()->getPage(); + $form->fillField('edit-localgov-topics-0-subform-topic-list-links-0-uri', '/node/3'); + $form->pressButton('edit-submit'); + $assert->pageTextContains('Service 1 Page 1'); + + $this->drupalLogout(); + + $this->drupalGet($service_landing->toUrl()->toString()); + $assert->statusCodeEquals(403); + $this->drupalGet($service_sublanding->toUrl()->toString()); + $assert->statusCodeEquals(403); + $this->drupalGet($service_page->toUrl()->toString()); + $assert->statusCodeEquals(403); + + $this->drupalLogin($this->adminUser); + $this->drupalGet($test_1->toUrl()->toString()); + $assert->pageTextContains('3 content items'); + $assert->pageTextContains('3 URL aliases'); + $assert->pageTextContains('1 Paragraph'); + $this->drupalGet($test_1->toUrl()->toString() . '/publish'); + $this->getSession()->getPage()->pressButton('Publish 7 items to Live'); + $this->assertSession()->pageTextContains('Successful publication.'); + + $this->drupalGet($service_landing->toUrl()->toString()); + $this->drupalGet($service_landing->toUrl('edit-form')->toString()); + + $this->drupalLogout(); + + $this->drupalGet($service_landing->toUrl()->toString()); + $assert->statusCodeEquals(200); + $this->drupalGet($service_sublanding->toUrl()->toString()); + $assert->statusCodeEquals(200); + $this->drupalGet($service_page->toUrl()->toString()); + $assert->statusCodeEquals(200); + } + + /** + * Path test. + */ + public function testServicePaths() { + $assert = $this->assertSession(); + // @todo same as original test without admin privs? + $this->drupalLogin($this->adminUser); + $test_1 = $this->createWorkspaceThroughUi('Test 1', 'test_1'); + $this->switchToWorkspace($test_1); + + $node = $this->createNode([ + 'title' => 'Landing Page 1', + 'type' => 'localgov_services_landing', + 'status' => NodeInterface::PUBLISHED, + ]); + $node = $this->createNode([ + 'title' => 'Sublanding 1', + 'type' => 'localgov_services_sublanding', + 'status' => NodeInterface::PUBLISHED, + 'localgov_services_parent' => ['target_id' => $node->id()], + ]); + $this->createNode([ + 'title' => 'Service Page 1', + 'type' => 'localgov_services_page', + 'status' => NodeInterface::PUBLISHED, + 'localgov_services_parent' => ['target_id' => $node->id()], + ]); + + $this->drupalGet('landing-page-1'); + $assert->pageTextContains('Landing Page 1'); + $trail = ['' => 'Home']; + $this->assertBreadcrumb(NULL, $trail); + $this->drupalGet('landing-page-1/sublanding-1'); + $assert->pageTextContains('Sublanding 1'); + $trail += ['landing-page-1' => 'Landing Page 1']; + $this->assertBreadcrumb(NULL, $trail); + $this->drupalGet('landing-page-1/sublanding-1/service-page-1'); + $assert->pageTextContains('Service Page 1'); + $trail += ['landing-page-1/sublanding-1' => 'Sublanding 1']; + $this->assertBreadcrumb(NULL, $trail); + + $this->drupalGet($test_1->toUrl()->toString()); + $assert->pageTextContains('3 content items'); + $assert->pageTextContains('3 URL aliases'); + $this->drupalGet($test_1->toUrl()->toString() . '/publish'); + $this->getSession()->getPage()->pressButton('Publish 6 items to Live'); + $this->assertSession()->pageTextContains('Successful publication.'); + $this->drupalLogout(); + + $this->drupalGet('landing-page-1'); + $assert->pageTextContains('Landing Page 1'); + $trail = ['' => 'Home']; + $this->assertBreadcrumb(NULL, $trail); + $this->drupalGet('landing-page-1/sublanding-1'); + $assert->pageTextContains('Sublanding 1'); + $trail += ['landing-page-1' => 'Landing Page 1']; + $this->assertBreadcrumb(NULL, $trail); + $this->drupalGet('landing-page-1/sublanding-1/service-page-1'); + $assert->pageTextContains('Service Page 1'); + $trail += ['landing-page-1/sublanding-1' => 'Sublanding 1']; + $this->assertBreadcrumb(NULL, $trail); + } + +}