Commit 353410ff authored by Jonathan Smith's avatar Jonathan Smith
Browse files

Issue #3260070 by jonathan1055: Further test streamlining for when a plugin is added

parent b8cf9be7
Loading
Loading
Loading
Loading
+15 −21
Changes for .travis.yml: 15 added lines, 21 removed lines.
Original line number Diff line number Diff line
@@ -22,16 +22,15 @@ jobs:
        - DRUPAL_CORE=8.9.x
        # 8.9 is slow, 50 mins is the Travis limit, so skip all additional
        # entity types. Also skip Rules because it cannot be installed at 8.x.
        - MEDIA=NO
        - PRODUCTS=NO
        - RULES=NO
        - NODE=YES
        # ---- Remaining self deprecation notices (0)
        # ---- Remaining direct deprecation notices (0)
    - php: 7.3
      env:
        - DRUPAL_CORE=9.1.x
        - NODE=NO
        - MEDIA=NO
        # Just run Media and Rules tests.
        - DRUPAL_CORE=9.2.x
        - MEDIA=YES
        - RULES=YES
        # ---- Remaining self deprecation notices (1794)
        # 1774 EventDispatcher with string event (Rules and Commerce)
        #   11 Creating an instance of class ... getConnection()->condition()
@@ -41,10 +40,10 @@ jobs:
        - DEPRECATIONS=3000
    - php: 7.4
      env:
        - DRUPAL_CORE=9.2.x
        # Exclude Rules, Products and Taxonomy tests. Just run Node and Media.
        - PRODUCTS=NO
        - RULES=NO
        - DRUPAL_CORE=9.3.x
        # Just run Node and Product.
        - NODE=YES
        - PRODUCT=YES
        # ---- Remaining self deprecation notices (2455)
        # 1174 Symfony isMasterRequest() is deprecated, use isMainRequest()
        #  927 EventDispatcher with string event (Rules and Commerce)
@@ -60,13 +59,8 @@ cache:

before_script:
  # At job start-up Composer is installed at 1.8.4 then self-update is run. From
  # 24 October 2020 this bumped the version to Composer 2. Drupal Core 8.8 has
  # plugins that only run with composer-plugin-api ^1.0 so revert to Composer 1.
  - if [ "$DRUPAL_CORE" == "8.8.x" ]; then
      travis_retry composer self-update --1;
    fi
  # 24 October 2020 this bumped the version to Composer 2.
  - composer --version

  - echo $MODULE

  # Remove Xdebug as we don't need it and it causes
@@ -97,7 +91,7 @@ before_script:
  # Get the latest dev versions of the test dependency modules.
  - travis_retry git clone --branch 4.x     --depth 1 https://git.drupalcode.org/project/devel.git modules/devel
  - |
    if [ "$RULES" != "NO" ]; then
    if [ "$RULES" == "YES" ]; then
      echo "Installing Rules and Typed Data ..."
      travis_retry git clone --branch 8.x-3.x --depth 1 https://git.drupalcode.org/project/rules.git modules/rules
      travis_retry git clone --branch 8.x-1.x --depth 1 https://git.drupalcode.org/project/typed_data.git modules/typed_data
@@ -130,10 +124,10 @@ before_script:
script:
  - echo "NODE=$NODE MEDIA=$MEDIA PRODUCTS=$PRODUCTS RULES=$RULES"
  - EXCLUDE=()
  - if [ "$NODE" == "NO" ]; then EXCLUDE+=('#node|BasicNode'); fi
  - if [ "$MEDIA" == "NO" ]; then EXCLUDE+=('#media|BasicMedia'); fi
  - if [ "$PRODUCTS" == "NO" ]; then EXCLUDE+=('#commerce_product|BasicProduct'); fi
  - if [ "$RULES" == "NO" ]; then EXCLUDE+=('rules'); fi
  - if [ "$NODE" != "YES" ]; then EXCLUDE+=('#node|BasicNode'); fi
  - if [ "$MEDIA" != "YES" ]; then EXCLUDE+=('#media|BasicMedia'); fi
  - if [ "$PRODUCTS" != "YES" ]; then EXCLUDE+=('#commerce_product|BasicProduct'); fi
  - if [ "$RULES" != "YES" ]; then EXCLUDE+=('rules'); fi
  - EXCLUDE=${EXCLUDE[@]}     # create a space delimited string from array

  # Run the PHPUnit tests.
