Commit 117b7ea2 authored by Vipin Mittal's avatar Vipin Mittal Committed by Stephen Mustgrave
Browse files

Issue #3289476: Automated Drupal 10 compatibility fixes

parent e0469bab
Loading
Loading
Loading
Loading
+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
+1 −1
Original line number Diff line number Diff line
@@ -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;
+2 −1
Original line number Diff line number Diff line
@@ -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]');

@@ -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]');
  }
+1 −1
Original line number Diff line number Diff line
@@ -42,7 +42,7 @@ abstract class SchedulerContentModerationBrowserTestBase extends BrowserTestBase
  /**
   * {@inheritdoc}
   */
  protected function setUp() {
  protected function setUp(): void {
    parent::setUp();

    $this->drupalCreateContentType([
+6 −6
Original line number Diff line number Diff line
@@ -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()
@@ -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);
@@ -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()));

@@ -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()
@@ -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);
@@ -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