You are here

public function FacetsDateHandlerTest::testFormatTimestamp in Facets 8

Tests for ::formatTimestamp method.

File

tests/src/Unit/Utility/FacetsDateHandlerTest.php, line 217

Class

FacetsDateHandlerTest
Unit test for Date Handler Service.

Namespace

Drupal\Tests\facets\Unit\Utility

Code

public function testFormatTimestamp() {
  $fd = $this->handler;
  $formatted = $fd
    ->formatTimestamp(static::TIMESTAMP);
  $this
    ->assertEquals('1987', $formatted);
  $formatted = $fd
    ->formatTimestamp(static::TIMESTAMP, 'llama');
  $this
    ->assertEquals('1987', $formatted);
  $formatted = $fd
    ->formatTimestamp(static::TIMESTAMP, $fd::FACETS_DATE_YEAR);
  $this
    ->assertEquals('1987', $formatted);
}