+1 −1
Changes for scheduler.info.yml: 1 added line, 1 removed line.
Original line number Diff line number Diff line
name: Scheduler
type: module
description: 'Publish and unpublish content automatically on specified dates and times.'
description: 'Publish and unpublish content and entities automatically on specified dates and times.'
core: 8.x
core_version_requirement: ^8 || ^9
configure: scheduler.admin_form
+2 −2
Changes for tests/src/Functional/SchedulerBrowserTestBase.php: 2 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -12,9 +12,9 @@ use Drupal\Tests\scheduler\Traits\SchedulerSetupTrait;
 */
abstract class SchedulerBrowserTestBase extends BrowserTestBase {

  use SchedulerSetupTrait;
  use SchedulerMediaSetupTrait;
  use SchedulerCommerceProductSetupTrait;
  use SchedulerMediaSetupTrait;
  use SchedulerSetupTrait;

  /**
   * The standard modules to load for all browser tests.
+3 −3
Changes for tests/src/Functional/SchedulerNonEnabledTypeTest.php: 3 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -57,7 +57,7 @@ class SchedulerNonEnabledTypeTest extends SchedulerBrowserTestBase {
    // Fill in the title field and check that the entity can be saved OK.
    $title = $id . 'a - ' . $description;
    $this->submitForm(["{$titleField}[0][value]" => $title], 'Save');
    $this->assertSession()->pageTextMatches('/' . preg_quote($title, '/') . ' has been (created|successfully saved)/');
    $this->assertSession()->pageTextMatches($this->entitySavedMessage($entityTypeId, $title));

    // Create an unpublished entity with a publishing date, which mimics what
    // could be done by a third-party module, or a by-product of the entity type
@@ -73,7 +73,7 @@ class SchedulerNonEnabledTypeTest extends SchedulerBrowserTestBase {
    // Check that the entity can be edited and saved OK.
    $this->drupalGet($entity->toUrl('edit-form'));
    $this->submitForm([], 'Save');
    $this->assertSession()->pageTextMatches('/' . preg_quote($title, '/') . ' has been (updated|successfully saved)/');
    $this->assertSession()->pageTextMatches($this->entitySavedMessage($entityTypeId, $title));

    // Run cron and display the dblog.
    $this->cronRun();
@@ -103,7 +103,7 @@ class SchedulerNonEnabledTypeTest extends SchedulerBrowserTestBase {
    // Check that the entity can be edited and saved.
    $this->drupalGet($entity->toUrl('edit-form'));
    $this->submitForm([], 'Save');
    $this->assertSession()->pageTextMatches('/' . preg_quote($title, '/') . ' has been (updated|successfully saved)/');
    $this->assertSession()->pageTextMatches($this->entitySavedMessage($entityTypeId, $title));

    // Create a published entity with a date in the past, then run cron.
    $title = $id . 'd - ' . $description;
+2 −3
Changes for tests/src/Functional/SchedulerPastDatesTest.php: 2 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -54,7 +54,7 @@ class SchedulerPastDatesTest extends SchedulerBrowserTestBase {
    // Check that no error message is shown when the publication date is in the
    // past and the "publish" behavior is chosen.
    $this->assertSession()->pageTextNotContains("The 'publish on' date must be in the future");
    $this->assertSession()->pageTextMatches('/' . preg_quote($title, '/') . ' has been (updated|successfully saved)/');
    $this->assertSession()->pageTextMatches($this->entitySavedMessage($entityTypeId, $title));

    // Reload the entity.
    $storage->resetCache([$entity->id()]);
@@ -78,7 +78,7 @@ class SchedulerPastDatesTest extends SchedulerBrowserTestBase {
    $this->submitForm($edit, 'Save');
    $this->assertSession()->pageTextNotContains("The 'publish on' date must be in the future");
    $this->assertSession()->pageTextContains(sprintf('%s is scheduled to be published', $title));
    $this->assertSession()->pageTextMatches('/' . preg_quote($title, '/') . ' has been (updated|successfully saved)/');
    $this->assertSession()->pageTextMatches($this->entitySavedMessage($entityTypeId, $title));

    // Reload the entity.
    $storage->resetCache([$entity->id()]);
@@ -95,7 +95,6 @@ class SchedulerPastDatesTest extends SchedulerBrowserTestBase {
    $this->assertTrue($entity->isPublished(), 'The entity with publication date in the past and the "schedule" behavior has now been published by cron.');
    $this->assertEquals($entity->getChangedTime(), strtotime('-1 day', $this->requestTime), 'The changed time of the entity has been updated to the publish_on time when published via cron.');
    $this->assertEquals($entity->getCreatedTime(), $created_time, 'The created time of the entity has not been changed when the "schedule" behavior is chosen.');

    // Test the option to alter the creation time if the publishing time is
    // earlier than the entity created time.
    $entityType->setThirdPartySetting('scheduler', 'publish_past_date_created', TRUE)->save();
Loading