You are here

public function FacetsDateHandlerTest::testGetNextDateGap in Facets 8

Tests for ::getNextDateGap.

File

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

Class

FacetsDateHandlerTest
Unit test for Date Handler Service.

Namespace

Drupal\Tests\facets\Unit\Utility

Code

public function testGetNextDateGap() {
  $fd = $this->handler;
  $gap = $fd
    ->getNextDateGap($fd::FACETS_DATE_SECOND);
  $this
    ->assertEquals($fd::FACETS_DATE_SECOND, $gap);
  $gap = $fd
    ->getNextDateGap($fd::FACETS_DATE_MINUTE);
  $this
    ->assertEquals($fd::FACETS_DATE_SECOND, $gap);
  $gap = $fd
    ->getNextDateGap($fd::FACETS_DATE_SECOND, $fd::FACETS_DATE_MINUTE);
  $this
    ->assertEquals($fd::FACETS_DATE_MINUTE, $gap);
  $gap = $fd
    ->getNextDateGap($fd::FACETS_DATE_MINUTE, $fd::FACETS_DATE_MINUTE);
  $this
    ->assertEquals($fd::FACETS_DATE_MINUTE, $gap);
  $gap = $fd
    ->getNextDateGap($fd::FACETS_DATE_SECOND, $fd::FACETS_DATE_HOUR);
  $this
    ->assertEquals($fd::FACETS_DATE_HOUR, $gap);
  $gap = $fd
    ->getNextDateGap($fd::FACETS_DATE_MINUTE, $fd::FACETS_DATE_HOUR);
  $this
    ->assertEquals($fd::FACETS_DATE_HOUR, $gap);
  $gap = $fd
    ->getNextDateGap($fd::FACETS_DATE_HOUR, $fd::FACETS_DATE_HOUR);
  $this
    ->assertEquals($fd::FACETS_DATE_HOUR, $gap);
}