Commit 6fde7e98 authored by Kevin Paxman's avatar Kevin Paxman
Browse files

Merge branch...

Merge branch 'feature/ISTWCMS-4964-l26yan-Update-date-related-tests-to-use-computed-dates' into '3.0.x'

ISTWCMS-4964 Updated date-related tests to use computed dates that are always in the future

See merge request !176
parents f347de9c 795fcb10
......@@ -366,10 +366,14 @@ class UwWcmsBasicTest extends BrowserTestBase {
$this->drupalLogin($this->drupalUsers['administrator']);
// Create three events node including the below dates.
// The first two nodes are non-sticky, the third is sticky.
$early_date = date('Y-m-d', strtotime("+1 days"));
$middle_date = date('Y-m-d', strtotime("+1 months"));
$late_date = date('Y-m-d', strtotime("+2 months"));
$dates = [
'2021-07-01',
'2021-06-01',
'2021-08-01',
$early_date,
$middle_date,
$late_date,
];
foreach ($dates as $date) {
$edits['event'][] = [
......@@ -381,7 +385,7 @@ class UwWcmsBasicTest extends BrowserTestBase {
'edit-field-uw-event-date-0-end-value-time' => '14:00:00',
'edit-field-uw-meta-description-0-value' => 'string',
'edit-moderation-state-0-state' => 'published',
'edit-sticky-value' => ($date === '2021-08-01') ? 1 : 0,
'edit-sticky-value' => ($date === $late_date) ? 1 : 0,
];
$edits['blog'][] = [
'edit-title-0-value' => $date,
......@@ -389,7 +393,7 @@ class UwWcmsBasicTest extends BrowserTestBase {
'edit-field-uw-blog-summary-0-value' => 'string',
'edit-field-uw-meta-description-0-value' => 'string',
'edit-moderation-state-0-state' => 'published',
'edit-sticky-value' => ($date === '2021-08-01') ? 1 : 0,
'edit-sticky-value' => ($date === $late_date) ? 1 : 0,
];
$edits['news_item'][] = [
'edit-title-0-value' => $date,
......@@ -397,7 +401,7 @@ class UwWcmsBasicTest extends BrowserTestBase {
'edit-field-uw-news-summary-0-value' => 'string',
'edit-field-uw-meta-description-0-value' => 'string',
'edit-moderation-state-0-state' => 'published',
'edit-sticky-value' => ($date === '2021-08-01') ? 1 : 0,
'edit-sticky-value' => ($date === $late_date) ? 1 : 0,
];
}
foreach ($edits as $content_type => $items) {
......@@ -407,17 +411,18 @@ class UwWcmsBasicTest extends BrowserTestBase {
}
// Get expected sort dates for late use.
// The stick one is the first, then sort by date field asc.
// For event: the stick one is the first, then sort by date field asc.
$expected_dates = [
'2021-08-01',
'2021-06-01',
'2021-07-01',
$late_date,
$early_date,
$middle_date,
];
// For blog and news: the stick one is the first,
// then sort by date field desc.
$expected_date_fields = [
'2021-08-01',
'2021-07-01',
'2021-06-01',
$late_date,
$middle_date,
$early_date,
];
$page_views = [
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment