Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
entity_usage_updater
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
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
entity_usage_updater
Commits
fe5e8dfb
Commit
fe5e8dfb
authored
2 weeks ago
by
Alex Pott
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3520669
by alexpott: Change warning added in [
#3517991
] to an error
parent
f8cc01b1
No related branches found
No related tags found
1 merge request
!31
Move to an error
Pipeline
#480112
passed
2 weeks ago
Stage: build
Stage: validate
Stage: test
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/EntityUsageUpdater.php
+1
-1
1 addition, 1 deletion
src/EntityUsageUpdater.php
tests/src/Kernel/EntityUsageUpdaterViolationTest.php
+4
-1
4 additions, 1 deletion
tests/src/Kernel/EntityUsageUpdaterViolationTest.php
with
5 additions
and
2 deletions
src/EntityUsageUpdater.php
+
1
−
1
View file @
fe5e8dfb
...
...
@@ -851,7 +851,7 @@ class EntityUsageUpdater implements EntityUsageUpdaterInterface {
foreach
(
$check_usages
as
$old_entity_type_id
=>
$entity_updates
)
{
foreach
(
\Drupal
::
entityTypeManager
()
->
getStorage
(
$old_entity_type_id
)
->
loadMultiple
(
$entity_updates
)
as
$entity
)
{
if
(
static
::
countUsages
(
$entity
)
>
0
)
{
$context
[
'results'
][
'
warning
s'
][]
=
t
(
$context
[
'results'
][
'
error
s'
][]
=
t
(
'There are still usages for %label (@url).'
,
[
'%label'
=>
$entity
->
label
()
??
$entity
->
getEntityTypeId
()
.
':'
.
$entity
->
id
(),
...
...
This diff is collapsed.
Click to expand it.
tests/src/Kernel/EntityUsageUpdaterViolationTest.php
+
4
−
1
View file @
fe5e8dfb
...
...
@@ -96,7 +96,10 @@ class EntityUsageUpdaterViolationTest extends EntityUsageUpdaterKernelTestBase {
// Test messenger message.
$messages
=
$this
->
container
->
get
(
'messenger'
)
->
messagesByType
(
'error'
);
$this
->
assertCount
(
1
,
$messages
);
$this
->
assertCount
(
2
,
$messages
);
// The first message is the one we are interested in. The second message
// comes from
// \Drupal\entity_usage_updater\EntityUsageUpdater::checkUsageAfterRemove().
$this
->
assertInstanceOf
(
Markup
::
class
,
$messages
[
0
]);
$this
->
assertSame
(
'Cannot save <em class="placeholder">entity_test</em> <em class="placeholder">3</em> because: This value should not be null.'
,
(
string
)
$messages
[
0
]);
...
...
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