Skip to content

Commit 72dbd27

Browse files
committed
Added more tests.
Signed-off-by: Jason Lewis <jason.lewis1991@gmail.com>
1 parent a7c05b1 commit 72dbd27

File tree

1 file changed

+77
-0
lines changed

1 file changed

+77
-0
lines changed

tests/ExpressiveDateTest.php

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,83 @@ public function testGetTimeString()
389389
}
390390

391391

392+
public function testGetDayOfWeek()
393+
{
394+
$date = new ExpressiveDate('31 January 1991');
395+
$this->assertEquals('Thursday', $date->getDayOfWeek());
396+
}
397+
398+
399+
public function testGetDayOfWeekAsNumeric()
400+
{
401+
$date = new ExpressiveDate('31 January 1991');
402+
$this->assertEquals(4, $date->getDayOfWeekAsNumeric());
403+
}
404+
405+
406+
public function testGetDaysInMonth()
407+
{
408+
$date = new ExpressiveDate('31 January 1991');
409+
$this->assertEquals(31, $date->getDaysInMonth());
410+
}
411+
412+
413+
public function testGetDayOfYear()
414+
{
415+
$date = new ExpressiveDate('31 January 1991');
416+
$this->assertEquals(30, $date->getDayOfYear());
417+
}
418+
419+
420+
public function testGetDaySuffix()
421+
{
422+
$date = new ExpressiveDate('31 January 1991');
423+
$this->assertEquals('st', $date->getDaySuffix());
424+
}
425+
426+
427+
public function testIsLeapYear()
428+
{
429+
$date = new ExpressiveDate('31 January 1991');
430+
$this->assertFalse($date->isLeapYear());
431+
}
432+
433+
434+
public function testIsAmOrPm()
435+
{
436+
$date = new ExpressiveDate('31 January 1991');
437+
$this->assertEquals('AM', $date->isAmOrPm());
438+
}
439+
440+
441+
public function testIsDaylightSavings()
442+
{
443+
$date = new ExpressiveDate('31 January 1991');
444+
$this->assertTrue($date->isDaylightSavings());
445+
}
446+
447+
448+
public function testGetGmtDifference()
449+
{
450+
$date = new ExpressiveDate('31 January 1991');
451+
$this->assertEquals('+1100', $date->getGmtDifference());
452+
}
453+
454+
455+
public function testSecondsSinceEpoch()
456+
{
457+
$date = new ExpressiveDate('31 January 1991');
458+
$this->assertEquals(strtotime('31 January 1991') - strtotime('January 1 1970 00:00:00 GMT'), $date->getSecondsSinceEpoch());
459+
}
460+
461+
462+
public function testGetTimezoneName()
463+
{
464+
$date = new ExpressiveDate('31 January 1991');
465+
$this->assertEquals('Australia/Melbourne', $date->getTimezoneName());
466+
}
467+
468+
392469
public function testGettingInvalidDateAttributeThrowsException()
393470
{
394471
$this->setExpectedException('InvalidArgumentException');

0 commit comments

Comments
 (0)