You are here

public function LegacyFunctionsTest::testFormatDate in Drupal 8

Tests format_date().

@expectedDeprecation format_date() is deprecated in Drupal 8.0.0 and will be removed before Drupal 9.0.0. Use \Drupal::service('date.formatter')->format() instead. See https://www.drupal.org/node/1876852

File

core/tests/Drupal/KernelTests/Core/Common/LegacyFunctionsTest.php, line 20

Class

LegacyFunctionsTest
Tests legacy functions in common.inc.

Namespace

Drupal\KernelTests\Core\Common

Code

public function testFormatDate() {

  // Provide arguments otherwise the system module configuration is required.
  $date = format_date(0, 'custom', 'Y-m-d');
  $this
    ->assertEquals('1970-01-01', $date);
}