Permalink
Browse files

added unit tests

  • Loading branch information...
1 parent 2d6197a commit 7766510b0d4542700de593558fee55ef8b51b5aa @nicholas-eden committed Sep 6, 2013
Showing with 27 additions and 0 deletions.
  1. +27 −0 tests/TestingAidsTest.php
View
@@ -58,4 +58,31 @@ public function testParseWithTestValueSet()
$this->assertEquals($notNow, Carbon::parse(''));
$this->assertEquals($notNow, Carbon::parse('now'));
}
+
+ public function testParseRelativeWithTestValueSet()
+ {
+ $notNow = Carbon::parse('2013-09-01');
+ Carbon::setTestNow($notNow);
+
+ $this->assertEquals('2013-09-02', Carbon::parse('tomorrow')->toDateString());
+ $this->assertEquals('2013-08-31', Carbon::parse('yesterday')->toDateString());
+
+ $this->assertEquals('2013-09-02', Carbon::parse('next monday')->toDateString());
+ $this->assertEquals('2013-09-03', Carbon::parse('next tuesday')->toDateString());
+ $this->assertEquals('2013-09-04', Carbon::parse('next wednesday')->toDateString());
+ $this->assertEquals('2013-09-05', Carbon::parse('next thursday')->toDateString());
+ $this->assertEquals('2013-09-06', Carbon::parse('next friday')->toDateString());
+ $this->assertEquals('2013-09-07', Carbon::parse('next saturday')->toDateString());
+ $this->assertEquals('2013-09-08', Carbon::parse('next sunday')->toDateString());
+
+ $this->assertEquals('2013-08-26', Carbon::parse('last monday')->toDateString());
+ $this->assertEquals('2013-08-27', Carbon::parse('last tuesday')->toDateString());
+ $this->assertEquals('2013-08-28', Carbon::parse('last wednesday')->toDateString());
+ $this->assertEquals('2013-08-29', Carbon::parse('last thursday')->toDateString());
+ $this->assertEquals('2013-08-30', Carbon::parse('last friday')->toDateString());
+ $this->assertEquals('2013-08-31', Carbon::parse('last saturday')->toDateString());
+ $this->assertEquals('2013-08-25', Carbon::parse('last sunday')->toDateString());
+
+
+ }
}

0 comments on commit 7766510

Please sign in to comment.