diff options
Diffstat (limited to 'tests/UnitTests/framework/I18N')
39 files changed, 0 insertions, 1520 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 diff --git a/tests/UnitTests/framework/I18N/messages/en/tests.mo b/tests/UnitTests/framework/I18N/messages/en/tests.mo Binary files differdeleted file mode 100644 index ee243202..00000000 --- a/tests/UnitTests/framework/I18N/messages/en/tests.mo +++ /dev/null diff --git a/tests/UnitTests/framework/I18N/messages/en/tests.po b/tests/UnitTests/framework/I18N/messages/en/tests.po deleted file mode 100644 index 07860851..00000000 --- a/tests/UnitTests/framework/I18N/messages/en/tests.po +++ /dev/null @@ -1,18 +0,0 @@ -msgid ""
-msgstr ""
-"Project-Id-Version: I18N Tests\n"
-"POT-Creation-Date: \n"
-"PO-Revision-Date: 2005-01-09 14:11+1000\n"
-"Last-Translator: \n"
-"Language-Team: Wei Zhuo\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=utf-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-"X-Poedit-Basepath: F:\\www\\prado\\framework\\I18N\\tests\n"
-
-msgid "Hello"
-msgstr "hello"
-
-msgid "Goodbye"
-msgstr "Sayonara"
-
diff --git a/tests/UnitTests/framework/I18N/messages/en/tests.xml b/tests/UnitTests/framework/I18N/messages/en/tests.xml deleted file mode 100644 index dbcd6831..00000000 --- a/tests/UnitTests/framework/I18N/messages/en/tests.xml +++ /dev/null @@ -1,17 +0,0 @@ -<?xml version="1.0"?>
-<xliff version="1.0">
-<!-- @author $Author: weizhuo $ -->
-<!-- @version $Id: tests.xml,v 1.1 2005/01/09 22:15:32 weizhuo Exp $ -->
- <file source-language="EN" target-language="EN-AU" datatype="plaintext" original="articles.php" date="2002-01-25T21:06:01Z" product-name="Articles">
- <body>
- <trans-unit id="1">
- <source>Hello</source>
- <target>hello</target>
- </trans-unit>
- <trans-unit id="2">
- <source>Goodbye</source>
- <target>Sayonara</target>
- </trans-unit>
- </body>
- </file>
-</xliff>
diff --git a/tests/UnitTests/framework/I18N/messages/en_AU/tests.mo b/tests/UnitTests/framework/I18N/messages/en_AU/tests.mo Binary files differdeleted file mode 100644 index a9a26db2..00000000 --- a/tests/UnitTests/framework/I18N/messages/en_AU/tests.mo +++ /dev/null diff --git a/tests/UnitTests/framework/I18N/messages/en_AU/tests.mo.bak b/tests/UnitTests/framework/I18N/messages/en_AU/tests.mo.bak Binary files differdeleted file mode 100644 index a9a26db2..00000000 --- a/tests/UnitTests/framework/I18N/messages/en_AU/tests.mo.bak +++ /dev/null diff --git a/tests/UnitTests/framework/I18N/messages/en_AU/tests.po b/tests/UnitTests/framework/I18N/messages/en_AU/tests.po deleted file mode 100644 index 9f81f650..00000000 --- a/tests/UnitTests/framework/I18N/messages/en_AU/tests.po +++ /dev/null @@ -1,15 +0,0 @@ -msgid ""
-msgstr ""
-"Project-Id-Version: I18N Tests\n"
-"POT-Creation-Date: \n"
-"PO-Revision-Date: 2004-12-25 12:25+1000\n"
-"Last-Translator: \n"
-"Language-Team: Wei Zhuo\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=utf-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-"X-Poedit-Basepath: F:\\www\\prado\\framework\\I18N\\tests\n"
-
-msgid "Hello"
-msgstr "Howdy!"
-
diff --git a/tests/UnitTests/framework/I18N/messages/en_AU/tests.po.bak b/tests/UnitTests/framework/I18N/messages/en_AU/tests.po.bak deleted file mode 100644 index 9f81f650..00000000 --- a/tests/UnitTests/framework/I18N/messages/en_AU/tests.po.bak +++ /dev/null @@ -1,15 +0,0 @@ -msgid ""
-msgstr ""
-"Project-Id-Version: I18N Tests\n"
-"POT-Creation-Date: \n"
-"PO-Revision-Date: 2004-12-25 12:25+1000\n"
-"Last-Translator: \n"
-"Language-Team: Wei Zhuo\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=utf-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-"X-Poedit-Basepath: F:\\www\\prado\\framework\\I18N\\tests\n"
-
-msgid "Hello"
-msgstr "Howdy!"
-
diff --git a/tests/UnitTests/framework/I18N/messages/en_AU/tests.xml b/tests/UnitTests/framework/I18N/messages/en_AU/tests.xml deleted file mode 100644 index 7ed84220..00000000 --- a/tests/UnitTests/framework/I18N/messages/en_AU/tests.xml +++ /dev/null @@ -1,13 +0,0 @@ -<?xml version="1.0"?>
-<xliff version="1.0">
-<!-- @author $Author: weizhuo $ -->
-<!-- @version $Id: tests.xml.bak,v 1.1 2005/01/09 22:15:33 weizhuo Exp $ -->
- <file source-language="EN" target-language="EN-AU" datatype="plaintext" original="articles.php" date="2002-01-25T21:06:01Z" product-name="Articles">
- <body>
- <trans-unit id="1">
- <source>Hello</source>
- <target>Howdy!</target>
- </trans-unit>
- </body>
- </file>
-</xliff>
diff --git a/tests/UnitTests/framework/I18N/messages/en_AU/tests.xml.bak b/tests/UnitTests/framework/I18N/messages/en_AU/tests.xml.bak deleted file mode 100644 index 7ed84220..00000000 --- a/tests/UnitTests/framework/I18N/messages/en_AU/tests.xml.bak +++ /dev/null @@ -1,13 +0,0 @@ -<?xml version="1.0"?>
-<xliff version="1.0">
-<!-- @author $Author: weizhuo $ -->
-<!-- @version $Id: tests.xml.bak,v 1.1 2005/01/09 22:15:33 weizhuo Exp $ -->
- <file source-language="EN" target-language="EN-AU" datatype="plaintext" original="articles.php" date="2002-01-25T21:06:01Z" product-name="Articles">
- <body>
- <trans-unit id="1">
- <source>Hello</source>
- <target>Howdy!</target>
- </trans-unit>
- </body>
- </file>
-</xliff>
diff --git a/tests/UnitTests/framework/I18N/messages/messages.db b/tests/UnitTests/framework/I18N/messages/messages.db Binary files differdeleted file mode 100644 index 73b518c5..00000000 --- a/tests/UnitTests/framework/I18N/messages/messages.db +++ /dev/null diff --git a/tests/UnitTests/framework/I18N/messages/messages.db.bak b/tests/UnitTests/framework/I18N/messages/messages.db.bak Binary files differdeleted file mode 100644 index 73b518c5..00000000 --- a/tests/UnitTests/framework/I18N/messages/messages.db.bak +++ /dev/null diff --git a/tests/UnitTests/framework/I18N/messages/messages.en.mo b/tests/UnitTests/framework/I18N/messages/messages.en.mo Binary files differdeleted file mode 100644 index db8838e3..00000000 --- a/tests/UnitTests/framework/I18N/messages/messages.en.mo +++ /dev/null diff --git a/tests/UnitTests/framework/I18N/messages/messages.en.po b/tests/UnitTests/framework/I18N/messages/messages.en.po deleted file mode 100644 index 9299045c..00000000 --- a/tests/UnitTests/framework/I18N/messages/messages.en.po +++ /dev/null @@ -1,15 +0,0 @@ -msgid ""
-msgstr ""
-"Project-Id-Version: I18N Tests\n"
-"POT-Creation-Date: \n"
-"PO-Revision-Date: 2004-12-25 12:26+1000\n"
-"Last-Translator: \n"
-"Language-Team: Wei Zhuo\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=utf-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-"X-Poedit-Basepath: F:\\www\\prado\\framework\\I18N\\tests\n"
-
-msgid "Hello"
-msgstr "Hello :)"
-
diff --git a/tests/UnitTests/framework/I18N/messages/messages.en.xml b/tests/UnitTests/framework/I18N/messages/messages.en.xml deleted file mode 100644 index c3eb465b..00000000 --- a/tests/UnitTests/framework/I18N/messages/messages.en.xml +++ /dev/null @@ -1,19 +0,0 @@ -<?xml version="1.0"?>
-<xliff version="1.0">
-<!-- @author $Author: weizhuo $ -->
-<!-- @version $Id: messages.en.xml,v 1.1 2004/12/28 09:28:07 weizhuo Exp $ -->
- <file
- source-language="EN"
- target-language="EN"
- datatype="plaintext"
- original="articles.php"
- date="2002-01-25T21:06:00Z"
- product-name="Articles">
- <body>
- <trans-unit id='1'>
- <source>Hello</source>
- <target>Hello :)</target>
- </trans-unit>
- </body>
- </file>
-</xliff>
\ No newline at end of file diff --git a/tests/UnitTests/framework/I18N/messages/messages.en_AU.mo b/tests/UnitTests/framework/I18N/messages/messages.en_AU.mo Binary files differdeleted file mode 100644 index f4822800..00000000 --- a/tests/UnitTests/framework/I18N/messages/messages.en_AU.mo +++ /dev/null diff --git a/tests/UnitTests/framework/I18N/messages/messages.en_AU.mo.bak b/tests/UnitTests/framework/I18N/messages/messages.en_AU.mo.bak Binary files differdeleted file mode 100644 index f4822800..00000000 --- a/tests/UnitTests/framework/I18N/messages/messages.en_AU.mo.bak +++ /dev/null diff --git a/tests/UnitTests/framework/I18N/messages/messages.en_AU.po b/tests/UnitTests/framework/I18N/messages/messages.en_AU.po deleted file mode 100644 index d795be2b..00000000 --- a/tests/UnitTests/framework/I18N/messages/messages.en_AU.po +++ /dev/null @@ -1,18 +0,0 @@ -msgid ""
-msgstr ""
-"Project-Id-Version: I18N Tests\n"
-"POT-Creation-Date: \n"
-"PO-Revision-Date: 2005-01-09 14:02:25\n"
-"Last-Translator: \n"
-"Language-Team: Wei Zhuo\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=utf-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-"X-Poedit-Basepath: F:\\www\\prado\\framework\\I18N\\ ests\n"
-
-msgid "Hello"
-msgstr "G'day Mate!"
-
-msgid "Welcome"
-msgstr "Welcome Mate!"
-
diff --git a/tests/UnitTests/framework/I18N/messages/messages.en_AU.po.bak b/tests/UnitTests/framework/I18N/messages/messages.en_AU.po.bak deleted file mode 100644 index d795be2b..00000000 --- a/tests/UnitTests/framework/I18N/messages/messages.en_AU.po.bak +++ /dev/null @@ -1,18 +0,0 @@ -msgid ""
-msgstr ""
-"Project-Id-Version: I18N Tests\n"
-"POT-Creation-Date: \n"
-"PO-Revision-Date: 2005-01-09 14:02:25\n"
-"Last-Translator: \n"
-"Language-Team: Wei Zhuo\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=utf-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-"X-Poedit-Basepath: F:\\www\\prado\\framework\\I18N\\ ests\n"
-
-msgid "Hello"
-msgstr "G'day Mate!"
-
-msgid "Welcome"
-msgstr "Welcome Mate!"
-
diff --git a/tests/UnitTests/framework/I18N/messages/messages.en_AU.xml b/tests/UnitTests/framework/I18N/messages/messages.en_AU.xml deleted file mode 100644 index cb4c4255..00000000 --- a/tests/UnitTests/framework/I18N/messages/messages.en_AU.xml +++ /dev/null @@ -1,17 +0,0 @@ -<?xml version="1.0"?>
-<xliff version="1.0">
-<!-- @author $Author: weizhuo $ -->
-<!-- @version $Id: messages.en_AU.xml.bak,v 1.1 2005/01/09 22:15:32 weizhuo Exp $ -->
- <file source-language="EN" target-language="EN-AU" datatype="plaintext" original="articles.php" date="2002-01-25T21:06:01Z" product-name="Articles">
- <body>
- <trans-unit id="1">
- <source>Hello</source>
- <target>G'day Mate!</target>
- </trans-unit>
- <trans-unit id="2">
- <source>Welcome</source>
- <target>Welcome Mate!</target>
- </trans-unit>
- </body>
- </file>
-</xliff>
diff --git a/tests/UnitTests/framework/I18N/messages/messages.en_AU.xml.bak b/tests/UnitTests/framework/I18N/messages/messages.en_AU.xml.bak deleted file mode 100644 index cb4c4255..00000000 --- a/tests/UnitTests/framework/I18N/messages/messages.en_AU.xml.bak +++ /dev/null @@ -1,17 +0,0 @@ -<?xml version="1.0"?>
-<xliff version="1.0">
-<!-- @author $Author: weizhuo $ -->
-<!-- @version $Id: messages.en_AU.xml.bak,v 1.1 2005/01/09 22:15:32 weizhuo Exp $ -->
- <file source-language="EN" target-language="EN-AU" datatype="plaintext" original="articles.php" date="2002-01-25T21:06:01Z" product-name="Articles">
- <body>
- <trans-unit id="1">
- <source>Hello</source>
- <target>G'day Mate!</target>
- </trans-unit>
- <trans-unit id="2">
- <source>Welcome</source>
- <target>Welcome Mate!</target>
- </trans-unit>
- </body>
- </file>
-</xliff>
diff --git a/tests/UnitTests/framework/I18N/messages/messages.mo b/tests/UnitTests/framework/I18N/messages/messages.mo Binary files differdeleted file mode 100644 index 12cf1ff8..00000000 --- a/tests/UnitTests/framework/I18N/messages/messages.mo +++ /dev/null diff --git a/tests/UnitTests/framework/I18N/messages/messages.po b/tests/UnitTests/framework/I18N/messages/messages.po deleted file mode 100644 index ade60e01..00000000 --- a/tests/UnitTests/framework/I18N/messages/messages.po +++ /dev/null @@ -1,18 +0,0 @@ -msgid ""
-msgstr ""
-"Project-Id-Version: I18N Tests\n"
-"POT-Creation-Date: \n"
-"PO-Revision-Date: 2004-12-25 12:25+1000\n"
-"Last-Translator: \n"
-"Language-Team: Wei Zhuo\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=utf-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-"X-Poedit-Basepath: F:\\www\\prado\\framework\\I18N\\tests\n"
-
-msgid "Hello"
-msgstr "Hello World"
-
-msgid "Welcome"
-msgstr "Welcome!"
-
diff --git a/tests/UnitTests/framework/I18N/messages/messages.xml b/tests/UnitTests/framework/I18N/messages/messages.xml deleted file mode 100644 index 5fe588b6..00000000 --- a/tests/UnitTests/framework/I18N/messages/messages.xml +++ /dev/null @@ -1,23 +0,0 @@ -<?xml version="1.0"?>
-<xliff version="1.0">
-<!-- @author $Author: weizhuo $ -->
-<!-- @version $Id: messages.xml,v 1.1 2004/12/28 09:28:07 weizhuo Exp $ -->
- <file
- source-language="EN"
- target-language="EN"
- datatype="plaintext"
- original="articles.php"
- date="2002-01-25T21:06:00Z"
- product-name="Articles">
- <body>
- <trans-unit id='1'>
- <source>Hello</source>
- <target>Hello World</target>
- </trans-unit>
- <trans-unit id='2'>
- <source>Welcome</source>
- <target>Welcome!</target>
- </trans-unit>
- </body>
- </file>
-</xliff>
\ No newline at end of file diff --git a/tests/UnitTests/framework/I18N/messages/messages_mysql.sql b/tests/UnitTests/framework/I18N/messages/messages_mysql.sql deleted file mode 100644 index 811010c4..00000000 --- a/tests/UnitTests/framework/I18N/messages/messages_mysql.sql +++ /dev/null @@ -1,69 +0,0 @@ -# phpMyAdmin SQL Dump
-# version 2.5.5-rc2
-# http://www.phpmyadmin.net
-#
-# Host: localhost
-# Generation Time: Jan 09, 2005 at 09:24 PM
-# Server version: 4.0.17
-# PHP Version: 5.0.2
-#
-# Database : `messages`
-#
-
-# --------------------------------------------------------
-
-#
-# Table structure for table `catalogue`
-#
-
-DROP TABLE IF EXISTS catalogue;
-CREATE TABLE catalogue (
- cat_id int(11) NOT NULL auto_increment,
- name varchar(100) NOT NULL default '',
- source_lang varchar(100) NOT NULL default '',
- target_lang varchar(100) NOT NULL default '',
- date_created int(11) NOT NULL default '0',
- date_modified int(11) NOT NULL default '0',
- author varchar(255) NOT NULL default '',
- PRIMARY KEY (cat_id)
-) TYPE=MyISAM AUTO_INCREMENT=7 ;
-
-
-INSERT INTO catalogue VALUES ('1', 'messages', '', '', '', '1103936017', '');
-INSERT INTO catalogue VALUES ('2', 'messages.en', '', '', '', '1103936017', '');
-INSERT INTO catalogue VALUES ('3', 'messages.en_AU', '', '', '', '1105250301', '');
-INSERT INTO catalogue VALUES ('4', 'tests', '', '', '', '1103936017', '');
-INSERT INTO catalogue VALUES ('5', 'tests.en', '', '', '', '1103936017', '');
-INSERT INTO catalogue VALUES ('6', 'tests.en_AU', '', '', '', '1103936017', '');
-
-# --------------------------------------------------------
-
-#
-# Table structure for table `trans_unit`
-#
-
-DROP TABLE IF EXISTS trans_unit;
-CREATE TABLE trans_unit (
- msg_id int(11) NOT NULL auto_increment,
- cat_id int(11) NOT NULL default '1',
- id varchar(255) NOT NULL default '',
- source text NOT NULL,
- target text NOT NULL,
- comments text NOT NULL,
- date_added int(11) NOT NULL default '0',
- date_modified int(11) NOT NULL default '0',
- author varchar(255) NOT NULL default '',
- translated tinyint(1) NOT NULL default '0',
- PRIMARY KEY (msg_id)
-) TYPE=MyISAM AUTO_INCREMENT=19 ;
-
-INSERT INTO trans_unit VALUES ('1', '1', '1', 'Hello', 'Hello World', '', '', '', '', '1');
-INSERT INTO trans_unit VALUES ('2', '2', '1', 'Hello', 'Hello :)', '', '', '', '', '0');
-INSERT INTO trans_unit VALUES ('3', '1', '1', 'Welcome', 'Welcome!', '', '', '', '', '0');
-INSERT INTO trans_unit VALUES ('4', '3', '1', 'Hello', 'G''day Mate!', '', '', '', '', '0');
-INSERT INTO trans_unit VALUES ('5', '3', '2', 'Welcome', 'Welcome Mate!', '', '', '', '', '0');
-INSERT INTO trans_unit VALUES ('13', '4', '1', 'Goodbye', 'Aloha!', '', '', '', '', '0');
-INSERT INTO trans_unit VALUES ('14', '4', '2', 'Welcome', 'Ho Ho!', '', '', '', '', '0');
-INSERT INTO trans_unit VALUES ('15', '5', '1', 'Hello', 'hello', '', '', '', '', '0');
-INSERT INTO trans_unit VALUES ('16', '5', '2', 'Goodbye', 'Sayonara', '', '', '', '', '0');
-INSERT INTO trans_unit VALUES ('17', '6', '1', 'Hello', 'Howdy!', '', '', '', '', '0');
\ No newline at end of file diff --git a/tests/UnitTests/framework/I18N/messages/tests.en_AU.po b/tests/UnitTests/framework/I18N/messages/tests.en_AU.po deleted file mode 100644 index fda7021d..00000000 --- a/tests/UnitTests/framework/I18N/messages/tests.en_AU.po +++ /dev/null @@ -1,7 +0,0 @@ -msgid ""
-msgstr ""
-"PO-Revision-Date: 2005-01-09 14:17:13\n"
-
-msgid "Testing123"
-msgstr ""
-
diff --git a/tests/UnitTests/framework/I18N/messages/tests.mo b/tests/UnitTests/framework/I18N/messages/tests.mo Binary files differdeleted file mode 100644 index 394b6196..00000000 --- a/tests/UnitTests/framework/I18N/messages/tests.mo +++ /dev/null diff --git a/tests/UnitTests/framework/I18N/messages/tests.po b/tests/UnitTests/framework/I18N/messages/tests.po deleted file mode 100644 index 4f5f3fbc..00000000 --- a/tests/UnitTests/framework/I18N/messages/tests.po +++ /dev/null @@ -1,18 +0,0 @@ -msgid ""
-msgstr ""
-"Project-Id-Version: I18N Tests\n"
-"POT-Creation-Date: \n"
-"PO-Revision-Date: 2005-01-09 14:07+1000\n"
-"Last-Translator: \n"
-"Language-Team: Wei Zhuo\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=utf-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-"X-Poedit-Basepath: F:\\www\\prado\\framework\\I18N\\tests\n"
-
-msgid "Goodbye"
-msgstr "Aloha!"
-
-msgid "Welcome"
-msgstr "Ho Ho!"
-
diff --git a/tests/UnitTests/framework/I18N/messages/tests.xml b/tests/UnitTests/framework/I18N/messages/tests.xml deleted file mode 100644 index 73f404b1..00000000 --- a/tests/UnitTests/framework/I18N/messages/tests.xml +++ /dev/null @@ -1,17 +0,0 @@ -<?xml version="1.0"?>
-<xliff version="1.0">
-<!-- @author $Author: weizhuo $ -->
-<!-- @version $Id: tests.xml,v 1.1 2005/01/09 22:15:32 weizhuo Exp $ -->
- <file source-language="EN" target-language="EN-AU" datatype="plaintext" original="articles.php" date="2002-01-25T21:06:01Z" product-name="Articles">
- <body>
- <trans-unit id="1">
- <source>Goodbye</source>
- <target>Aloha!</target>
- </trans-unit>
- <trans-unit id="2">
- <source>Welcome</source>
- <target>Ho Ho!</target>
- </trans-unit>
- </body>
- </file>
-</xliff>
diff --git a/tests/UnitTests/framework/I18N/testChoiceFormat.php b/tests/UnitTests/framework/I18N/testChoiceFormat.php deleted file mode 100644 index 8cc3f1d3..00000000 --- a/tests/UnitTests/framework/I18N/testChoiceFormat.php +++ /dev/null @@ -1,34 +0,0 @@ -<?php
-Prado::using('System.I18N.core.ChoiceFormat');
-
-class testChoiceFormat extends UnitTestCase
-{
- function testChoiceFormat()
- {
- $this->UnitTestCase();
- }
-
- function testChoices()
- {
- $choice = new ChoiceFormat();
- $string = '[0] are no files |[1] is one file |(1,Inf] are {number} files';
-
- $want = 'are no files';
- $this->assertEqual($want, $choice->format($string, 0));
-
- $want = 'is one file';
- $this->assertEqual($want, $choice->format($string, 1));
-
- $want = 'are {number} files';
- $this->assertEqual($want, $choice->format($string, 5));
-
- $this->assertFalse($choice->format($string, -1));
-
- $string = '{1,2} one two |{3,4} three four |[2,5] two to five inclusive';
- $this->assertEqual($choice->format($string,1),'one two');
- $this->assertEqual($choice->format($string,2.1),'two to five inclusive');
- $this->assertEqual($choice->format($string,3),'three four');
- }
-}
-
-?>
\ No newline at end of file diff --git a/tests/UnitTests/framework/I18N/testCultureInfo.php b/tests/UnitTests/framework/I18N/testCultureInfo.php deleted file mode 100644 index 7e204ede..00000000 --- a/tests/UnitTests/framework/I18N/testCultureInfo.php +++ /dev/null @@ -1,94 +0,0 @@ -<?php
-
-Prado::using('System.I18N.core.CultureInfo');
-
-class testCultureInfo extends UnitTestCase
-{
- protected $culture;
-
- function testCultureInfo()
- {
- $this->UnitTestCase();
- }
-
- function setUp()
- {
- $this->culture = CultureInfo::getInvariantCulture();
- }
-
- function testCultureName()
- {
- $name = 'en';
-
- $this->assertEqual($name, $this->culture->Name);
-
- //the default/invariant culture should be neutral
- $this->assertTrue($this->culture->IsNeutralCulture);
- }
-
- function testCultureList()
- {
- $allCultures = CultureInfo::getCultures();
- $neutralCultures = CultureInfo::getCultures(CultureInfo::NEUTRAL);
- $specificCultures = CultureInfo::getCultures(CultureInfo::SPECIFIC);
-
- //there should be 246 cultures all together.
- $this->assertEqual(count($allCultures),246);
- $this->assertEqual(count($neutralCultures),76);
- $this->assertEqual(count($specificCultures),170);
-
- }
-
- function testParentCultures()
- {
- $zh_CN = new CultureInfo('zh_CN');
- $parent = $zh_CN->Parent;
- $grandparent = $parent->Parent;
-
- $this->assertEqual($zh_CN->Name, 'zh_CN');
- $this->assertEqual($parent->Name, 'zh');
- $this->assertEqual($grandparent->Name, 'en');
- $this->assertEqual($grandparent->Parent->Name, 'en');
- }
-
- function testCountryNames()
- {
- $culture = new CultureInfo('fr_FR');
- $this->assertEqual($culture->Countries['AE'], 'Émirats arabes unis');
- }
-
- function testCurrencies()
- {
- $culture = new CultureInfo('en_AU');
- $au = array('$', 'Australian Dollar');
- $this->assertEqual($au, $culture->Currencies['AUD']);
- }
-
- function testLanguages()
- {
- $culture = new CultureInfo('fr_BE');
- $this->assertEqual($culture->Languages['fr'], 'français');
- }
-
- function testScripts()
- {
- $culture = new CultureInfo('fr');
- $this->assertEqual($culture->Scripts['Armn'], 'arménien');
- }
-
- function testTimeZones()
- {
- $culture = new CultureInfo('fi');
- $zone = array(
- "America/Los_Angeles",
- "Tyynenmeren normaaliaika",
- "PST",
- "Tyynenmeren kesäaika",
- "PDT",
- "Los Angeles");
- $this->assertEqual($culture->TimeZones[1],$zone);
- }
-
-}
-
-?>
\ No newline at end of file diff --git a/tests/UnitTests/framework/I18N/testDateFormat.php b/tests/UnitTests/framework/I18N/testDateFormat.php deleted file mode 100644 index 7e4259d6..00000000 --- a/tests/UnitTests/framework/I18N/testDateFormat.php +++ /dev/null @@ -1,99 +0,0 @@ -<?php
-
-Prado::using('System.I18N.core.DateFormat');
-
-class testDateFormat extends UnitTestCase
-{
- function testDateFormat()
- {
- $this->UnitTestCase();
- }
-
- function testStandardPatterns()
- {
- $dateFormatter = new DateFormat();
-
- $time = @mktime(9, 9, 9, 9, 1, 2004);
- $zone = @date('T', $time);
- //var_dump(date('c',$time));
- //for ShortDatePattern "M/d/yy"
- $this->assertEqual('9/1/04', $dateFormatter->format($time, 'd'));
- //var_dump(date('c',strtotime($dateFormatter->format($time,'d'))));
-
- //for LongDatePattern "MMMM d, yyyy"
- $wants = 'September 1, 2004';
- $this->assertEqual($wants, $dateFormatter->format($time, 'D'));
- //var_dump(date('c',strtotime($dateFormatter->format($time,'D'))));
-
- //for Full date and time "MMMM d, yyyy h:mm a"
- $wants = 'September 1, 2004 9:09 AM';
- $this->assertEqual($wants, $dateFormatter->format($time, 'f'));
- //var_dump(date('c',strtotime($dateFormatter->format($time,'f'))));
-
- //for FullDateTimePattern "MMMM d, yyyy h:mm:ss a z"
- $wants = 'September 1, 2004 9:09:09 AM '.$zone;
- $this->assertEqual($wants, $dateFormatter->format($time, 'F'));
-
- //for General "M/d/yy h:mm a"
- $wants = '9/1/04 9:09 AM';
- $this->assertEqual($wants, $dateFormatter->format($time, 'g'));
- //var_dump(date('c',strtotime($dateFormatter->format($time,'g'))));
-
- //for General "M/d/yy h:mm:ss a z"
- $wants = '9/1/04 9:09:09 AM '.$zone;
- $this->assertEqual($wants, $dateFormatter->format($time, 'G'));
-
- //for MonthDayPattern "MMMM dd" (invariant)
- $wants = 'September 01';
- $this->assertEqual($wants, $dateFormatter->format($time, 'm'));
- //var_dump(date('c',strtotime($dateFormatter->format($time,'m'))));
-
- //for RFC1123Pattern "EEE, dd MMM yyyy HH:mm:ss" (invariant)
- $wants = 'Wed, 01 Sep 2004 09:09:09';
- $this->assertEqual($wants, $dateFormatter->format($time, 'r'));
- //var_dump(date('c',strtotime($dateFormatter->format($time,'r'))));
-
- //for SortableDateTimePattern "yyyy-MM-ddTHH:mm:ss" (invariant)
- $wants = '2004-09-01T09:09:09';
- $this->assertEqual($wants, $dateFormatter->format($time, 's'));
- //var_dump(date('c',strtotime($dateFormatter->format($time,'s'))));
-
- //for ShortTimePattern "H:mm a"
- $wants = '9:09 AM';
- $this->assertEqual($wants, $dateFormatter->format($time, 't'));
- //(date('c',strtotime($dateFormatter->format($time,'t'))));
-
- //for LongTimePattern "H:mm:ss a z"
- $wants = '9:09:09 AM '.$zone;
- $this->assertEqual($wants, $dateFormatter->format($time, 'T'));
-
- //for UniversalSortableDateTimePattern "yyyy-MM-dd HH:mm:ss z"
- //(invariant)
- $wants = '2004-09-01 09:09:09 '.$zone;
- $this->assertEqual($wants, $dateFormatter->format($time, 'u'));
-
- //for Full date and time "EEEE dd MMMM yyyy HH:mm:ss" (invariant)
- $wants = 'Wednesday 01 September 2004 09:09:09';
- $this->assertEqual($wants, $dateFormatter->format($time, 'U'));
- //var_dump(date('c',strtotime($dateFormatter->format($time,'U'))));
-
- //for YearMonthPattern "yyyy MMMM" (invariant)
- $wants = '2004 September';
- $this->assertEqual($wants, $dateFormatter->format($time, 'y'));
- //var_dump(date('c',strtotime($dateFormatter->format($time,'y'))));
- }
-
- function testCustomPatterns()
- {
- $dateFormatter = new DateFormat();
-
- $time = @mktime(9, 9, 9, 9, 1, 2004);
-
- $pattern = "'Hello' EEEE, 'it should be' MMM yyyy HH:mm:ss!!!";
- $wants = 'Hello Wednesday, it should be Sep 2004 09:09:09!!!';
- $this->assertEqual($wants, $dateFormatter->format($time, $pattern));
-
- }
-}
-
-?>
\ No newline at end of file diff --git a/tests/UnitTests/framework/I18N/testMessageFormat.php b/tests/UnitTests/framework/I18N/testMessageFormat.php deleted file mode 100644 index 74b6f23f..00000000 --- a/tests/UnitTests/framework/I18N/testMessageFormat.php +++ /dev/null @@ -1,13 +0,0 @@ -<?php
-
-Prado::using('System.I18N.core.MessageFormat');
-
-class testMessageFormat extends UnitTestCase
-{
- function testMessageFormat()
- {
- $this->UnitTestCase();
- }
-}
-
-?>
\ No newline at end of file diff --git a/tests/UnitTests/framework/I18N/testMessageFormat_SQLite.php b/tests/UnitTests/framework/I18N/testMessageFormat_SQLite.php deleted file mode 100644 index 5b75a0a7..00000000 --- a/tests/UnitTests/framework/I18N/testMessageFormat_SQLite.php +++ /dev/null @@ -1,142 +0,0 @@ -<?php
-
-Prado::using('System.I18N.core.MessageFormat');
-
-class testMessageFormat_SQLite extends UnitTestCase
-{
-
- protected $type = 'SQLite';
- protected $source = 'sqlite:///./messages/messages.db';
- protected $tmp;
- protected $dir;
-
- function testMessageFormat_SQLite()
- {
- $this->UnitTestCase();
- $this->dir = dirname(__FILE__);
- $this->tmp = $this->dir.'/tmp/';
- $this->source = "sqlite:///{$this->dir}/messages/messages.db";
-
- }
-
- function test1()
- {
- $source = MessageSource::factory($this->type, $this->source);
- $source->setCulture('en_AU');
- $source->setCache(new MessageCache($this->tmp));
-
- $formatter = new MessageFormat($source);
- $this->assertEqual($formatter->format('Hello'),'G\'day Mate!');
-
- $this->assertEqual($formatter->format('Goodbye'), 'Goodbye');
-
- $formatter->setUntranslatedPS(array('[T]','[/T]'));
- $this->assertEqual($formatter->format('Hi'), '[T]Hi[/T]');
-
- $source->getCache()->clear();
-
- //save the untranslated
-
- }
-
- function getAllContents($file)
- {
- $db = sqlite_open($file);
- $rs = sqlite_query('SELECT * FROM trans_unit',$db);
- $result = '';
- while($row = sqlite_fetch_array($rs,SQLITE_NUM))
- {
- $result .= implode(', ',$row)."\n";
- }
- sqlite_close($db);
- return $result;
- }
-
- function testSaveUpdateDelete()
- {
- $backup = $this->dir.'/messages/messages.db.bak';
- $dbfile = $this->dir.'/messages/messages.db';
-
- //restore using the back file
- copy($backup,$dbfile);
-
- //test that the back file doesn't contain the 'Testing123' string.
- $contents = $this->getAllContents($dbfile);
- $this->assertNoUnwantedPattern('/Testing123/',$contents);
-
- $source = MessageSource::factory($this->type, $this->source);
- $source->setCulture('en_AU');
- $source->setCache(new MessageCache($this->tmp));
-
- $formatter = new MessageFormat($source);
-
- $formatter->setUntranslatedPS(array('[t]','[/t]'));
-
- //add a untranslated string
- $this->assertEqual($formatter->format('Testing123'), '[t]Testing123[/t]');
-
- //save it
- $this->assertTrue($formatter->getSource()->save());
-
- //check the contents
- $contents = $this->getAllContents($dbfile);
- $this->assertWantedPattern('/Testing123/',$contents);
-
- //testing for update.
- $this->assertTrue($formatter->getSource()->update(
- 'Testing123', '123Test', 'update comments'));
-
- $contents = $this->getAllContents($dbfile);
- $this->assertWantedPattern('/123Test/',$contents);
- $this->assertWantedPattern('/update comments/',$contents);
-
- //var_dump(htmlspecialchars($contents));
-
- //now doing some delete
- //doesn't detect missing source
- $this->assertTrue($formatter->getSource()->delete('Test123'));
- $this->assertTrue($formatter->getSource()->delete('Testing123'));
-
- $contents = $this->getAllContents($dbfile);
- $this->assertNoUnwantedPattern('/Testing123/',$contents);
-
- //restore using the backup file.
- copy($backup,$dbfile);
- $source->getCache()->clear();
- }
-
- function testCatalogueList()
- {
- $source = MessageSource::factory($this->type, $this->source);
- $result[] = array('messages',NULL);
- $result[] = array('messages', 'en');
- $result[] = array('messages','en_AU');
- $result[] = array('tests',NULL);
- $result[] = array('tests','en');
- $result[] = array('tests','en_AU');
-
- $this->assertEqual($result, $source->catalogues());
- }
-
- function testAltCatalogue()
- {
- $source = MessageSource::factory($this->type, $this->source);
- $source->setCulture('en_AU');
- $source->setCache(new MessageCache($this->tmp));
-
- $formatter = new MessageFormat($source);
- $formatter->Catalogue = 'tests';
-
- //from a different catalogue
- $this->assertEqual($formatter->format('Hello'), 'Howdy!');
- $this->assertEqual($formatter->format('Welcome'), 'Ho Ho!');
- $this->assertEqual($formatter->format('Goodbye'), 'Sayonara');
-
- //switch to 'messages' catalogue
- $this->assertEqual($formatter->format('Hello',null,'messages'),'G\'day Mate!');
-
- $source->getCache()->clear();
- }
-}
-
-?>
\ No newline at end of file diff --git a/tests/UnitTests/framework/I18N/testMessageFormat_XLIFF.php b/tests/UnitTests/framework/I18N/testMessageFormat_XLIFF.php deleted file mode 100644 index 4072c4ce..00000000 --- a/tests/UnitTests/framework/I18N/testMessageFormat_XLIFF.php +++ /dev/null @@ -1,174 +0,0 @@ -<?php
-
-Prado::using('System.I18N.core.MessageFormat');
-
-class testMessageFormat_XLIFF extends UnitTestCase
-{
- protected $type = 'XLIFF';
- protected $source = './messages';
- protected $tmp;
- protected $dir;
-
- function testMessageFormat_XLIFF()
- {
- $this->UnitTestCase();
- $this->dir = dirname(__FILE__);
- $this->tmp = $this->dir.'/tmp/';
- $this->source = $this->dir.'/messages';
-
- }
-
- function test1()
- {
- $source = MessageSource::factory($this->type, $this->source);
- $source->setCulture('en_AU');
- $source->setCache(new MessageCache($this->tmp));
-
- $formatter = new MessageFormat($source);
- $this->assertEqual($formatter->format('Hello'),'G\'day Mate!');
-
- $this->assertEqual($formatter->format('Goodbye'), 'Goodbye');
-
- $formatter->setUntranslatedPS(array('[T]','[/T]'));
- $this->assertEqual($formatter->format('Hi'), '[T]Hi[/T]');
-
- //clear cache
- $source->getCache()->clear();
-
- }
-
- function testSaveUpdateDelete()
- {
- $backup = $this->dir.'/messages/messages.en_AU.xml.bak';
- $xmlfile = $this->dir.'/messages/messages.en_AU.xml';
-
- //restore using the back file
- copy($backup,$xmlfile);
-
- //test that the back file doesn't contain the 'Testing123' string.
- $contents = file_get_contents($xmlfile);
- $this->assertNoUnwantedPattern('/Testing123/',$contents);
-
- $source = MessageSource::factory($this->type, $this->source);
- $source->setCulture('en_AU');
- $source->setCache(new MessageCache($this->tmp));
-
- $formatter = new MessageFormat($source);
-
- //add a untranslated string
- $this->assertEqual($formatter->format('Testing123'), 'Testing123');
-
- //save it
- $this->assertTrue($formatter->getSource()->save());
-
- //check the contents
- $contents = file_get_contents($xmlfile);
- $this->assertWantedPattern('/Testing123/',$contents);
-
- //testing for update.
- $this->assertTrue($formatter->getSource()->update(
- 'Testing123', '123Test', 'update comments'));
-
- $contents = file_get_contents($xmlfile);
- $this->assertWantedPattern('/123Test/',$contents);
- $this->assertWantedPattern('/update comments/',$contents);
-
- //var_dump(htmlspecialchars($contents));
-
- //now doing some delete
- $this->assertFalse($formatter->getSource()->delete('Test123'));
- $this->assertTrue($formatter->getSource()->delete('Testing123'));
-
- $contents = file_get_contents($xmlfile);
- $this->assertNoUnwantedPattern('/Testing123/',$contents);
-
- //restore using the backup file.
- copy($backup,$xmlfile);
-
- $source->getCache()->clear();
- }
-
- function testCatalogueList()
- {
- $source = MessageSource::factory($this->type, $this->source);
- $result[] = array('messages',NULL);
- $result[] = array('messages', 'en');
- $result[] = array('messages','en_AU');
- $result[] = array('tests',NULL);
- $result[] = array('tests','en');
- $result[] = array('tests','en_AU');
-
- $this->assertEqual($result, $source->catalogues());
- }
-
- function testAltCatalogue()
- {
- $source = MessageSource::factory($this->type, $this->source);
- $source->setCulture('en_AU');
- $source->setCache(new MessageCache($this->tmp));
-
- $formatter = new MessageFormat($source);
- $formatter->Catalogue = 'tests';
-
- //from a different catalogue
- $this->assertEqual($formatter->format('Hello'), 'Howdy!');
- $this->assertEqual($formatter->format('Welcome'), 'Ho Ho!');
- $this->assertEqual($formatter->format('Goodbye'), 'Sayonara');
-
- //switch to 'messages' catalogue
- $this->assertEqual($formatter->format('Hello',null,'messages'),'G\'day Mate!');
-
- $source->getCache()->clear();
- }
-
- function testDirectoryTypeSaveUpdateDelete()
- {
- $backup = $this->dir.'/messages/en_AU/tests.xml.bak';
- $xmlfile = $this->dir.'/messages/en_AU/tests.xml';
-
- //restore using the back file
- copy($backup,$xmlfile);
-
- //test that the back file doesn't contain the 'Testing123' string.
- $contents = file_get_contents($xmlfile);
- $this->assertNoUnwantedPattern('/Testing123/',$contents);
-
- $source = MessageSource::factory($this->type, $this->source);
- $source->setCulture('en_AU');
- $source->setCache(new MessageCache($this->tmp));
-
- $formatter = new MessageFormat($source);
-
- //add a untranslated string, note, doesn't matter which catalogue
- $this->assertEqual($formatter->format('Testing123'), 'Testing123');
-
- //save it to the 'tests' catalgoue
- $this->assertTrue($formatter->getSource()->save('tests'));
-
- //check the contents
- $contents = file_get_contents($xmlfile);
- $this->assertWantedPattern('/Testing123/',$contents);
-
- //testing for update. Update it to the 'tests' catalogue
- $this->assertTrue($formatter->getSource()->update(
- 'Testing123', '123Test', 'update comments','tests'));
-
- $contents = file_get_contents($xmlfile);
- $this->assertWantedPattern('/123Test/',$contents);
- $this->assertWantedPattern('/update comments/',$contents);
-
- //now doing some delete from the 'tests' catalogue
- $this->assertFalse($formatter->getSource()->delete('Test123','tests'));
- $this->assertTrue($formatter->getSource()->delete('Testing123','tests'));
-
- $contents = file_get_contents($xmlfile);
- $this->assertNoUnwantedPattern('/Testing123/',$contents);
-
- //restore using the backup file.
- copy($backup,$xmlfile);
-
- $source->getCache()->clear();
- }
-}
-
-?>
\ No newline at end of file diff --git a/tests/UnitTests/framework/I18N/testMessageFormat_gettext.php b/tests/UnitTests/framework/I18N/testMessageFormat_gettext.php deleted file mode 100644 index 6fa00e80..00000000 --- a/tests/UnitTests/framework/I18N/testMessageFormat_gettext.php +++ /dev/null @@ -1,176 +0,0 @@ -<?php
-
-Prado::using('System.I18N.core.MessageFormat');
-
-class testMessageFormat_gettext extends UnitTestCase
-{
- protected $type = 'gettext';
- protected $source;
- protected $tmp;
- protected $dir;
-
- function testMessageFormat_gettext()
- {
- $this->UnitTestCase();
- $this->dir = dirname(__FILE__);
- $this->tmp = $this->dir.'/tmp/';
- $this->source = $this->dir.'/messages';
- }
-
- function test1()
- {
- $source = MessageSource::factory($this->type, $this->source);
- $source->setCulture('en_AU');
- $source->setCache(new MessageCache($this->tmp));
-
- $formatter = new MessageFormat($source);
- $this->assertEqual($formatter->format('Hello'),'G\'day Mate!');
-
- $this->assertEqual($formatter->format('Goodbye'), 'Goodbye');
-
- $formatter->setUntranslatedPS(array('[T]','[/T]'));
- $this->assertEqual($formatter->format('Hi'), '[T]Hi[/T]');
-
- $source->getCache()->clear();
- }
-
- function testSaveUpdateDelete()
- {
- $MObackup = $this->dir.'/messages/messages.en_AU.mo.bak';
- $MOfile = $this->dir.'/messages/messages.en_AU.mo';
- $PObackup = $this->dir.'/messages/messages.en_AU.po.bak';
- $POfile = $this->dir.'/messages/messages.en_AU.po';
-
- //restore using the back file
- copy($MObackup,$MOfile);
- copy($PObackup,$POfile);
-
- //test that the back file doesn't contain the 'Testing123' string.
- $this->assertNoUnwantedPattern('/Testing123/',file_get_contents($MOfile));
- $this->assertNoUnwantedPattern('/Testing123/',file_get_contents($POfile));
-
- $source = MessageSource::factory($this->type, $this->source);
- $source->setCulture('en_AU');
- $source->setCache(new MessageCache($this->tmp));
-
- $formatter = new MessageFormat($source);
-
- //add a untranslated string
- $this->assertEqual($formatter->format('Testing123'), 'Testing123');
-
- //save it
- $this->assertTrue($formatter->getSource()->save());
-
- //check the contents
- //$this->assertWantedPattern('/Testing123/',file_get_contents($MOfile));
- $this->assertWantedPattern('/Testing123/',file_get_contents($POfile));
-
- //testing for update.
- $this->assertTrue($formatter->getSource()->update(
- 'Testing123', '123Test', 'update comments'));
-
- $this->assertWantedPattern('/123Test/',file_get_contents($MOfile));
-
-
- //var_dump(htmlspecialchars($contents));
-
- //now doing some delete
- $this->assertFalse($formatter->getSource()->delete('Test123'));
- $this->assertTrue($formatter->getSource()->delete('Testing123'));
-
- $this->assertNoUnwantedPattern('/Testing123/',file_get_contents($MOfile));
- $this->assertNoUnwantedPattern('/Testing123/',file_get_contents($POfile));
-
- //restore using the backup file.
- copy($MObackup,$MOfile);
- copy($PObackup,$POfile);
-
- $source->getCache()->clear();
- }
-
- function testCatalogueList()
- {
- $source = MessageSource::factory($this->type, $this->source);
- $result[] = array('messages',NULL);
- $result[] = array('messages', 'en');
- $result[] = array('messages','en_AU');
- $result[] = array('tests',NULL);
- $result[] = array('tests','en');
- $result[] = array('tests','en_AU');
-
- $this->assertEqual($result, $source->catalogues());
- }
-
- function testAltCatalogue()
- {
- $source = MessageSource::factory($this->type, $this->source);
- $source->setCulture('en_AU');
- $source->setCache(new MessageCache($this->tmp));
-
- $formatter = new MessageFormat($source);
- $formatter->Catalogue = 'tests';
-
- //from a different catalogue
- $this->assertEqual($formatter->format('Hello'), 'Howdy!');
- $this->assertEqual($formatter->format('Welcome'), 'Ho Ho!');
- $this->assertEqual($formatter->format('Goodbye'), 'Sayonara');
-
- //switch to 'messages' catalogue
- $this->assertEqual($formatter->format('Hello',null,'messages'),'G\'day Mate!');
-
- $source->getCache()->clear();
- }
-
- function testDirectoryTypeSaveUpdateDelete()
- {
- $MObackup = $this->dir.'/messages/en_AU/tests.mo.bak';
- $MOfile = $this->dir.'/messages/en_AU/tests.mo';
- $PObackup = $this->dir.'/messages/en_AU/tests.po.bak';
- $POfile = $this->dir.'/messages/en_AU/tests.po';
-
- //restore using the back file
- copy($MObackup,$MOfile);
- copy($PObackup,$POfile);
-
- //test that the back file doesn't contain the 'Testing123' string.
- $this->assertNoUnwantedPattern('/Testing123/',file_get_contents($MOfile));
- $this->assertNoUnwantedPattern('/Testing123/',file_get_contents($POfile));
-
- $source = MessageSource::factory($this->type, $this->source);
- $source->setCulture('en_AU');
- $source->setCache(new MessageCache($this->tmp));
-
- $formatter = new MessageFormat($source);
-
- //add a untranslated string, note, doesn't matter which catalogue
- $this->assertEqual($formatter->format('Testing123'), 'Testing123');
-
- //save it to the 'tests' catalgoue
- $this->assertTrue($formatter->getSource()->save('tests'));
-
- //check the contents
- //$this->assertWantedPattern('/Testing123/',file_get_contents($MOfile));
- $this->assertWantedPattern('/Testing123/',file_get_contents($POfile));
-
- //testing for update. Update it to the 'tests' catalogue
- $this->assertTrue($formatter->getSource()->update(
- 'Testing123', '123Test', 'update comments','tests'));
-
- $this->assertWantedPattern('/123Test/',file_get_contents($MOfile));
-
- //now doing some delete from the 'tests' catalogue
- $this->assertFalse($formatter->getSource()->delete('Test123','tests'));
- $this->assertTrue($formatter->getSource()->delete('Testing123','tests'));
-
- $this->assertNoUnwantedPattern('/Testing123/',file_get_contents($MOfile));
- $this->assertNoUnwantedPattern('/Testing123/',file_get_contents($POfile));
-
- //restore using the backup file.
- copy($MObackup,$MOfile);
- copy($PObackup,$POfile);
-
- $source->getCache()->clear();
- }
-}
-
-?>
\ No newline at end of file diff --git a/tests/UnitTests/framework/I18N/testNumberFormat.php b/tests/UnitTests/framework/I18N/testNumberFormat.php deleted file mode 100644 index 48342d9c..00000000 --- a/tests/UnitTests/framework/I18N/testNumberFormat.php +++ /dev/null @@ -1,113 +0,0 @@ -<?php
-
-//NOTE: This page require UTF-8 aware editors
-
-Prado::using('System.I18N.core.NumberFormat');
-
-class testNumberFormat extends UnitTestCase
-{
- function testNumberFormat()
- {
- $this->UnitTestCase();
- }
-
- function testDefaultFormats()
- {
- $formatter = new NumberFormat();
- $number = '123456789.125156';
- $wanted = '123,456,789.125156';
- $this->assertEqual($wanted, $formatter->format($number));
-
- //currency
- $wanted = 'US$123,456,789.13';
- $this->assertEqual($wanted, $formatter->format($number,'c'));
- }
-
- function testLocalizedCurrencyFormats()
- {
- $fr = new NumberFormat('fr');
- $de = new NumberFormat('de');
- $ja = new NumberFormat('ja_JP');
-
- $number = '123456789.125156';
-
- //french
- $wanted = '123 456 789,13 F';
- $this->assertEqual($wanted, $fr->format($number,'c','FRF'));
-
- //german
- $wanted = 'DES 123.456.789,13';
- $this->assertEqual($wanted, $de->format($number,'c','DES'));
-
- //japanese
- $wanted = '¥123,456,789';
- $this->assertEqual($wanted, $ja->format($number,'c','JPY'));
-
- //custom/unkown currency
- $wanted = 'DLL123,456,789';
- $this->assertEqual($wanted, $ja->format($number,'c','DLL'));
- }
-
- function testCustomFormat()
- {
- $formatter = new NumberFormat();
- $number = '123456789.125156';
-
- //primay and secondary grouping test
- $pattern = '#,###,##.###';
- $wanted = '1,234,567,89.125156';
- $this->assertEqual($wanted, $formatter->format($number, $pattern));
-
- //4 digits grouping test
- $pattern = '#,####.###';
- $wanted = '1,2345,6789.125156';
- $this->assertEqual($wanted, $formatter->format($number, $pattern));
-
- //custom percentage
- $pattern = '#,###.00%';
- $wanted = '123,456,789.13%';
- $this->assertEqual($wanted, $formatter->format($number, $pattern));
- }
-
- function testPercentageFormat()
- {
- $formatter = new NumberFormat();
- $number = '0.125156';
- $wanted = '12%';
- $this->assertEqual($wanted, $formatter->format($number, 'p'));
- }
-
- function testQuotes()
- {
- $formatter = new NumberFormat();
- $number = '123456789.125156';
-
- $pattern = "# o'clock";
- $wanted = "123456789 o'clock";
- $this->assertEqual($wanted, $formatter->format($number, $pattern));
-
- }
-
- function testPadding()
- {
- $formatter = new NumberFormat();
- $number = '5';
-
- $pattern = '0000';
- $wanted = '0005';
-
- //this should fail!!!
- $this->assertEqual($wanted, $formatter->format($number, $pattern));
- }
-
- function testNegativeValue()
- {
- $formatter = new NumberFormat();
- $number = "-1.2";
-
- $wanted = "-1.2";
- $this->assertEqual($wanted, $formatter->format($number));
- }
-}
-
-?>
\ No newline at end of file diff --git a/tests/UnitTests/framework/I18N/testNumberFormatInfo.php b/tests/UnitTests/framework/I18N/testNumberFormatInfo.php deleted file mode 100644 index 0b0a3140..00000000 --- a/tests/UnitTests/framework/I18N/testNumberFormatInfo.php +++ /dev/null @@ -1,105 +0,0 @@ -<?php
-
-//NOTE: This page require UTF-8 aware editors
-
-Prado::using('System.I18N.core.NumberFormatInfo');
-
-class testNumberFormatInfo extends UnitTestCase
-{
- function testNumberFormatInfo()
- {
- $this->UnitTestCase();
- }
-
- function testCurrencyPatterns()
- {
- $numberInfo = NumberFormatInfo::getCurrencyInstance();
-
- //there should be 2 decimal places.
- $this->assertEqual($numberInfo->DecimalDigits,2);
-
- $this->assertEqual($numberInfo->DecimalSeparator,'.');
-
- $this->assertEqual($numberInfo->GroupSeparator,',');
-
- //there should be only 1 grouping of size 3
- $groupsize = array(3,false);
- $this->assertEqual($numberInfo->GroupSizes, $groupsize);
-
- //the default negative pattern prefix and postfix
- $negPattern = array('-¤','');
- $this->assertEqual($numberInfo->NegativePattern, $negPattern);
-
- //the default positive pattern prefix and postfix
- $negPattern = array('¤','');
- $this->assertEqual($numberInfo->PositivePattern, $negPattern);
-
- //the default currency symbol
- $this->assertEqual($numberInfo->CurrencySymbol, 'US$');
-
- $this->assertEqual($numberInfo->getCurrencySymbol('JPY'), '¥');
-
- $this->assertEqual($numberInfo->NegativeInfinitySymbol, '-∞');
-
- $this->assertEqual($numberInfo->PositiveInfinitySymbol, '+∞');
-
- $this->assertEqual($numberInfo->NegativeSign, '-');
-
- $this->assertEqual($numberInfo->PositiveSign, '+');
-
- $this->assertEqual($numberInfo->NaNSymbol, '�');
-
- $this->assertEqual($numberInfo->PercentSymbol, '%');
-
- $this->assertEqual($numberInfo->PerMilleSymbol, '‰');
-
- }
-
- function testPatternsSet()
- {
- $numberInfo = NumberFormatInfo::getInstance();
-
- $numberInfo->DecimalDigits = 0;
- $this->assertEqual($numberInfo->DecimalDigits,0);
-
- $numberInfo->DecimalSeparator = ',';
- $this->assertEqual($numberInfo->DecimalSeparator,',');
-
- $numberInfo->GroupSeparator = ' ';
- $this->assertEqual($numberInfo->GroupSeparator,' ');
-
- $numberInfo->GroupSizes = array(2,3);
- $groupsize = array(2,3);
- $this->assertEqual($numberInfo->GroupSizes, $groupsize);
-
- $numberInfo->NegativePattern = array('-$$','.');
- $negPattern = array('-$$','.');
- $this->assertEqual($numberInfo->NegativePattern, $negPattern);
-
- $numberInfo->PositivePattern = array('YY','.');
- $negPattern = array('YY','.');
- $this->assertEqual($numberInfo->PositivePattern, $negPattern);
-
- //the default CurrencySymbol symbol
- $numberInfo->CurrencySymbol = '$$$';
- $this->assertEqual($numberInfo->CurrencySymbol, '$$$');
- }
-
- function testLocalizedPatterns()
- {
- $fr = NumberFormatInfo::getInstance('fr');
- $de = NumberFormatInfo::getInstance('de');
- $en = NumberFormatInfo::getInstance('en_US');
-
- $this->assertEqual($fr->DecimalSeparator, ',');
- $this->assertEqual($de->DecimalSeparator, ',');
- $this->assertEqual($en->DecimalSeparator, '.');
-
- $this->assertEqual($fr->GroupSeparator, ' ');
- $this->assertEqual($de->GroupSeparator, '.');
- $this->assertEqual($en->GroupSeparator, ',');
- }
-
-}
-
-?>
\ No newline at end of file diff --git a/tests/UnitTests/framework/I18N/tmp/cache.txt b/tests/UnitTests/framework/I18N/tmp/cache.txt deleted file mode 100644 index e69de29b..00000000 --- a/tests/UnitTests/framework/I18N/tmp/cache.txt +++ /dev/null |