Loading scheduler_content_moderation_integration.info.yml +1 −1 Original line number Diff line number Diff line name: Scheduler Content Moderation Integration type: module description: 'Scheduler sub-module providing content moderation functionality for publishing/unpublishing.' core_version_requirement: ^8.7.7 || ^9 core_version_requirement: ^8.7.7 || ^9 || ^10 dependencies: - drupal:options - drupal:content_moderation Loading scheduler_content_moderation_integration.module +1 −1 Original line number Diff line number Diff line Loading @@ -13,9 +13,9 @@ use Drupal\Core\Access\AccessResult; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityTypeInterface; use Drupal\Core\Entity\FieldableEntityInterface; use Drupal\Core\Field\BaseFieldDefinition; use Drupal\Core\Entity\EntityTypeInterface; use Drupal\Core\Field\FieldStorageDefinitionInterface; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Render\Element; Loading tests/src/Functional/FormsTest.php +2 −1 Original line number Diff line number Diff line Loading @@ -150,7 +150,7 @@ class FormsTest extends SchedulerContentModerationBrowserTestBase { // Check that both state fields are shown by default. $this->drupalGet($url); $this->assertResponse(200); $this->assertSession()->statusCodeEquals(200, "The $operation form is displayed without error"); $assert->FieldExists('publish_state[0]'); $assert->FieldExists('unpublish_state[0]'); Loading @@ -166,6 +166,7 @@ class FormsTest extends SchedulerContentModerationBrowserTestBase { // Check that both state fields are now hidden. $this->drupalGet($url); $this->assertSession()->statusCodeEquals(200, "The $operation form is displayed without error"); $assert->FieldNotExists('publish_state[0]'); $assert->FieldNotExists('unpublish_state[0]'); } Loading tests/src/Functional/SchedulerContentModerationBrowserTestBase.php +1 −1 Original line number Diff line number Diff line Loading @@ -42,7 +42,7 @@ abstract class SchedulerContentModerationBrowserTestBase extends BrowserTestBase /** * {@inheritdoc} */ protected function setUp() { protected function setUp(): void { parent::setUp(); $this->drupalCreateContentType([ Loading tests/src/Functional/TransitionAccessTest.php +6 −6 Original line number Diff line number Diff line Loading @@ -92,7 +92,7 @@ class TransitionAccessTest extends SchedulerContentModerationBrowserTestBase { 'publish_state[0]' => 'published', ]; $this->drupalGet("$entityTypeId/{$entity->id()}/edit"); $this->assertResponse(200, 'Scheduler user should be able to edit the entity."'); $this->assertSession()->statusCodeEquals(200, 'Scheduler user should be able to edit the entity."'); $this->submitForm($edit, 'Save'); $this->assertSession() Loading @@ -102,7 +102,7 @@ class TransitionAccessTest extends SchedulerContentModerationBrowserTestBase { // editing access should be denied. $this->drupalLogin($restrictedUser); $this->drupalGet("$entityTypeId/{$entity->id()}/edit"); $this->assertResponse(403, 'Restricted user should not be able to edit the entity."'); $this->assertSession()->statusCodeEquals(403, 'Restricted user should not be able to edit the entity."'); // Remove scheduling info. $this->drupalLogin($schedulerUser); Loading @@ -118,7 +118,7 @@ class TransitionAccessTest extends SchedulerContentModerationBrowserTestBase { // (using 'create_new_draft' transition). $this->drupalLogin($restrictedUser); $this->drupalGet("$entityTypeId/{$entity->id()}/edit"); $this->assertResponse(200, 'Restricted user should be able to edit the entity."'); $this->assertSession()->statusCodeEquals(200, 'Restricted user should be able to edit the entity."'); $this->submitForm([], 'Save'); $this->assertSession()->pageTextContains(sprintf('%s has been updated.', $entity->label())); Loading @@ -131,7 +131,7 @@ class TransitionAccessTest extends SchedulerContentModerationBrowserTestBase { 'unpublish_state[0]' => 'archived', ]; $this->drupalGet("$entityTypeId/{$entity->id()}/edit"); $this->assertResponse(200, 'Scheduler user should be able to edit the entity."'); $this->assertSession()->statusCodeEquals(200, 'Scheduler user should be able to edit the entity."'); $this->submitForm($edit, 'Save'); $this->assertSession() Loading @@ -141,7 +141,7 @@ class TransitionAccessTest extends SchedulerContentModerationBrowserTestBase { // editing access should be denied. $this->drupalLogin($restrictedUser); $this->drupalGet("$entityTypeId/{$entity->id()}/edit"); $this->assertResponse(403, 'Restricted user should not be able to edit the entity."'); $this->assertSession()->statusCodeEquals(403, 'Restricted user should not be able to edit the entity."'); // Remove scheduling info. $this->drupalLogin($schedulerUser); Loading @@ -155,7 +155,7 @@ class TransitionAccessTest extends SchedulerContentModerationBrowserTestBase { // Check entity is editable by restricted user when there is no scheduling. $this->drupalLogin($restrictedUser); $this->drupalGet("$entityTypeId/{$entity->id()}/edit"); $this->assertResponse(200, 'Restricted user should be able to edit the entity."'); $this->assertSession()->statusCodeEquals(200, 'Restricted user should be able to edit the entity."'); $this->submitForm([], 'Save'); $this->assertSession()->pageTextContains(sprintf('%s has been updated.', $entity->label())); } Loading Loading
scheduler_content_moderation_integration.info.yml +1 −1 Original line number Diff line number Diff line name: Scheduler Content Moderation Integration type: module description: 'Scheduler sub-module providing content moderation functionality for publishing/unpublishing.' core_version_requirement: ^8.7.7 || ^9 core_version_requirement: ^8.7.7 || ^9 || ^10 dependencies: - drupal:options - drupal:content_moderation Loading
scheduler_content_moderation_integration.module +1 −1 Original line number Diff line number Diff line Loading @@ -13,9 +13,9 @@ use Drupal\Core\Access\AccessResult; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityTypeInterface; use Drupal\Core\Entity\FieldableEntityInterface; use Drupal\Core\Field\BaseFieldDefinition; use Drupal\Core\Entity\EntityTypeInterface; use Drupal\Core\Field\FieldStorageDefinitionInterface; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Render\Element; Loading
tests/src/Functional/FormsTest.php +2 −1 Original line number Diff line number Diff line Loading @@ -150,7 +150,7 @@ class FormsTest extends SchedulerContentModerationBrowserTestBase { // Check that both state fields are shown by default. $this->drupalGet($url); $this->assertResponse(200); $this->assertSession()->statusCodeEquals(200, "The $operation form is displayed without error"); $assert->FieldExists('publish_state[0]'); $assert->FieldExists('unpublish_state[0]'); Loading @@ -166,6 +166,7 @@ class FormsTest extends SchedulerContentModerationBrowserTestBase { // Check that both state fields are now hidden. $this->drupalGet($url); $this->assertSession()->statusCodeEquals(200, "The $operation form is displayed without error"); $assert->FieldNotExists('publish_state[0]'); $assert->FieldNotExists('unpublish_state[0]'); } Loading
tests/src/Functional/SchedulerContentModerationBrowserTestBase.php +1 −1 Original line number Diff line number Diff line Loading @@ -42,7 +42,7 @@ abstract class SchedulerContentModerationBrowserTestBase extends BrowserTestBase /** * {@inheritdoc} */ protected function setUp() { protected function setUp(): void { parent::setUp(); $this->drupalCreateContentType([ Loading
tests/src/Functional/TransitionAccessTest.php +6 −6 Original line number Diff line number Diff line Loading @@ -92,7 +92,7 @@ class TransitionAccessTest extends SchedulerContentModerationBrowserTestBase { 'publish_state[0]' => 'published', ]; $this->drupalGet("$entityTypeId/{$entity->id()}/edit"); $this->assertResponse(200, 'Scheduler user should be able to edit the entity."'); $this->assertSession()->statusCodeEquals(200, 'Scheduler user should be able to edit the entity."'); $this->submitForm($edit, 'Save'); $this->assertSession() Loading @@ -102,7 +102,7 @@ class TransitionAccessTest extends SchedulerContentModerationBrowserTestBase { // editing access should be denied. $this->drupalLogin($restrictedUser); $this->drupalGet("$entityTypeId/{$entity->id()}/edit"); $this->assertResponse(403, 'Restricted user should not be able to edit the entity."'); $this->assertSession()->statusCodeEquals(403, 'Restricted user should not be able to edit the entity."'); // Remove scheduling info. $this->drupalLogin($schedulerUser); Loading @@ -118,7 +118,7 @@ class TransitionAccessTest extends SchedulerContentModerationBrowserTestBase { // (using 'create_new_draft' transition). $this->drupalLogin($restrictedUser); $this->drupalGet("$entityTypeId/{$entity->id()}/edit"); $this->assertResponse(200, 'Restricted user should be able to edit the entity."'); $this->assertSession()->statusCodeEquals(200, 'Restricted user should be able to edit the entity."'); $this->submitForm([], 'Save'); $this->assertSession()->pageTextContains(sprintf('%s has been updated.', $entity->label())); Loading @@ -131,7 +131,7 @@ class TransitionAccessTest extends SchedulerContentModerationBrowserTestBase { 'unpublish_state[0]' => 'archived', ]; $this->drupalGet("$entityTypeId/{$entity->id()}/edit"); $this->assertResponse(200, 'Scheduler user should be able to edit the entity."'); $this->assertSession()->statusCodeEquals(200, 'Scheduler user should be able to edit the entity."'); $this->submitForm($edit, 'Save'); $this->assertSession() Loading @@ -141,7 +141,7 @@ class TransitionAccessTest extends SchedulerContentModerationBrowserTestBase { // editing access should be denied. $this->drupalLogin($restrictedUser); $this->drupalGet("$entityTypeId/{$entity->id()}/edit"); $this->assertResponse(403, 'Restricted user should not be able to edit the entity."'); $this->assertSession()->statusCodeEquals(403, 'Restricted user should not be able to edit the entity."'); // Remove scheduling info. $this->drupalLogin($schedulerUser); Loading @@ -155,7 +155,7 @@ class TransitionAccessTest extends SchedulerContentModerationBrowserTestBase { // Check entity is editable by restricted user when there is no scheduling. $this->drupalLogin($restrictedUser); $this->drupalGet("$entityTypeId/{$entity->id()}/edit"); $this->assertResponse(200, 'Restricted user should be able to edit the entity."'); $this->assertSession()->statusCodeEquals(200, 'Restricted user should be able to edit the entity."'); $this->submitForm([], 'Save'); $this->assertSession()->pageTextContains(sprintf('%s has been updated.', $entity->label())); } Loading