Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
qfq
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
typo3
qfq
Commits
239abcc7
Commit
239abcc7
authored
4 years ago
by
Carsten Rose
Browse files
Options
Downloads
Patches
Plain Diff
Add some unit tests
parent
b9cd1516
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!317
Develop
Pipeline
#4981
passed
4 years ago
Stage: before
Stage: build
Stage: selenium
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Documentation/Variable.rst
+1
-1
1 addition, 1 deletion
Documentation/Variable.rst
extension/Classes/Core/Evaluate.php
+0
-1
0 additions, 1 deletion
extension/Classes/Core/Evaluate.php
extension/Tests/Unit/Core/EvaluateTest.php
+20
-3
20 additions, 3 deletions
extension/Tests/Unit/Core/EvaluateTest.php
with
21 additions
and
5 deletions
Documentation/Variable.rst
+
1
−
1
View file @
239abcc7
...
@@ -193,7 +193,7 @@ The following `escape` & `action` types are available:
...
@@ -193,7 +193,7 @@ The following `escape` & `action` types are available:
+-------+----------------------------------------------------------------------------------------------------------------------------------+
+-------+----------------------------------------------------------------------------------------------------------------------------------+
| S | Stop replace. If the replaced value contains nested variables, they won't be replaced. |
| S | Stop replace. If the replaced value contains nested variables, they won't be replaced. |
+-------+----------------------------------------------------------------------------------------------------------------------------------+
+-------+----------------------------------------------------------------------------------------------------------------------------------+
| t | Returns the central european timezone
(
CET / CEST
)
depending on the given date. If the TZ is not GMT+1 or
GMT+
2, returns GMT+x
|
| t | Returns the central european timezone
``
CET
``
/
``
CEST
``
depending on the given date. If the TZ is not GMT+1 or 2, returns GMT+x |
+-------+----------------------------------------------------------------------------------------------------------------------------------+
+-------+----------------------------------------------------------------------------------------------------------------------------------+
| w | wipe out current key/value pair from SIP store :ref:`variable-escape-wipe-key<variable-escape-wipe-key>` |
| w | wipe out current key/value pair from SIP store :ref:`variable-escape-wipe-key<variable-escape-wipe-key>` |
+-------+----------------------------------------------------------------------------------------------------------------------------------+
+-------+----------------------------------------------------------------------------------------------------------------------------------+
...
...
This diff is collapsed.
Click to expand it.
extension/Classes/Core/Evaluate.php
+
0
−
1
View file @
239abcc7
...
@@ -272,7 +272,6 @@ class Evaluate {
...
@@ -272,7 +272,6 @@ class Evaluate {
public
function
getEuropeanTimezone
(
$dateStr
=
''
)
{
public
function
getEuropeanTimezone
(
$dateStr
=
''
)
{
$ts
=
(
$dateStr
==
''
)
?
time
()
:
strtotime
(
$dateStr
);
$ts
=
(
$dateStr
==
''
)
?
time
()
:
strtotime
(
$dateStr
);
$offset
=
date
(
"Z"
,
$ts
);
$offset
=
date
(
"Z"
,
$ts
)
/
3600
;
$offset
=
date
(
"Z"
,
$ts
)
/
3600
;
switch
(
$offset
)
{
switch
(
$offset
)
{
case
1
:
case
1
:
...
...
This diff is collapsed.
Click to expand it.
extension/Tests/Unit/Core/EvaluateTest.php
+
20
−
3
View file @
239abcc7
...
@@ -607,14 +607,31 @@ class EvaluateTest extends AbstractDatabaseTest {
...
@@ -607,14 +607,31 @@ class EvaluateTest extends AbstractDatabaseTest {
* @throws \UserReportException
* @throws \UserReportException
*/
*/
public
function
testGetEuropeanTimezone
()
{
public
function
testGetEuropeanTimezone
()
{
$eval
=
new
Evaluate
(
$this
->
store
,
$this
->
dbArray
[
DB_INDEX_DEFAULT
]);
$eval
=
new
Evaluate
(
$this
->
store
,
$this
->
dbArray
[
DB_INDEX_DEFAULT
]);
// It seems in phpunit there is no default time zone set - set it manually.
date_default_timezone_set
(
'Europe/Berlin'
);
date_default_timezone_set
(
'Europe/Berlin'
);
$this
->
assertEquals
(
'CET'
,
$eval
->
getEuropeanTimezone
(
'02.02.2020'
));
# Check 2020 incl. hour
$this
->
assertEquals
(
'CEST'
,
$eval
->
getEuropeanTimezone
(
'02.06.2020'
));
$this
->
assertEquals
(
'CET'
,
$eval
->
getEuropeanTimezone
(
'29.03.2020 01:00'
));
$this
->
assertEquals
(
'CET'
,
$eval
->
getEuropeanTimezone
(
'02.12.2020'
));
$this
->
assertEquals
(
'CEST'
,
$eval
->
getEuropeanTimezone
(
'29.03.2020 03:00'
));
$this
->
assertEquals
(
'CEST'
,
$eval
->
getEuropeanTimezone
(
'25.10.2020 01:00'
));
$this
->
assertEquals
(
'CET'
,
$eval
->
getEuropeanTimezone
(
'25.10.2020 03:00'
));
# Check 2021 incl. hour
$this
->
assertEquals
(
'CET'
,
$eval
->
getEuropeanTimezone
(
'28.03.2021 01:00'
));
$this
->
assertEquals
(
'CEST'
,
$eval
->
getEuropeanTimezone
(
'28.03.2021 03:00'
));
$this
->
assertEquals
(
'CEST'
,
$eval
->
getEuropeanTimezone
(
'31.10.2021 01:00'
));
$this
->
assertEquals
(
'CET'
,
$eval
->
getEuropeanTimezone
(
'31.10.2021 03:00'
));
# Check 2021 only date
$this
->
assertEquals
(
'CET'
,
$eval
->
getEuropeanTimezone
(
'28.03.2021'
));
$this
->
assertEquals
(
'CEST'
,
$eval
->
getEuropeanTimezone
(
'29.03.2021'
));
$this
->
assertContains
(
$eval
->
getEuropeanTimezone
(
''
),
[
'CET'
,
'CEST'
]);
$this
->
assertContains
(
$eval
->
getEuropeanTimezone
(
''
),
[
'CET'
,
'CEST'
]);
# Check if action parameter 't' is recognized.
$this
->
store
->
setVar
(
'start'
,
'02.06.2020'
,
STORE_FORM
,
true
);
$this
->
store
->
setVar
(
'start'
,
'02.06.2020'
,
STORE_FORM
,
true
);
$this
->
assertEquals
(
'CEST'
,
$eval
->
substitute
(
'start:F:all:t'
,
$foundInStore
));
$this
->
assertEquals
(
'CEST'
,
$eval
->
substitute
(
'start:F:all:t'
,
$foundInStore
));
}
}
...
...
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