reverted: --- b/tests/src/Functional/SchedulerPastDatesTest.php +++ a/tests/src/Functional/SchedulerPastDatesTest.php @@ -59,15 +59,15 @@ $this->nodetype->setThirdPartySetting('scheduler', 'publish_past_date', 'schedule')->save(); $this->drupalPostForm('node/' . $node->id() . '/edit', $edit, t('Save and keep published')); $publish_time = $edit['publish_on[0][value][date]'] . ' ' . $edit['publish_on[0][value][time]']; + $this->assertNoText(t("The 'publish on' date must be in the future"), 'No error message is shown when the publication date is in the past and the "schedule" behavior is chosen.'); + $this->assertText(sprintf('%s %s has been updated.', $this->typeName, SafeMarkup::checkPlain($edit['title[0][value]'])), 'The node is saved successfully when the publication date is in the past and the "schedule" behavior is chosen.'); + $this->assertText(t('This post is unpublished and will be published @publish_time.', ['@publish_time' => $publish_time]), 'The node is scheduled to be published when the publication date is in the past and the "schedule" behavior is chosen.'); - $this->assertTextHelper(t("The 'publish on' date must be in the future"), 'No error message is shown when the publication date is in the past and the "schedule" behavior is chosen.'); - $this->assertTextHelper((sprintf('%s %s has been updated.', $this->typeName, SafeMarkup::checkPlain($edit['title[0][value]']))), 'The node is saved successfully when the publication date is in the past and the "schedule" behavior is chosen.'); - $this->assertTextHelper((t('This post is unpublished and will be published @publish_time.', ['@publish_time' => $publish_time])), 'The node is scheduled to be published when the publication date is in the past and the "schedule" behavior is chosen.'); // Reload the node and check that it is unpublished but scheduled correctly. $this->nodeStorage->resetCache([$node->id()]); $node = $this->nodeStorage->load($node->id()); $this->assertFalse($node->isPublished(), 'The node has been unpublished when the publication date is in the past and the "schedule" behavior is chosen.'); + $this->assertEqual(\Drupal::service('date.formatter')->format($node->publish_on->value, 'custom', 'Y-m-d H:i:s'), $publish_time, 'The node is scheduled for the required date'); - $this->assertEquals(\Drupal::service('date.formatter')->format($node->publish_on->value, 'custom', 'Y-m-d H:i:s'), $publish_time, 'The node is scheduled for the required date'); // Simulate a cron run and check that the node is published. scheduler_cron(); @@ -82,7 +82,7 @@ 'unpublish_on[0][value][time]' => \Drupal::service('date.formatter')->format(REQUEST_TIME - 3600, 'custom', 'H:i:s'), ]; $this->drupalPostForm('node/add/page', $edit, t('Save and publish')); + $this->assertRaw(t("The 'unpublish on' date must be in the future"), 'An error message is shown when the unpublish date is in the past.'); - $this->assert(t("The 'unpublish on' date must be in the future"), 'An error message is shown when the unpublish date is in the past.'); } } reverted: --- b/tests/src/Functional/SchedulerRevisioningTest.php +++ a/tests/src/Functional/SchedulerRevisioningTest.php @@ -58,7 +58,7 @@ ->execute() ->fetchColumn(); + return $this->assertEqual($log_message, $value, $message, $group); - return $this->assertEquals($log_message, $value, $message, $group); } /** @@ -83,7 +83,7 @@ ->execute() ->fetchColumn(); + return $this->assertEqual($count, $value, $message, $group); - return $this->assertEquals($count, $value, $message, $group); } /** @@ -155,7 +155,7 @@ // Get the created date from the node and check that it has not changed. $created_after_cron = $node->created->value; $this->assertTrue($node->isPublished(), 'The node has been published.'); + $this->assertEqual($created, $created_after_cron, 'The node creation date is not changed by default.'); - $this->assertEquals($created, $created_after_cron, 'The node creation date is not changed by default.'); // Set option to change the created date to match the publish_on date. $this->nodetype->setThirdPartySetting('scheduler', 'publish_touch', TRUE)->save(); @@ -164,7 +164,7 @@ $node = $this->schedule($node, 'publish'); // Check that the created date has changed to match the publish_on date. $created_after_cron = $node->created->value; + $this->assertEqual(strtotime('-1 day', REQUEST_TIME), $created_after_cron, "With 'touch' option set, the node creation date is changed to match the publishing date."); - $this->assertEquals(strtotime('-1 day', REQUEST_TIME), $created_after_cron, "With 'touch' option set, the node creation date is changed to match the publishing date."); } }