Skip to content
Snippets Groups Projects
Commit efd01275 authored by Claudiu Cristea's avatar Claudiu Cristea
Browse files

Merge branch 'ISAICP-8742' into 'release/v1.106.0'

ISAICP-8742: Remove exception on invalid reference but log it anyway.

See merge request digit/digit-joinup-dev!1369
parents 6325cd8f 2e89f0bf
No related branches found
No related tags found
1 merge request!172Release v1.106.0
@api @group-clone
Feature: Tests ISAICP-8742.
Scenario: Pages with broken references are logged.
Given there are no preexisting log records
And I go to "/collection/eu-semantic-interoperability-catalogue/solution/shortsea-xml/distribution/shortsea-xml-booking-xml-schema"
Then I should see the heading "Shortsea XML - Booking XML Schema"
And there should be an record of severity "Error" in the log with description "Can't find a mapped entity with URI http://data.europa.eu/w21/dbd78bd7-c584-48c0-8c4d-be72cfe9e259"
......@@ -94,6 +94,42 @@ function (array &$record) {
}
}
/**
* Asserts that a log record with the given severity and description exists.
*
* @param string $severity
* The severity of the log record.
* @param string $description
* The description of the log record.
*
* @Given there should be an record of severity :severity in the log with description :description
*/
public function assertLogRecordExists(string $severity, string $description): void {
$logRecords = $this->getLogRecords(NULL);
$severity = mb_convert_case($severity, MB_CASE_TITLE);
\assert(array_search($severity, RfcLogLevel::getLevels()), sprintf(
"Invalid severity level '%s'. Allowed values are: %s",
$severity,
implode(', ', RfcLogLevel::getLevels())
));
$severity = array_search($severity, RfcLogLevel::getLevels());
$found = FALSE;
foreach ($logRecords as $record) {
if ($record['severity'] == $severity && strpos($record['message'], $description) !== FALSE) {
$found = TRUE;
break;
}
}
if (!$found) {
throw new \Exception(sprintf(
"Log record with severity '%s' and description '%s' not found.",
$severity,
$description
));
}
}
/**
* The captured log records since scenario start or since the last reset.
*
......
......@@ -19,7 +19,7 @@ services:
# TODO: Drop in ISAICP-8376
joinup_rdf.outbound_value.tid:
class: Drupal\joinup_rdf\EventSubscriber\UriIdConversion
arguments: ['@database', '@entity_field.manager']
arguments: ['@database', '@entity_field.manager', '@logger.channel.php']
tags:
- { name: event_subscriber }
joinup_rdf.legacy_rdf_url.subscriber:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment