Commit c2ad4e14 authored by Jonathan Smith's avatar Jonathan Smith Committed by Jonathan Smith
Browse files

Issue #3314267 by jonathan1055, vishalkhode: Workbench Moderation tests cannot be run at D10

parent 1bb684da
Loading
Loading
Loading
Loading
+3 −5
Changes for composer.json: 3 added lines, 5 removed lines.
Original line number Diff line number Diff line
@@ -6,11 +6,9 @@
    "homepage": "https://drupal.org/project/scheduler",
    "require-dev": {
        "drupal/rules": "^3",
        "drush/drush": "^9.0 || ^10",
        "drupal/devel_generate": "^4.0",
        "drupal/commerce": "^2.0",
        "drupal/workbench_moderation": "^1.0",
        "drupal/workbench_moderation_actions": "^1.0"
        "drush/drush": ">=9",
        "drupal/devel_generate": ">=4",
        "drupal/commerce": "^2.0"
    },
    "repositories": {
        "drupal": {
+4 −1
Changes for drupalci.yml: 4 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -6,7 +6,6 @@ build:
      container_composer:
      container_command:
        commands:
          - "cd ${SOURCE_DIR} && sudo -u www-data composer require drupal/devel:4.x-dev"
      host_command:
        commands:
          # Apply patch from https://www.drupal.org/project/drupalci_testbot/issues/3251817
@@ -22,6 +21,10 @@ build:
        commands:
          # Rule 3.0-alpha7 is not compatible with PHP8.1 but the dev version has been fixed.
          - "cd ${SOURCE_DIR} && sudo -u www-data composer require drupal/rules:3.x-dev"
          # Get workbench moderation modules when testing with Drupal 9.
          # WBMA 1.0 cannot be installed with D9, so use * to allow the dev version.
          - 'drush status | awk "NR==1{print \$2\$3\$4}"'
          - 'drush status | awk "NR==1{print \$2\$3\$4}" | grep version:9 && sudo -u www-data composer require drupal/workbench_moderation:* drupal/workbench_moderation_actions:*'
      run_tests.functional:
        types: 'PHPUnit-Functional'
        testgroups: '--all'
+17 −4
Changes for tests/src/Functional/SchedulerWorkbenchModerationTest.php: 17 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -10,11 +10,24 @@ namespace Drupal\Tests\scheduler\Functional;
class SchedulerWorkbenchModerationTest extends SchedulerBrowserTestBase {

  /**
   * Additional modules required.
   *
   * @var array
   * {@inheritdoc}
   */
  protected static $modules = ['workbench_moderation'];
  public function setUp(): void {
    parent::setUp();
    // This test class is "optional" and will be run if the workbench_moderation
    // modules are available. This allows testing with Drupal 9 but also will
    // not fail with Drupal 10, where the workbench moderation modules are not
    // compatible. See https://www.drupal.org/project/scheduler/issues/3314267
    $modulesList = \Drupal::service('extension.list.module')->getList();
    if (!isset($modulesList['workbench_moderation']) || !isset($modulesList['workbench_moderation_actions'])) {
      $this->markTestSkipped('Skipping test because the workbench moderation module(s) are not available.');
    }
    else {
      // The workbench_moderation module is available so install it.
      // workbench_moderation_actions is installed later.
      \Drupal::service('module_installer')->install(['workbench_moderation']);
    }
  }

  /**
   * Helper function to test publishing and unpublishing via cron.