Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
automatic_updates-3399147
Manage
Activity
Members
Labels
Plan
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
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
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Issue forks
automatic_updates-3399147
Commits
ab3d42bd
Commit
ab3d42bd
authored
2 years ago
by
Adam G-H
Browse files
Options
Downloads
Patches
Plain Diff
A touch of clean-up
parent
542a06df
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
tests/modules/automatic_updates_test/automatic_updates_test.module
+10
-4
10 additions, 4 deletions
...ules/automatic_updates_test/automatic_updates_test.module
tests/src/Kernel/CronUpdaterTest.php
+1
-1
1 addition, 1 deletion
tests/src/Kernel/CronUpdaterTest.php
with
11 additions
and
5 deletions
tests/modules/automatic_updates_test/automatic_updates_test.module
+
10
−
4
View file @
ab3d42bd
...
...
@@ -12,12 +12,18 @@ use Drupal\Core\StringTranslation\TranslatableMarkup;
*/
function
automatic_updates_test_mail_alter
(
array
&
$message
):
void
{
if
(
str_starts_with
(
$message
[
'id'
],
'automatic_updates_'
))
{
$langcodes
=
[];
foreach
(
$message
[
'body'
]
as
$line
)
{
$line_langcodes
=
[];
// Get the langcode of every translated line in the mssage, including the
// subject line.
$lines
=
array_merge
(
$message
[
'body'
],
[
$message
[
'subject'
],
]);
foreach
(
$lines
as
$line
)
{
if
(
$line
instanceof
TranslatableMarkup
)
{
$langcodes
[]
=
$line
->
getOption
(
'langcode'
);
$
line_
langcodes
[]
=
$line
->
getOption
(
'langcode'
);
}
}
$message
[
'
detected
_langcodes'
]
=
array_unique
(
$langcodes
);
$message
[
'
line
_langcodes'
]
=
array_unique
(
$
line_
langcodes
);
}
}
This diff is collapsed.
Click to expand it.
tests/src/Kernel/CronUpdaterTest.php
+
1
−
1
View file @
ab3d42bd
...
...
@@ -391,7 +391,7 @@ class CronUpdaterTest extends AutomaticUpdatesKernelTestBase {
$langcode
=
$message
[
'langcode'
];
$this
->
assertSame
(
$langcode
,
$languages
[
$i
]);
// @see automatic_updates_test_mail_alter()
$this
->
assertSame
([
$langcode
],
$message
[
'
detected
_langcodes'
]);
$this
->
assertSame
([
$langcode
],
$message
[
'
line
_langcodes'
]);
}
}
...
...
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