diff --git a/src/Tests/MonitoringCoreKernelTest.php b/src/Tests/MonitoringCoreKernelTest.php
index 6d2d99c..82bf99c 100644
--- a/src/Tests/MonitoringCoreKernelTest.php
+++ b/src/Tests/MonitoringCoreKernelTest.php
@@ -135,7 +135,7 @@ class MonitoringCoreKernelTest extends MonitoringUnitTestBase {
       '!message' => 'Argument 1 passed to Drupal\Core\Form\ConfigFormBase::buildForm() must be of the type array, null given, called in /usr/local/var/www/d8/www/core/modules/system/src/Form/CronForm.php on line 127 and defined',
       '%function' => 'Drupal\Core\Form\ConfigFormBase->buildForm()',
       '%line' => '42',
-      '%file' => '/usr/local/var/www/d8/www/core/lib/Drupal/Core/Form/ConfigFormBase.php',
+      '%file' => DRUPAL_ROOT . '/core/lib/Drupal/Core/Form/ConfigFormBase.php',
       'severity_level' => 3,
     ];
     // Log it twice.
@@ -144,6 +144,7 @@ class MonitoringCoreKernelTest extends MonitoringUnitTestBase {
 
     $result = $this->runSensor('dblog_php_notices');
     $message = $result->getMessage();
+    $error['%file'] = str_replace(DRUPAL_ROOT . '/', '', $error['%file']);
     // Assert the message has been set and replaced successfully.
     $this->assertEqual($message, SafeMarkup::format('2 times: %type: !message in %function (line %line of %file).', $error), 'PHP notice was found and replaced successfully.');
 
@@ -153,7 +154,7 @@ class MonitoringCoreKernelTest extends MonitoringUnitTestBase {
       '!message' => 'Use of undefined constant B - assumed \'B\'',
       '%function' => 'Drupal\system\Form\CronForm->buildForm()',
       '%line' => '126',
-      '%file' => '/usr/local/var/www/d8/www/core/modules/system/src/Form/CronForm.php',
+      '%file' => DRUPAL_ROOT . '/core/modules/system/src/Form/CronForm.php',
       'severity_level' => 5,
     ];
     \Drupal::logger('php')->log($new_error['severity_level'], '%type: !message in %function (line %line of %file).', $new_error);
@@ -168,6 +169,7 @@ class MonitoringCoreKernelTest extends MonitoringUnitTestBase {
     \Drupal::logger('php')->log($new_error['severity_level'], '%type: !message in %function (line %line of %file).', $new_error);
     $result = $this->runSensor('dblog_php_notices');
     $message = $result->getMessage();
+    $new_error['%file'] = str_replace(DRUPAL_ROOT . '/', '', $new_error['%file']);
     // Assert the new message is returned as a message.
     $this->assertEqual($message, SafeMarkup::format('3 times: %type: !message in %function (line %line of %file).', $new_error), 'The new message is now the sensor message.');
     $this->assertNotEqual($message, SafeMarkup::format('2 times: %type: !message in %function (line %line of %file).', $error), 'The old message is not the sensor message anymore.');
