Browse Source

Add test skeleton for TimeHelper outputTimezone.

Add some failing tests and incomplete test placeholders.
Mark Story 9 years ago
parent
commit
ef5de31569
1 changed files with 162 additions and 0 deletions
  1. 162 0
      tests/TestCase/View/Helper/TimeHelperTest.php

+ 162 - 0
tests/TestCase/View/Helper/TimeHelperTest.php

@@ -114,6 +114,33 @@ class TimeHelperTest extends TestCase
     }
 
     /**
+     * Test output timezone with timeAgoInWords
+     *
+     * @return void
+     */
+    public function testTimeAgoInWordsOutputTimezone()
+    {
+        $Time = new TimeHelper($this->View, ['outputTimezone' => 'America/Vancouver']);
+        $timestamp = new Time('+8 years, +4 months +2 weeks +3 days');
+        $result = $Time->timeAgoInWords($timestamp, [
+            'end' => '1 years',
+            'element' => 'span'
+        ]);
+        $vancouver = clone $timestamp;
+        $vancouver->timezone('America/Vancouver');
+
+        $expected = [
+            'span' => [
+                'title' => $vancouver->__toString(),
+                'class' => 'time-ago-in-words'
+            ],
+            'on ' . $vancouver->format('n/j/y'),
+            '/span'
+        ];
+        $this->assertHtml($expected, $result);
+    }
+
+    /**
      * testToQuarter method
      *
      * @return void
@@ -160,6 +187,20 @@ class TimeHelperTest extends TestCase
     }
 
     /**
+     * testToAtom method
+     *
+     * @return void
+     */
+    public function testToAtomOutputTimezone()
+    {
+        $this->Time->config('outputTimezone', 'America/Vancouver');
+        $dateTime = new Time;
+        $vancouver = clone $dateTime;
+        $vancouver->timezone('America/Vancouver');
+        $this->assertEquals($vancouver->format(Time::ATOM), $this->Time->toAtom($vancouver));
+    }
+
+    /**
      * testToRss method
      *
      * @return void
@@ -180,6 +221,16 @@ class TimeHelperTest extends TestCase
     }
 
     /**
+     * test toRss with outputTimezone
+     *
+     * @return void
+     */
+    public function testToRssOutputTimezone()
+    {
+        $this->markTestIncomplete();
+    }
+
+    /**
      * testOfGmt method
      *
      * @return void
@@ -205,6 +256,17 @@ class TimeHelperTest extends TestCase
         $result = $this->Time->isToday('-1 day');
         $this->assertFalse($result);
     }
+
+    /**
+     * test isToday with outputTimezone
+     *
+     * @return void
+     */
+    public function testIsTodayOutputTimezone()
+    {
+        $this->markTestIncomplete();
+    }
+
     /**
      * testIsFuture method
      *
@@ -224,6 +286,16 @@ class TimeHelperTest extends TestCase
     }
 
     /**
+     * test isFuture with outputTimezone
+     *
+     * @return void
+     */
+    public function testIsFutureOutputTimezone()
+    {
+        $this->markTestIncomplete();
+    }
+
+    /**
      * testIsPast method
      *
      * @return void
@@ -242,6 +314,16 @@ class TimeHelperTest extends TestCase
     }
 
     /**
+     * test isPast with outputTimezone
+     *
+     * @return void
+     */
+    public function testIsPastOutputTimezone()
+    {
+        $this->markTestIncomplete();
+    }
+
+    /**
      * testIsThisWeek method
      *
      * @return void
@@ -264,6 +346,16 @@ class TimeHelperTest extends TestCase
     }
 
     /**
+     * test isThisWeek with outputTimezone
+     *
+     * @return void
+     */
+    public function testIsThisWeekOutputTimezone()
+    {
+        $this->markTestIncomplete();
+    }
+
+    /**
      * testIsThisMonth method
      *
      * @return void
@@ -281,6 +373,16 @@ class TimeHelperTest extends TestCase
     }
 
     /**
+     * test isThisMonth with outputTimezone
+     *
+     * @return void
+     */
+    public function testIsThisMonthOutputTimezone()
+    {
+        $this->markTestIncomplete();
+    }
+
+    /**
      * testIsThisYear method
      *
      * @return void
@@ -294,6 +396,16 @@ class TimeHelperTest extends TestCase
     }
 
     /**
+     * test isThisYear with outputTimezone
+     *
+     * @return void
+     */
+    public function testIsThisYearOutputTimezone()
+    {
+        $this->markTestIncomplete();
+    }
+
+    /**
      * testWasYesterday method
      *
      * @return void
@@ -315,6 +427,16 @@ class TimeHelperTest extends TestCase
     }
 
     /**
+     * test wasYesterday with outputTimezone
+     *
+     * @return void
+     */
+    public function testWasYesterdayOutputTimezone()
+    {
+        $this->markTestIncomplete();
+    }
+
+    /**
      * testIsTomorrow method
      *
      * @return void
@@ -332,6 +454,16 @@ class TimeHelperTest extends TestCase
     }
 
     /**
+     * test isTomorrow with outputTimezone
+     *
+     * @return void
+     */
+    public function testIsTomorrowOutputTimezone()
+    {
+        $this->markTestIncomplete();
+    }
+
+    /**
      * testWasWithinLast method
      *
      * @return void
@@ -378,6 +510,16 @@ class TimeHelperTest extends TestCase
     }
 
     /**
+     * test wasWithinLast with outputTimezone
+     *
+     * @return void
+     */
+    public function testWasWithinLastOutputTimezone()
+    {
+        $this->markTestIncomplete();
+    }
+
+    /**
      * testWasWithinLast method
      *
      * @return void
@@ -424,6 +566,16 @@ class TimeHelperTest extends TestCase
     }
 
     /**
+     * test isWithinNext with outputTimezone
+     *
+     * @return void
+     */
+    public function testIsWithinNextOutputTimezone()
+    {
+        $this->markTestIncomplete();
+    }
+
+    /**
      * test formatting dates taking in account preferred i18n locale file
      *
      * @return void
@@ -453,6 +605,16 @@ class TimeHelperTest extends TestCase
     }
 
     /**
+     * test format with outputTimezone
+     *
+     * @return void
+     */
+    public function testFormatOutputTimezone()
+    {
+        $this->markTestIncomplete();
+    }
+
+    /**
      * Test format() with a string.
      *
      * @return void