Skip to content
Snippets Groups Projects
Commit fe5e8dfb authored by Alex Pott's avatar Alex Pott
Browse files

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!31Move to an error
Pipeline #480112 passed
......@@ -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']['warnings'][] = t(
$context['results']['errors'][] = t(
'There are still usages for %label (@url).',
[
'%label' => $entity->label() ?? $entity->getEntityTypeId() . ':' . $entity->id(),
......
......@@ -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]);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment