diff core/modules/statistics/tests/src/Functional/StatisticsTokenReplaceTest.php @ 5:12f9dff5fda9 tip

Update to Drupal core 8.7.1
author Chris Cannam
date Thu, 09 May 2019 15:34:47 +0100
parents a9cd425dd02b
children
line wrap: on
line diff
--- a/core/modules/statistics/tests/src/Functional/StatisticsTokenReplaceTest.php	Thu Feb 28 13:11:55 2019 +0000
+++ b/core/modules/statistics/tests/src/Functional/StatisticsTokenReplaceTest.php	Thu May 09 15:34:47 2019 +0100
@@ -37,8 +37,10 @@
     $tests = [];
     $tests['[node:total-count]'] = 1;
     $tests['[node:day-count]'] = 1;
-    $tests['[node:last-view]'] = format_date($statistics['timestamp']);
-    $tests['[node:last-view:short]'] = format_date($statistics['timestamp'], 'short');
+    /** @var \Drupal\Core\Datetime\DateFormatterInterface $date_formatter */
+    $date_formatter = $this->container->get('date.formatter');
+    $tests['[node:last-view]'] = $date_formatter->format($statistics['timestamp']);
+    $tests['[node:last-view:short]'] = $date_formatter->format($statistics['timestamp'], 'short');
 
     // Test to make sure that we generated something for each token.
     $this->assertFalse(in_array(0, array_map('strlen', $tests)), 'No empty tokens generated.');