Commit 10a2c980 authored by l26yan's avatar l26yan
Browse files

ISTWCMS-4863 Blog post, event and news item list blocks and views should sort...

ISTWCMS-4863 Blog post, event and news item list blocks and views should sort sticky items to the top
parent f30b37a8
......@@ -363,6 +363,7 @@ class UwWcmsBasicTest extends BrowserTestBase {
private function createContent() {
$this->drupalLogin($this->drupalUsers['administrator']);
// Create three events node including the below dates.
// The first two nodes are non-sticky, the third is sticky.
$dates = [
'2021-07-01',
'2021-06-01',
......@@ -378,6 +379,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,
];
$edits['blog'][] = [
'edit-title-0-value' => $date,
......@@ -385,6 +387,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,
];
$edits['news_item'][] = [
'edit-title-0-value' => $date,
......@@ -392,6 +395,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,
];
}
foreach ($edits as $content_type => $items) {
......@@ -401,7 +405,12 @@ class UwWcmsBasicTest extends BrowserTestBase {
}
// Get expected sort dates for late use.
sort($dates);
// The stick one is the first, then sort by date field asc.
$expected_dates = [
'2021-08-01',
'2021-06-01',
'2021-07-01',
];
$page_views = [
'events',
......@@ -422,7 +431,7 @@ class UwWcmsBasicTest extends BrowserTestBase {
// Get the actual date from the text above.
foreach ($rows as $key => $row) {
preg_match("/\d{4}\-\d{2}-\d{2}/", $row->getText(), $matches);
$this->assertEqual($matches[0], $dates[$key]);
$this->assertEqual($matches[0], $expected_dates[$key]);
}
}
......
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