Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
CiviCRM Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Analyze
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
Development
CiviCRM Core
Commits
b2ce47c7
Commit
b2ce47c7
authored
3 years ago
by
Seamus Lee
Browse files
Options
Downloads
Patches
Plain Diff
[php8-compat] Fix issue where by we are tryiing to access array keys that haven't been created yet
Add in code comment
parent
72c28dd4
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/phpunit/CRM/Core/BAO/ActionScheduleTest.php
+11
-2
11 additions, 2 deletions
tests/phpunit/CRM/Core/BAO/ActionScheduleTest.php
with
11 additions
and
2 deletions
tests/phpunit/CRM/Core/BAO/ActionScheduleTest.php
+
11
−
2
View file @
b2ce47c7
...
...
@@ -881,15 +881,16 @@ class CRM_Core_BAO_ActionScheduleTest extends CiviUnitTestCase {
'{activity.activity_type}'
,
]);
// Further tokens can be tested in the body text/html.
// We use a dummy string to represent the custom token as this is done in setUp which is run after this function is called.
$manyTokensTmpl
=
implode
(
';;'
,
[
$someTokensTmpl
,
'{contact.email_greeting}'
,
$this
->
fixtures
[
'contact
_c
ustom
_t
oken'
][
'token'
]
,
'
{
contact
C
ustom
T
oken
}
'
,
]);
// Note: The behavior of domain-tokens on a scheduled reminder is undefined. All we
// can really do is check that it has something.
$someTokensExpected
=
'Churmondleia Ōtākou;;Female;;Female;;[a-zA-Z0-9 ]+;;Phone Call'
;
$manyTokensExpected
=
sprintf
(
'%s;;Dear Churmondleia;;%s'
,
$someTokensExpected
,
$this
->
fixtures
[
'contact
_c
ustom
_t
oken
'
][
'v
alue'
]
);
$manyTokensExpected
=
sprintf
(
'%s;;Dear Churmondleia;;%s'
,
$someTokensExpected
,
'
{
contact
C
ustom
T
oken
V
alue
}
'
);
// In this example, we use a lot of tokens cutting across multiple components.
$cases
[
0
]
=
[
...
...
@@ -974,6 +975,14 @@ class CRM_Core_BAO_ActionScheduleTest extends CiviUnitTestCase {
* @dataProvider mailerExamples
*/
public
function
testMailer
(
array
$schedule
,
array
$patterns
):
void
{
// Replace the dummy custom contact token referecnes in schedule and patterns that we had to insert because phpunit
// evaluates dataProviders before running setUp
foreach
(
$schedule
as
$type
=>
$content
)
{
$schedule
[
$type
]
=
str_replace
(
'{contactCustomToken}'
,
$this
->
fixtures
[
'contact_custom_token'
][
'token'
],
$content
);
}
foreach
(
$patterns
as
$type
=>
$content
)
{
$patterns
[
$type
]
=
str_replace
(
'{contactCustomTokenValue}'
,
$this
->
fixtures
[
'contact_custom_token'
][
'value'
],
$content
);
}
$this
->
createScheduleFromFixtures
(
'sched_activity_1day'
,
$schedule
);
$activity
=
$this
->
createTestObject
(
'CRM_Activity_DAO_Activity'
,
$this
->
fixtures
[
'phone_call'
]);
$contact
=
$this
->
callAPISuccess
(
'contact'
,
'create'
,
array_merge
(
...
...
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