Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
drupal
Commits
fc3d2895
Commit
fc3d2895
authored
Mar 22, 2017
by
Alex Pott
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#2860663
by mpdonadio, xjm, Mile23: UserTimeZoneTest fails on PHP 7.0.x-dev and 7.1.x-dev
parent
e65e3267
Branches
Branches containing commit
Tags
Tags containing commit
2 merge requests
!7452
Issue #1797438. HTML5 validation is preventing form submit and not fully...
,
!789
Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
core/modules/user/src/Tests/UserTimeZoneTest.php
+18
-11
18 additions, 11 deletions
core/modules/user/src/Tests/UserTimeZoneTest.php
with
18 additions
and
11 deletions
core/modules/user/src/Tests/UserTimeZoneTest.php
+
18
−
11
View file @
fc3d2895
...
...
@@ -28,8 +28,15 @@ public function testUserTimeZone() {
->
set
(
'timezone.user.configurable'
,
1
)
->
set
(
'timezone.default'
,
'America/Los_Angeles'
)
->
save
();
// Load the 'medium' date format, which is the default for node creation
// time, and override it. Since we are testing time zones with Daylight
// Saving Time, and need to future proof against changes to the zoneinfo
// database, we choose the 'I' format placeholder instead of a
// human-readable zone name. With 'I', a 1 means the date is in DST, and 0
// if not.
DateFormat
::
load
(
'medium'
)
->
setPattern
(
'Y-m-d H:i
T
'
)
->
setPattern
(
'Y-m-d H:i
I
'
)
->
save
();
// Create a user account and login.
...
...
@@ -49,11 +56,11 @@ public function testUserTimeZone() {
// Confirm date format and time zone.
$this
->
drupalGet
(
'node/'
.
$node1
->
id
());
$this
->
assertText
(
'2007-03-09 21:00
PST
'
,
'Date should be PST.'
);
$this
->
assertText
(
'2007-03-09 21:00
0
'
,
'Date should be PST.'
);
$this
->
drupalGet
(
'node/'
.
$node2
->
id
());
$this
->
assertText
(
'2007-03-11 01:00
PST
'
,
'Date should be PST.'
);
$this
->
assertText
(
'2007-03-11 01:00
0
'
,
'Date should be PST.'
);
$this
->
drupalGet
(
'node/'
.
$node3
->
id
());
$this
->
assertText
(
'2007-03-20 21:00
PDT
'
,
'Date should be PDT.'
);
$this
->
assertText
(
'2007-03-20 21:00
1
'
,
'Date should be PDT.'
);
// Change user time zone to Santiago time.
$edit
=
[];
...
...
@@ -64,25 +71,25 @@ public function testUserTimeZone() {
// Confirm date format and time zone.
$this
->
drupalGet
(
'node/'
.
$node1
->
id
());
$this
->
assertText
(
'2007-03-10 02:00
CLST
'
,
'Date should be Chile summer time; five hours ahead of PST.'
);
$this
->
assertText
(
'2007-03-10 02:00
1
'
,
'Date should be Chile summer time; five hours ahead of PST.'
);
$this
->
drupalGet
(
'node/'
.
$node2
->
id
());
$this
->
assertText
(
'2007-03-11 05:00
CLT
'
,
'Date should be Chile time; four hours ahead of PST'
);
$this
->
assertText
(
'2007-03-11 05:00
0
'
,
'Date should be Chile time; four hours ahead of PST'
);
$this
->
drupalGet
(
'node/'
.
$node3
->
id
());
$this
->
assertText
(
'2007-03-21 00:00
CLT
'
,
'Date should be Chile time; three hours ahead of PDT.'
);
$this
->
assertText
(
'2007-03-21 00:00
0
'
,
'Date should be Chile time; three hours ahead of PDT.'
);
// Ensure that anonymous users also use the default timezone.
$this
->
drupalLogout
();
$this
->
drupalGet
(
'node/'
.
$node1
->
id
());
$this
->
assertText
(
'2007-03-09 21:00
PST
'
,
'Date should be PST.'
);
$this
->
assertText
(
'2007-03-09 21:00
0
'
,
'Date should be PST.'
);
$this
->
drupalGet
(
'node/'
.
$node2
->
id
());
$this
->
assertText
(
'2007-03-11 01:00
PST
'
,
'Date should be PST.'
);
$this
->
assertText
(
'2007-03-11 01:00
0
'
,
'Date should be PST.'
);
$this
->
drupalGet
(
'node/'
.
$node3
->
id
());
$this
->
assertText
(
'2007-03-20 21:00
PDT
'
,
'Date should be PDT.'
);
$this
->
assertText
(
'2007-03-20 21:00
1
'
,
'Date should be PDT.'
);
// Format a date without accessing the current user at all and
// ensure that it uses the default timezone.
$this
->
drupalGet
(
'/system-test/date'
);
$this
->
assertText
(
'2016-01-13 08:29
PST
'
,
'Date should be PST.'
);
$this
->
assertText
(
'2016-01-13 08:29
0
'
,
'Date should be PST.'
);
}
}
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