Permalink
Browse files

all tests work

  • Loading branch information...
Nicholas Eden Nicholas Eden
Nicholas Eden authored and Nicholas Eden committed Sep 6, 2013
1 parent 54b25df commit bd5c79a1c3d3547d49a653c9ae4e259ad21a7d91
Showing with 4 additions and 4 deletions.
  1. +4 −4 src/Carbon/Carbon.php
View
@@ -133,9 +133,9 @@ public function __construct($time = null, $tz = null)
{
// If the class has a test now set and we are trying to create a now()
// instance then override as required
- if (static::hasTestNow() && (empty($time) || $time === 'now' || $relative = self::hasRelativeKeywords($time))) {
- if ($relative) {
- $time = static::getRelativeTest()->toDateTimeString();
+ if (static::hasTestNow() && (empty($time) || $time === 'now' || self::hasRelativeKeywords($time))) {
+ if (self::hasRelativeKeywords($time)) {
+ $time = static::getRelativeTest($time)->toDateTimeString();
} else {
$time = static::getTestNow()->toDateTimeString();
}
@@ -746,7 +746,7 @@ public static function getRelativeTest($time) {
$instance = new static($testNow->toDateString() . ' ' . $time);
$instance->setTime($testNow->format('h'), $testNow->format('i'), $testNow->format('s'));
- $relativeDate = $instance;
+ return $instance;
}
///////////////////////////////////////////////////////////////////

0 comments on commit bd5c79a

Please sign in to comment.