summaryrefslogtreecommitdiff
path: root/tests/UnitTests/framework/I18N/TestOfDateTimeFormatInfo.php
diff options
context:
space:
mode:
authorxue <>2006-07-07 14:54:15 +0000
committerxue <>2006-07-07 14:54:15 +0000
commit61bb16ee2e5f0a66234e1575242169a10fde47b5 (patch)
tree3ee24dcc36ceae2c213130df1ea3d5c9fc110a27 /tests/UnitTests/framework/I18N/TestOfDateTimeFormatInfo.php
parent7b84938b1b5964f2274d66e28ba17435924ffe35 (diff)
Merge from 3.0 branch till 1253.
Diffstat (limited to 'tests/UnitTests/framework/I18N/TestOfDateTimeFormatInfo.php')
-rw-r--r--tests/UnitTests/framework/I18N/TestOfDateTimeFormatInfo.php223
1 files changed, 0 insertions, 223 deletions
diff --git a/tests/UnitTests/framework/I18N/TestOfDateTimeFormatInfo.php b/tests/UnitTests/framework/I18N/TestOfDateTimeFormatInfo.php
deleted file mode 100644
index a2d78807..00000000
--- a/tests/UnitTests/framework/I18N/TestOfDateTimeFormatInfo.php
+++ /dev/null
@@ -1,223 +0,0 @@
-<?php
-
-Prado::using('System.I18N.core.DateTimeFormatInfo');
-
-class TestOfDateTimeFormatInfo extends UnitTestCase
-{
- protected $format;
-
- function TestOfDateTimeFormatInfo()
- {
- $this->UnitTestCase();
- }
-
- function setUp()
- {
- $this->format = DateTimeFormatInfo::getInstance('en');
- }
-
- function testAbbreviatedDayNames()
- {
- $names = $this->format->AbbreviatedDayNames;
- $this->assertTrue(is_array($names),'Must be an array!');
- $this->assertEqual(count($names),7,'Must have 7 day names');
-
- //assuming invariant culture.
- $days = array("Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat");
- $this->assertEqual($names, $days);
-
- //try to set the data
- $data = array('Hel', 'wor');
- $this->format->AbbreviatedDayNames = $data;
- $newNames = $this->format->AbbreviatedDayNames;
- $this->assertTrue(is_array($newNames),'Must be an array!');
- $this->assertEqual(count($newNames),2,'Must have 2 entries');
- $this->assertEqual($newNames, $data);
- }
-
- function testNarrowDayNames()
- {
- $names = $this->format->NarrowDayNames;
- $this->assertTrue(is_array($names),'Must be an array!');
- $this->assertEqual(count($names),7,'Must have 7 day names');
-
- //assuming invariant culture.
- $days = array("S", "M", "T", "W", "T", "F", "S");
- $this->assertEqual($names, $days);
-
- //try to set the data
- $data = array('H', 'w');
- $this->format->NarrowDayNames = $data;
- $newNames = $this->format->NarrowDayNames;
- $this->assertTrue(is_array($newNames),'Must be an array!');
- $this->assertEqual(count($newNames),2,'Must have 2 entries');
- $this->assertEqual($newNames, $data);
- }
-
- function testDayNames()
- {
- $names = $this->format->DayNames;
- $this->assertTrue(is_array($names),'Must be an array!');
- $this->assertEqual(count($names),7,'Must have 7 day names');
-
- //assuming invariant culture.
- $days = array( "Sunday","Monday", "Tuesday", "Wednesday",
- "Thursday", "Friday", "Saturday");
- $this->assertEqual($names, $days);
-
- //try to set the data
- $data = array('Hello', 'world');
- $this->format->DayNames = $data;
- $newNames = $this->format->DayNames;
- $this->assertTrue(is_array($newNames),'Must be an array!');
- $this->assertEqual(count($newNames),2,'Must have 2 entries');
- $this->assertEqual($newNames, $data);
- }
-
- function testMonthNames()
- {
- $names = $this->format->MonthNames;
- $this->assertTrue(is_array($names),'Must be an array!');
- $this->assertEqual(count($names),12,'Must have 12 month names');
-
- //assuming invariant culture.
- $days = array( "January", "February", "March", "April",
- "May", "June", "July", "August", "September",
- "October", "November", "December");
- $this->assertEqual($names, $days);
-
- //try to set the data
- $data = array('Hello', 'world');
- $this->format->MonthNames = $data;
- $newNames = $this->format->MonthNames;
- $this->assertTrue(is_array($newNames),'Must be an array!');
- $this->assertEqual(count($newNames),2,'Must have 2 entries');
- $this->assertEqual($newNames, $data);
- }
-
- function testNarrowMonthNames()
- {
- $names = $this->format->NarrowMonthNames;
- $this->assertTrue(is_array($names),'Must be an array!');
- $this->assertEqual(count($names),12,'Must have 12 month names');
-
- //assuming invariant culture.
- $days = array( "J", "F", "M", "A", "M", "J", "J",
- "A", "S", "O", "N", "D");
- $this->assertEqual($names, $days);
-
- //try to set the data
- $data = array('Hello', 'world');
- $this->format->NarrowMonthNames = $data;
- $newNames = $this->format->NarrowMonthNames;
- $this->assertTrue(is_array($newNames),'Must be an array!');
- $this->assertEqual(count($newNames),2,'Must have 2 entries');
- $this->assertEqual($newNames, $data);
- }
-
- function testAbbreviatedMonthNames()
- {
- $names = $this->format->AbbreviatedMonthNames;
- $this->assertTrue(is_array($names),'Must be an array!');
- $this->assertEqual(count($names),12,'Must have 12 month names');
-
- //assuming invariant culture.
- $days = array( "Jan", "Feb", "Mar", "Apr",
- "May", "Jun", "Jul", "Aug", "Sep",
- "Oct", "Nov", "Dec");
- $this->assertEqual($names, $days);
-
- //try to set the data
- $data = array('Hello', 'world');
- $this->format->AbbreviatedMonthNames = $data;
- $newNames = $this->format->AbbreviatedMonthNames;
- $this->assertTrue(is_array($newNames),'Must be an array!');
- $this->assertEqual(count($newNames),2,'Must have 2 entries');
- $this->assertEqual($newNames, $data);
- }
-
- function testEra()
- {
- //era for invariant culture is assumed to have
- // 1 for AD and 0 for BC
- $this->assertEqual('AD', $this->format->getEra(1));
- $this->assertEqual('BC', $this->format->getEra(0));
- }
-
- function testAMPMMarkers()
- {
- $am_pm = array('AM','PM');
- $data = $this->format->AMPMMarkers;
- $this->assertTrue(is_array($data));
- $this->assertEqual($am_pm, $data);
- $this->assertEqual('AM', $this->format->AMDesignator);
- $this->assertEqual('PM', $this->format->PMDesignator);
-
- //try to set the data
- $data = array('Hello', 'world');
- $this->format->AMPMMarkers = $data;
- $newNames = $this->format->AMPMMarkers;
- $this->assertTrue(is_array($newNames),'Must be an array!');
- $this->assertEqual(count($newNames),2,'Must have 2 entries');
- $this->assertEqual($newNames, $data);
-
- $this->format->AMDesignator = 'TTTT';
- $this->assertEqual('TTTT',$this->format->AMDesignator);
-
- $this->format->PMDesignator = 'SSS';
- $this->assertEqual('SSS',$this->format->PMDesignator);
- }
-
- function testPatterns()
- {
- //patterns for invariant
- $patterns = array(
- 'FullTimePattern' => 'h:mm:ss a z',
- 'LongTimePattern' => 'h:mm:ss a z',
- 'MediumTimePattern' => 'h:mm:ss a',
- 'ShortTimePattern' => 'h:mm a',
- 'FullDatePattern' => 'EEEE, MMMM d, yyyy',
- 'LongDatePattern' => 'MMMM d, yyyy',
- 'MediumDatePattern' => 'MMM d, yyyy',
- 'ShortDatePattern' => 'M/d/yy',
- 'DateTimeOrderPattern' => '{1} {0}'
- );
-
- foreach($patterns as $property => $pattern)
- {
- $this->assertEqual($pattern, $this->format->$property);
- }
-
- $hello = 'Hello';
- $world = 'world';
- $expectedResult = $hello.' '.$world;
- $this->assertEqual($expectedResult,
- $this->format->formatDateTime($hello, $world));
- }
-
- function testInvariantInfo()
- {
- $format = DateTimeFormatInfo::getInstance();
-
- //the variant datetime format for medium date
- //should be the follow
- $pattern = 'MMM d, yyyy';
-
- $this->assertEqual($pattern, $format->MediumDatePattern);
-
- $invariant = $format->getInvariantInfo();
-
- $this->assertIdentical($format, $invariant);
- }
-
- function testGetInstance()
- {
- $format = DateTimeFormatInfo::getInstance('zh_CN');
-
- $pattern = 'yyyy-M-d';
- $this->assertEqual($pattern, $format->MediumDatePattern);
- }
-}
-
-
-?> \ No newline at end of file