namespace Drupal\Tests\field\Kernel\Timestamp;
-use Drupal\Component\Utility\SafeMarkup;
-use Drupal\Component\Utility\Unicode;
+use Drupal\Component\Render\FormattableMarkup;
use Drupal\Core\Entity\Display\EntityViewDisplayInterface;
use Drupal\Core\Entity\FieldableEntityInterface;
use Drupal\entity_test\Entity\EntityTest;
$this->entityType = 'entity_test';
$this->bundle = $this->entityType;
- $this->fieldName = Unicode::strtolower($this->randomMachineName());
+ $this->fieldName = mb_strtolower($this->randomMachineName());
$field_storage = FieldStorageConfig::create([
'field_name' => $this->fieldName,
// Test a timestamp in the past
$value = $request_time - 87654321;
- $expected = SafeMarkup::format($past_format, ['@interval' => \Drupal::service('date.formatter')->formatTimeDiffSince($value, ['granularity' => $granularity])]);
+ $expected = new FormattableMarkup($past_format, ['@interval' => \Drupal::service('date.formatter')->formatTimeDiffSince($value, ['granularity' => $granularity])]);
$component = $this->display->getComponent($this->fieldName);
$component['type'] = 'timestamp_ago';
// Test a timestamp in the future
$value = $request_time + 87654321;
- $expected = SafeMarkup::format($future_format, ['@interval' => \Drupal::service('date.formatter')->formatTimeDiffUntil($value, ['granularity' => $granularity])]);
+ $expected = new FormattableMarkup($future_format, ['@interval' => \Drupal::service('date.formatter')->formatTimeDiffUntil($value, ['granularity' => $granularity])]);
$component = $this->display->getComponent($this->fieldName);
$component['type'] = 'timestamp_ago';