X-Git-Url: https://yaffs.net/gitweb/?a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Fworkspaces%2Ftests%2Fsrc%2FFunctional%2FWorkspaceTest.php;h=00276ce0b63725b983e850c8cbb8d7255a82310e;hb=1c1cb0980bfa6caf0c24cce671b6bb541dc87583;hp=5c7bea6e6a60f4655d262f5859b2c470d909b634;hpb=9424afc6c1f518c301bf87a23c047d1873435d05;p=yaffs-website diff --git a/web/core/modules/workspaces/tests/src/Functional/WorkspaceTest.php b/web/core/modules/workspaces/tests/src/Functional/WorkspaceTest.php index 5c7bea6e6..00276ce0b 100644 --- a/web/core/modules/workspaces/tests/src/Functional/WorkspaceTest.php +++ b/web/core/modules/workspaces/tests/src/Functional/WorkspaceTest.php @@ -16,7 +16,7 @@ class WorkspaceTest extends BrowserTestBase { /** * {@inheritdoc} */ - public static $modules = ['workspaces']; + public static $modules = ['workspaces', 'toolbar']; /** * A test user. @@ -43,6 +43,8 @@ class WorkspaceTest extends BrowserTestBase { 'create workspace', 'edit own workspace', 'edit any workspace', + 'view own workspace', + 'access toolbar', ]; $this->editor1 = $this->drupalCreateUser($permissions); @@ -69,6 +71,36 @@ class WorkspaceTest extends BrowserTestBase { $page->hasContent("This value is not valid"); } + /** + * Test that the toolbar correctly shows the active workspace. + */ + public function testWorkspaceToolbar() { + $this->drupalLogin($this->editor1); + + $this->drupalPostForm('/admin/config/workflow/workspaces/add', [ + 'id' => 'test_workspace', + 'label' => 'Test workspace', + ], 'Save'); + + // Activate the test workspace. + $this->drupalPostForm('/admin/config/workflow/workspaces/manage/test_workspace/activate', [], 'Confirm'); + + $this->drupalGet(''); + $page = $this->getSession()->getPage(); + // Toolbar should show the correct label. + $this->assertTrue($page->hasLink('Test workspace')); + + // Change the workspace label. + $this->drupalPostForm('/admin/config/workflow/workspaces/manage/test_workspace/edit', [ + 'label' => 'New name', + ], 'Save'); + + $this->drupalGet(''); + $page = $this->getSession()->getPage(); + // Toolbar should show the new label. + $this->assertTrue($page->hasLink('New name')); + } + /** * Test changing the owner of a workspace. */