Mercurial > hg > cmmr2012-drupal-site
comparison 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 |
comparison
equal
deleted
inserted
replaced
4:a9cd425dd02b | 5:12f9dff5fda9 |
---|---|
35 | 35 |
36 // Generate and test tokens. | 36 // Generate and test tokens. |
37 $tests = []; | 37 $tests = []; |
38 $tests['[node:total-count]'] = 1; | 38 $tests['[node:total-count]'] = 1; |
39 $tests['[node:day-count]'] = 1; | 39 $tests['[node:day-count]'] = 1; |
40 $tests['[node:last-view]'] = format_date($statistics['timestamp']); | 40 /** @var \Drupal\Core\Datetime\DateFormatterInterface $date_formatter */ |
41 $tests['[node:last-view:short]'] = format_date($statistics['timestamp'], 'short'); | 41 $date_formatter = $this->container->get('date.formatter'); |
42 $tests['[node:last-view]'] = $date_formatter->format($statistics['timestamp']); | |
43 $tests['[node:last-view:short]'] = $date_formatter->format($statistics['timestamp'], 'short'); | |
42 | 44 |
43 // Test to make sure that we generated something for each token. | 45 // Test to make sure that we generated something for each token. |
44 $this->assertFalse(in_array(0, array_map('strlen', $tests)), 'No empty tokens generated.'); | 46 $this->assertFalse(in_array(0, array_map('strlen', $tests)), 'No empty tokens generated.'); |
45 | 47 |
46 foreach ($tests as $input => $expected) { | 48 foreach ($tests as $input => $expected) { |