Mercurial > hg > cmmr2012-drupal-site
diff core/modules/node/tests/src/Kernel/NodeTokenReplaceTest.php @ 5:12f9dff5fda9 tip
Update to Drupal core 8.7.1
author | Chris Cannam |
---|---|
date | Thu, 09 May 2019 15:34:47 +0100 |
parents | c75dbcec494b |
children |
line wrap: on
line diff
--- a/core/modules/node/tests/src/Kernel/NodeTokenReplaceTest.php Thu Feb 28 13:11:55 2019 +0000 +++ b/core/modules/node/tests/src/Kernel/NodeTokenReplaceTest.php Thu May 09 15:34:47 2019 +0100 @@ -67,13 +67,15 @@ $tests['[node:body]'] = $node->body->processed; $tests['[node:summary]'] = $node->body->summary_processed; $tests['[node:langcode]'] = $node->language()->getId(); - $tests['[node:url]'] = $node->url('canonical', $url_options); - $tests['[node:edit-url]'] = $node->url('edit-form', $url_options); - $tests['[node:author]'] = $account->getUsername(); + $tests['[node:url]'] = $node->toUrl('canonical', $url_options)->toString(); + $tests['[node:edit-url]'] = $node->toUrl('edit-form', $url_options)->toString(); + $tests['[node:author]'] = $account->getAccountName(); $tests['[node:author:uid]'] = $node->getOwnerId(); - $tests['[node:author:name]'] = $account->getUsername(); - $tests['[node:created:since]'] = \Drupal::service('date.formatter')->formatTimeDiffSince($node->getCreatedTime(), ['langcode' => $this->interfaceLanguage->getId()]); - $tests['[node:changed:since]'] = \Drupal::service('date.formatter')->formatTimeDiffSince($node->getChangedTime(), ['langcode' => $this->interfaceLanguage->getId()]); + $tests['[node:author:name]'] = $account->getAccountName(); + /** @var \Drupal\Core\Datetime\DateFormatterInterface $date_formatter */ + $date_formatter = $this->container->get('date.formatter'); + $tests['[node:created:since]'] = $date_formatter->formatTimeDiffSince($node->getCreatedTime(), ['langcode' => $this->interfaceLanguage->getId()]); + $tests['[node:changed:since]'] = $date_formatter->formatTimeDiffSince($node->getChangedTime(), ['langcode' => $this->interfaceLanguage->getId()]); $base_bubbleable_metadata = BubbleableMetadata::createFromObject($node);