Skip to content

Commit

Permalink
Make tests consistently using $now variable.
Browse files Browse the repository at this point in the history
  • Loading branch information
dereuromark committed Oct 15, 2015
1 parent 12bbb4d commit 4c2bc05
Showing 1 changed file with 22 additions and 20 deletions.
42 changes: 22 additions & 20 deletions tests/DateTime/StartEndOfTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ class StartEndOfTest extends TestCase
*/
public function testStartOfDay($class)
{
$dt = $class::now();
$dt = $dt->startOfDay();
$now = $class::now();
$dt = $now->startOfDay();
$this->assertTrue($dt instanceof $class);
$this->assertDateTime($dt, $dt->year, $dt->month, $dt->day, 0, 0, 0);
}
Expand All @@ -36,8 +36,8 @@ public function testStartOfDay($class)
*/
public function testEndOfDay($class)
{
$dt = $class::now();
$dt = $dt->endOfDay();
$now = $class::now();
$dt = $now->endOfDay();
$this->assertTrue($dt instanceof $class);
$this->assertDateTime($dt, $dt->year, $dt->month, $dt->day, 23, 59, 59);
}
Expand All @@ -48,8 +48,8 @@ public function testEndOfDay($class)
*/
public function testStartOfMonthIsFluid($class)
{
$dt = $class::now();
$dt = $dt->startOfMonth();
$now = $class::now();
$dt = $now->startOfMonth();
$this->assertTrue($dt instanceof $class);
}

Expand Down Expand Up @@ -79,8 +79,8 @@ public function testStartOfMonthFromLastDay($class)
*/
public function testStartOfYearIsFluid($class)
{
$dt = $class::now();
$dt = $dt->startOfYear();
$now = $class::now();
$dt = $now->startOfYear();
$this->assertTrue($dt instanceof $class);
}

Expand Down Expand Up @@ -120,8 +120,8 @@ public function testStartOfYearFromLastDay($class)
*/
public function testEndOfMonthIsFluid($class)
{
$dt = $class::now();
$dt = $dt->endOfMonth();
$now = $class::now();
$dt = $now->endOfMonth();
$this->assertTrue($dt instanceof $class);
}

Expand Down Expand Up @@ -151,8 +151,8 @@ public function testEndOfMonthFromLastDay($class)
*/
public function testEndOfYearIsFluid($class)
{
$dt = $class::now();
$dt = $dt->endOfYear();
$now = $class::now();
$dt = $now->endOfYear();
$this->assertTrue($dt instanceof $class);
}

Expand Down Expand Up @@ -192,8 +192,8 @@ public function testEndOfYearFromLastDay($class)
*/
public function testStartOfDecadeIsFluid($class)
{
$dt = $class::now();
$dt = $dt->startOfDecade();
$now = $class::now();
$dt = $now->startOfDecade();
$this->assertTrue($dt instanceof $class);
}

Expand Down Expand Up @@ -233,8 +233,9 @@ public function testStartOfDecadeFromLastDay($class)
*/
public function testEndOfDecadeIsFluid($class)
{
$dt = $class::now();
$this->assertTrue($dt->endOfDecade() instanceof $class);
$now = $class::now();
$dt = $now->endOfDecade();
$this->assertTrue($dt instanceof $class);
}

/**
Expand Down Expand Up @@ -273,8 +274,9 @@ public function testEndOfDecadeFromLastDay($class)
*/
public function testStartOfCenturyIsFluid($class)
{
$dt = $class::now();
$this->assertTrue($dt->startOfCentury() instanceof $class);
$now = $class::now();
$dt = $now->startOfCentury();
$this->assertTrue($dt instanceof $class);
}

/**
Expand Down Expand Up @@ -314,8 +316,8 @@ public function testStartOfCenturyFromLastDay($class)
*/
public function testEndOfCenturyIsFluid($class)
{
$dt = $class::now();
$dt = $dt->endOfCentury();
$now = $class::now();
$dt = $now->endOfCentury();
$this->assertTrue($dt instanceof $class);
}

Expand Down

0 comments on commit 4c2bc05

Please sign in to comment.