Browse Source

Update TimeTest.php, add testTimeAgoInWordsTimezone

Added a test case for the timezone option in function timeAgoInWords.
Ícaro R. Scherma 11 years ago
parent
commit
fcf7408663
1 changed files with 18 additions and 1 deletions
  1. 18 1
      tests/TestCase/I18n/TimeTest.php

+ 18 - 1
tests/TestCase/I18n/TimeTest.php

@@ -174,7 +174,24 @@ class TimeTest extends TestCase
             ],
         ];
     }
-
+    /**
+     * test the timezone option for timeAgoInWords
+     * 
+     * @return void
+     */
+     public function testTimeAgoInWordsTimezone()
+     {
+        $time = new Time('1990-07-31 20:33:00 UTC');
+        $result = $time->timeAgoInWords(
+            [
+                'timezone' => 'America/Vancouver',
+                'end' => '+1month',
+                'format' => 'dd-MM-YYYY HH:mm:ss'
+            ]
+        );
+        $this->assertEquals('on 31-07-1990 13:33:00', $result);
+     }
+     
     /**
      * test the end option for timeAgoInWords
      *