shlink/module/Common/test/Util/DateRangeTest.php

36 lines
874 B
PHP
Raw Normal View History

2016-07-30 18:45:48 +03:00
<?php
2017-10-12 11:13:20 +03:00
declare(strict_types=1);
2016-07-30 18:45:48 +03:00
namespace ShlinkioTest\Shlink\Common\Util;
use Cake\Chronos\Chronos;
2017-03-24 22:34:18 +03:00
use PHPUnit\Framework\TestCase;
2016-07-30 18:45:48 +03:00
use Shlinkio\Shlink\Common\Util\DateRange;
class DateRangeTest extends TestCase
{
/**
* @test
*/
public function defaultConstructorSetDatesToNull()
{
$range = new DateRange();
$this->assertNull($range->getStartDate());
$this->assertNull($range->getEndDate());
$this->assertTrue($range->isEmpty());
}
/**
* @test
*/
public function providedDatesAreSet()
{
$startDate = Chronos::now();
$endDate = Chronos::now();
2016-07-30 18:45:48 +03:00
$range = new DateRange($startDate, $endDate);
$this->assertSame($startDate, $range->getStartDate());
$this->assertSame($endDate, $range->getEndDate());
$this->assertFalse($range->isEmpty());
}
}