Loading moderation_sidebar.module +4 −0 Original line number Diff line number Diff line Loading @@ -46,6 +46,10 @@ function moderation_sidebar_toolbar() { return $items; } if ($entity->isNew()) { return $items; } $cacheability->addCacheableDependency($entity); /** @var \Drupal\content_moderation\ModerationInformation $moderation_information */ Loading tests/src/Functional/ModerationSidebarTest.php +24 −1 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ class ModerationSidebarTest extends BrowserTestBase { 'moderation_sidebar', 'toolbar', 'content_moderation', 'node', 'workflows', 'entity_test', ]; Loading @@ -40,10 +41,12 @@ class ModerationSidebarTest extends BrowserTestBase { $workflow = $this->createEditorialWorkflow(); $this->addEntityTypeAndBundleToWorkflow($workflow, 'entity_test_mulrevpub', 'entity_test_mulrevpub'); $this->drupalCreateContentType(['type' => 'article']); $this->drupalLogin($this->createUser([ 'view test entity', 'access toolbar', 'access toolbar', 'create article content', 'use ' . $workflow->id() . ' transition create_new_draft', 'use ' . $workflow->id() . ' transition archive', 'use ' . $workflow->id() . ' transition publish', Loading Loading @@ -72,4 +75,24 @@ class ModerationSidebarTest extends BrowserTestBase { $this->assertEquals('Tasks', $toolbarItem->getText()); } /** * Test preview with moderation sidebar. */ public function testPreview() { $title_key = 'title[0][value]'; // Create an english node with an english menu. $this->drupalGet('/node/add/article'); $edit = [ $title_key => $this->randomMachineName(), ]; $this->drupalGet('node/add/article'); $this->submitForm($edit, 'Preview'); // Check that the preview is displaying the title, body and term. $expected_title = $edit[$title_key] . ' | Drupal'; $this->assertSession()->titleEquals($expected_title); $this->assertSession()->linkExists('Back to content editing'); } } Loading
moderation_sidebar.module +4 −0 Original line number Diff line number Diff line Loading @@ -46,6 +46,10 @@ function moderation_sidebar_toolbar() { return $items; } if ($entity->isNew()) { return $items; } $cacheability->addCacheableDependency($entity); /** @var \Drupal\content_moderation\ModerationInformation $moderation_information */ Loading
tests/src/Functional/ModerationSidebarTest.php +24 −1 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ class ModerationSidebarTest extends BrowserTestBase { 'moderation_sidebar', 'toolbar', 'content_moderation', 'node', 'workflows', 'entity_test', ]; Loading @@ -40,10 +41,12 @@ class ModerationSidebarTest extends BrowserTestBase { $workflow = $this->createEditorialWorkflow(); $this->addEntityTypeAndBundleToWorkflow($workflow, 'entity_test_mulrevpub', 'entity_test_mulrevpub'); $this->drupalCreateContentType(['type' => 'article']); $this->drupalLogin($this->createUser([ 'view test entity', 'access toolbar', 'access toolbar', 'create article content', 'use ' . $workflow->id() . ' transition create_new_draft', 'use ' . $workflow->id() . ' transition archive', 'use ' . $workflow->id() . ' transition publish', Loading Loading @@ -72,4 +75,24 @@ class ModerationSidebarTest extends BrowserTestBase { $this->assertEquals('Tasks', $toolbarItem->getText()); } /** * Test preview with moderation sidebar. */ public function testPreview() { $title_key = 'title[0][value]'; // Create an english node with an english menu. $this->drupalGet('/node/add/article'); $edit = [ $title_key => $this->randomMachineName(), ]; $this->drupalGet('node/add/article'); $this->submitForm($edit, 'Preview'); // Check that the preview is displaying the title, body and term. $expected_title = $edit[$title_key] . ' | Drupal'; $this->assertSession()->titleEquals($expected_title); $this->assertSession()->linkExists('Back to content editing'); } }