You are here

public function FacetsDateHandlerTest::testExtractActiveItems in Facets 8

Test extract items.

File

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

Class

FacetsDateHandlerTest
Unit test for Date Handler Service.

Namespace

Drupal\Tests\facets\Unit\Utility

Code

public function testExtractActiveItems() {
  $this
    ->assertFalse($this->handler
    ->extractActiveItems('foo'));
  $range = '[2016-03-01T00:00:00Z TO 2016-04-01T00:00:00Z]';
  $extracted = $this->handler
    ->extractActiveItems($range);
  $this
    ->assertSame('array', gettype($extracted));
  $this
    ->assertEquals('1456790400', $extracted['start']['timestamp']);
  $this
    ->assertEquals('2016-03-01T00:00:00Z', $extracted['start']['iso']);
}