Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
U
uw_base_profile
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
WCMS
uw_base_profile
Commits
795fcb10
Commit
795fcb10
authored
3 years ago
by
Lily Yan
Browse files
Options
Downloads
Patches
Plain Diff
ISTWCMS-4964 Updated date-related tests to use computed dates that are always in the future
parent
f347de9c
No related branches found
No related tags found
2 merge requests
!433
ISTWCMS-6296 Create test for all event dates test cases
,
!176
ISTWCMS-4964 Updated date-related tests to use computed dates that are always in the future
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/src/Functional/UwWcmsBasicTest.php
+19
-14
19 additions, 14 deletions
tests/src/Functional/UwWcmsBasicTest.php
with
19 additions
and
14 deletions
tests/src/Functional/UwWcmsBasicTest.php
+
19
−
14
View file @
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.
//
T
he stick one is the first, then sort by date field asc.
//
For event: t
he 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
=
[
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment