Loading core/modules/content_moderation/tests/src/Functional/WorkspaceContentModerationIntegrationTest.php +2 −1 Original line number Diff line number Diff line Loading @@ -33,7 +33,7 @@ class WorkspaceContentModerationIntegrationTest extends ModerationStateTestBase protected function getAdministratorPermissions(): array { return array_merge($this->permissions, [ 'bypass node access', 'view any workspace', 'administer workspaces', ]); } Loading @@ -50,6 +50,7 @@ protected function setUp(): void { $this->createContentTypeFromUi('Article', 'article', TRUE); $this->setupWorkspaceSwitcherBlock(); $this->createWorkspaceThroughUi('Stage', 'stage'); } /** Loading core/modules/jsonapi/tests/src/Functional/WorkspaceTest.php +2 −1 Original line number Diff line number Diff line Loading @@ -15,6 +15,7 @@ * JSON:API integration test for the "Workspace" content entity type. * * @group jsonapi * @group workspaces */ class WorkspaceTest extends ResourceTestBase { Loading Loading @@ -142,7 +143,7 @@ protected function getExpectedDocument(): array { 'changed' => (new \DateTime())->setTimestamp($this->entity->getChangedTime())->setTimezone(new \DateTimeZone('UTC'))->format(\DateTime::RFC3339), 'label' => 'Campaign', 'drupal_internal__id' => 'campaign', 'drupal_internal__revision_id' => 2, 'drupal_internal__revision_id' => 1, ], 'relationships' => [ 'parent' => [ Loading core/modules/workspaces/tests/src/Functional/PathWorkspacesTest.php +5 −8 Original line number Diff line number Diff line Loading @@ -7,7 +7,6 @@ use Drupal\Tests\BrowserTestBase; use Drupal\Tests\content_translation\Traits\ContentTranslationTestTrait; use Drupal\Tests\WaitTerminateTestTrait; use Drupal\workspaces\Entity\Workspace; /** * Tests path aliases with workspaces. Loading Loading @@ -91,9 +90,8 @@ public function testPathAliases(): void { 'status' => TRUE, ]); // Switch to Stage and create an alias for the node. $stage = Workspace::load('stage'); $this->switchToWorkspace($stage); // Activate a workspace and create an alias for the node. $stage = $this->createAndActivateWorkspaceThroughUi('Stage', 'stage'); $edit = [ 'path[0][alias]' => '/' . $this->randomMachineName(), Loading Loading @@ -131,9 +129,8 @@ public function testPathAliasesUserSwitch(): void { 'status' => TRUE, ]); // Switch to Stage and create an alias for the node. $stage = Workspace::load('stage'); $this->switchToWorkspace($stage); // Activate a workspace and create an alias for the node. $stage = $this->createAndActivateWorkspaceThroughUi('Stage', 'stage'); $edit = [ 'path[0][alias]' => '/' . $this->randomMachineName(), Loading Loading @@ -169,7 +166,7 @@ public function testPathAliasesUserSwitch(): void { * Tests path aliases with workspaces for translatable nodes. */ public function testPathAliasesWithTranslation(): void { $stage = Workspace::load('stage'); $stage = $this->createWorkspaceThroughUi('Stage', 'stage'); // Create one node with a random alias. $default_node = $this->drupalCreateNode([ Loading core/modules/workspaces/tests/src/Functional/Rest/WorkspaceResourceTestBase.php +1 −1 Original line number Diff line number Diff line Loading @@ -123,7 +123,7 @@ protected function getExpectedNormalizedEntity() { ], 'revision_id' => [ [ 'value' => 2, 'value' => 1, ], ], 'parent' => [], Loading core/modules/workspaces/tests/src/Functional/WorkspaceCacheContextTest.php +11 −6 Original line number Diff line number Diff line Loading @@ -66,17 +66,22 @@ public function testWorkspaceCacheContext(): void { $cache_bin = $variation_cache_factory->get($build['#cache']['bin']); $this->assertInstanceOf(\stdClass::class, $cache_bin->get($build['#cache']['keys'], CacheableMetadata::createFromRenderArray($build))); // Switch to the 'stage' workspace and check that the correct workspace // cache context is used. // Switch to the test workspace and check that the correct workspace cache // context is used. $test_user = $this->drupalCreateUser(['view any workspace']); $this->drupalLogin($test_user); $stage = Workspace::load('stage'); $vultures = Workspace::create([ 'id' => 'vultures', 'label' => 'Vultures', ]); $vultures->save(); $workspace_manager = \Drupal::service('workspaces.manager'); $workspace_manager->setActiveWorkspace($stage); $workspace_manager->setActiveWorkspace($vultures); $cache_context = new WorkspaceCacheContext($workspace_manager); $this->assertSame('stage', $cache_context->getContext()); $this->assertSame('vultures', $cache_context->getContext()); $build = \Drupal::entityTypeManager()->getViewBuilder('node')->view($node, 'full'); Loading @@ -85,7 +90,7 @@ public function testWorkspaceCacheContext(): void { $this->assertContains('workspace', $build['#cache']['contexts']); $context_tokens = $cache_contexts_manager->convertTokensToKeys($build['#cache']['contexts'])->getKeys(); $this->assertContains('[workspace]=stage', $context_tokens); $this->assertContains('[workspace]=vultures', $context_tokens); // Test that a cache entry is created. $cache_bin = $variation_cache_factory->get($build['#cache']['bin']); Loading Loading
core/modules/content_moderation/tests/src/Functional/WorkspaceContentModerationIntegrationTest.php +2 −1 Original line number Diff line number Diff line Loading @@ -33,7 +33,7 @@ class WorkspaceContentModerationIntegrationTest extends ModerationStateTestBase protected function getAdministratorPermissions(): array { return array_merge($this->permissions, [ 'bypass node access', 'view any workspace', 'administer workspaces', ]); } Loading @@ -50,6 +50,7 @@ protected function setUp(): void { $this->createContentTypeFromUi('Article', 'article', TRUE); $this->setupWorkspaceSwitcherBlock(); $this->createWorkspaceThroughUi('Stage', 'stage'); } /** Loading
core/modules/jsonapi/tests/src/Functional/WorkspaceTest.php +2 −1 Original line number Diff line number Diff line Loading @@ -15,6 +15,7 @@ * JSON:API integration test for the "Workspace" content entity type. * * @group jsonapi * @group workspaces */ class WorkspaceTest extends ResourceTestBase { Loading Loading @@ -142,7 +143,7 @@ protected function getExpectedDocument(): array { 'changed' => (new \DateTime())->setTimestamp($this->entity->getChangedTime())->setTimezone(new \DateTimeZone('UTC'))->format(\DateTime::RFC3339), 'label' => 'Campaign', 'drupal_internal__id' => 'campaign', 'drupal_internal__revision_id' => 2, 'drupal_internal__revision_id' => 1, ], 'relationships' => [ 'parent' => [ Loading
core/modules/workspaces/tests/src/Functional/PathWorkspacesTest.php +5 −8 Original line number Diff line number Diff line Loading @@ -7,7 +7,6 @@ use Drupal\Tests\BrowserTestBase; use Drupal\Tests\content_translation\Traits\ContentTranslationTestTrait; use Drupal\Tests\WaitTerminateTestTrait; use Drupal\workspaces\Entity\Workspace; /** * Tests path aliases with workspaces. Loading Loading @@ -91,9 +90,8 @@ public function testPathAliases(): void { 'status' => TRUE, ]); // Switch to Stage and create an alias for the node. $stage = Workspace::load('stage'); $this->switchToWorkspace($stage); // Activate a workspace and create an alias for the node. $stage = $this->createAndActivateWorkspaceThroughUi('Stage', 'stage'); $edit = [ 'path[0][alias]' => '/' . $this->randomMachineName(), Loading Loading @@ -131,9 +129,8 @@ public function testPathAliasesUserSwitch(): void { 'status' => TRUE, ]); // Switch to Stage and create an alias for the node. $stage = Workspace::load('stage'); $this->switchToWorkspace($stage); // Activate a workspace and create an alias for the node. $stage = $this->createAndActivateWorkspaceThroughUi('Stage', 'stage'); $edit = [ 'path[0][alias]' => '/' . $this->randomMachineName(), Loading Loading @@ -169,7 +166,7 @@ public function testPathAliasesUserSwitch(): void { * Tests path aliases with workspaces for translatable nodes. */ public function testPathAliasesWithTranslation(): void { $stage = Workspace::load('stage'); $stage = $this->createWorkspaceThroughUi('Stage', 'stage'); // Create one node with a random alias. $default_node = $this->drupalCreateNode([ Loading
core/modules/workspaces/tests/src/Functional/Rest/WorkspaceResourceTestBase.php +1 −1 Original line number Diff line number Diff line Loading @@ -123,7 +123,7 @@ protected function getExpectedNormalizedEntity() { ], 'revision_id' => [ [ 'value' => 2, 'value' => 1, ], ], 'parent' => [], Loading
core/modules/workspaces/tests/src/Functional/WorkspaceCacheContextTest.php +11 −6 Original line number Diff line number Diff line Loading @@ -66,17 +66,22 @@ public function testWorkspaceCacheContext(): void { $cache_bin = $variation_cache_factory->get($build['#cache']['bin']); $this->assertInstanceOf(\stdClass::class, $cache_bin->get($build['#cache']['keys'], CacheableMetadata::createFromRenderArray($build))); // Switch to the 'stage' workspace and check that the correct workspace // cache context is used. // Switch to the test workspace and check that the correct workspace cache // context is used. $test_user = $this->drupalCreateUser(['view any workspace']); $this->drupalLogin($test_user); $stage = Workspace::load('stage'); $vultures = Workspace::create([ 'id' => 'vultures', 'label' => 'Vultures', ]); $vultures->save(); $workspace_manager = \Drupal::service('workspaces.manager'); $workspace_manager->setActiveWorkspace($stage); $workspace_manager->setActiveWorkspace($vultures); $cache_context = new WorkspaceCacheContext($workspace_manager); $this->assertSame('stage', $cache_context->getContext()); $this->assertSame('vultures', $cache_context->getContext()); $build = \Drupal::entityTypeManager()->getViewBuilder('node')->view($node, 'full'); Loading @@ -85,7 +90,7 @@ public function testWorkspaceCacheContext(): void { $this->assertContains('workspace', $build['#cache']['contexts']); $context_tokens = $cache_contexts_manager->convertTokensToKeys($build['#cache']['contexts'])->getKeys(); $this->assertContains('[workspace]=stage', $context_tokens); $this->assertContains('[workspace]=vultures', $context_tokens); // Test that a cache entry is created. $cache_bin = $variation_cache_factory->get($build['#cache']['bin']); Loading