From 46b77928f746a4231d064774b5b67fd892c7ce86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Sun, 4 Aug 2013 17:50:34 +0200 Subject: rm vendor --- .../Intl/Tests/Collator/AbstractCollatorTest.php | 62 -- .../Component/Intl/Tests/Collator/CollatorTest.php | 109 --- .../Tests/Collator/Verification/CollatorTest.php | 37 - .../AbstractIntlDateFormatterTest.php | 932 --------------------- .../Tests/DateFormatter/IntlDateFormatterTest.php | 220 ----- .../Verification/IntlDateFormatterTest.php | 64 -- .../Intl/Tests/Globals/AbstractIntlGlobalsTest.php | 41 - .../Intl/Tests/Globals/IntlGlobalsTest.php | 22 - .../Tests/Globals/Verification/IntlGlobalsTest.php | 36 - .../Intl/Tests/Locale/AbstractLocaleTest.php | 29 - .../Component/Intl/Tests/Locale/LocaleTest.php | 159 ---- .../Intl/Tests/Locale/Verification/LocaleTest.php | 38 - .../AbstractNumberFormatterTest.php | 707 ---------------- .../Tests/NumberFormatter/NumberFormatterTest.php | 239 ------ .../Verification/NumberFormatterTest.php | 54 -- .../Tests/ResourceBundle/AbstractBundleTest.php | 55 -- .../Tests/ResourceBundle/CurrencyBundleTest.php | 98 --- .../Tests/ResourceBundle/LanguageBundleTest.php | 197 ----- .../Intl/Tests/ResourceBundle/LocaleBundleTest.php | 64 -- .../Reader/AbstractBundleReaderTest.php | 64 -- .../Reader/BinaryBundleReaderTest.php | 58 -- .../Reader/Fixtures/NotAFile/en.php/.gitkeep | 0 .../Tests/ResourceBundle/Reader/Fixtures/en.php | 14 - .../Tests/ResourceBundle/Reader/Fixtures/en.res | Bin 84 -> 0 bytes .../Tests/ResourceBundle/Reader/Fixtures/en.txt | 3 - .../ResourceBundle/Reader/PhpBundleReaderTest.php | 63 -- .../Reader/StructuredBundleReaderTest.php | 223 ----- .../Intl/Tests/ResourceBundle/RegionBundleTest.php | 63 -- .../Tests/ResourceBundle/Util/RingBufferTest.php | 101 --- .../Tests/ResourceBundle/Writer/Fixtures/en.php | 23 - .../Tests/ResourceBundle/Writer/Fixtures/en.res | Bin 316 -> 0 bytes .../Tests/ResourceBundle/Writer/Fixtures/en.txt | 23 - .../ResourceBundle/Writer/PhpBundleWriterTest.php | 62 -- .../ResourceBundle/Writer/TextBundleWriterTest.php | 67 -- .../Component/Intl/Tests/Util/IcuVersionTest.php | 111 --- .../Component/Intl/Tests/Util/VersionTest.php | 87 -- 36 files changed, 4125 deletions(-) delete mode 100644 vendor/symfony/intl/Symfony/Component/Intl/Tests/Collator/AbstractCollatorTest.php delete mode 100644 vendor/symfony/intl/Symfony/Component/Intl/Tests/Collator/CollatorTest.php delete mode 100644 vendor/symfony/intl/Symfony/Component/Intl/Tests/Collator/Verification/CollatorTest.php delete mode 100644 vendor/symfony/intl/Symfony/Component/Intl/Tests/DateFormatter/AbstractIntlDateFormatterTest.php delete mode 100644 vendor/symfony/intl/Symfony/Component/Intl/Tests/DateFormatter/IntlDateFormatterTest.php delete mode 100644 vendor/symfony/intl/Symfony/Component/Intl/Tests/DateFormatter/Verification/IntlDateFormatterTest.php delete mode 100644 vendor/symfony/intl/Symfony/Component/Intl/Tests/Globals/AbstractIntlGlobalsTest.php delete mode 100644 vendor/symfony/intl/Symfony/Component/Intl/Tests/Globals/IntlGlobalsTest.php delete mode 100644 vendor/symfony/intl/Symfony/Component/Intl/Tests/Globals/Verification/IntlGlobalsTest.php delete mode 100644 vendor/symfony/intl/Symfony/Component/Intl/Tests/Locale/AbstractLocaleTest.php delete mode 100644 vendor/symfony/intl/Symfony/Component/Intl/Tests/Locale/LocaleTest.php delete mode 100644 vendor/symfony/intl/Symfony/Component/Intl/Tests/Locale/Verification/LocaleTest.php delete mode 100644 vendor/symfony/intl/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php delete mode 100644 vendor/symfony/intl/Symfony/Component/Intl/Tests/NumberFormatter/NumberFormatterTest.php delete mode 100644 vendor/symfony/intl/Symfony/Component/Intl/Tests/NumberFormatter/Verification/NumberFormatterTest.php delete mode 100644 vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/AbstractBundleTest.php delete mode 100644 vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/CurrencyBundleTest.php delete mode 100644 vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/LanguageBundleTest.php delete mode 100644 vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/LocaleBundleTest.php delete mode 100644 vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Reader/AbstractBundleReaderTest.php delete mode 100644 vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Reader/BinaryBundleReaderTest.php delete mode 100644 vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Reader/Fixtures/NotAFile/en.php/.gitkeep delete mode 100644 vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Reader/Fixtures/en.php delete mode 100644 vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Reader/Fixtures/en.res delete mode 100644 vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Reader/Fixtures/en.txt delete mode 100644 vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Reader/PhpBundleReaderTest.php delete mode 100644 vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Reader/StructuredBundleReaderTest.php delete mode 100644 vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/RegionBundleTest.php delete mode 100644 vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Util/RingBufferTest.php delete mode 100644 vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Writer/Fixtures/en.php delete mode 100644 vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Writer/Fixtures/en.res delete mode 100644 vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Writer/Fixtures/en.txt delete mode 100644 vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Writer/PhpBundleWriterTest.php delete mode 100644 vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Writer/TextBundleWriterTest.php delete mode 100644 vendor/symfony/intl/Symfony/Component/Intl/Tests/Util/IcuVersionTest.php delete mode 100644 vendor/symfony/intl/Symfony/Component/Intl/Tests/Util/VersionTest.php (limited to 'vendor/symfony/intl/Symfony/Component/Intl/Tests') diff --git a/vendor/symfony/intl/Symfony/Component/Intl/Tests/Collator/AbstractCollatorTest.php b/vendor/symfony/intl/Symfony/Component/Intl/Tests/Collator/AbstractCollatorTest.php deleted file mode 100644 index 08f3a566..00000000 --- a/vendor/symfony/intl/Symfony/Component/Intl/Tests/Collator/AbstractCollatorTest.php +++ /dev/null @@ -1,62 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Intl\Tests\Collator; - -use Symfony\Component\Intl\Collator\Collator; -use Symfony\Component\Intl\Locale; - -/** - * Test case for Collator implementations. - * - * @author Bernhard Schussek - */ -abstract class AbstractCollatorTest extends \PHPUnit_Framework_TestCase -{ - /** - * @dataProvider asortProvider - */ - public function testAsort($array, $sortFlag, $expected) - { - $collator = $this->getCollator('en'); - $collator->asort($array, $sortFlag); - $this->assertSame($expected, $array); - } - - public function asortProvider() - { - return array( - /* array, sortFlag, expected */ - array( - array('a', 'b', 'c'), - Collator::SORT_REGULAR, - array('a', 'b', 'c'), - ), - array( - array('c', 'b', 'a'), - Collator::SORT_REGULAR, - array(2 => 'a', 1 => 'b', 0 => 'c'), - ), - array( - array('b', 'c', 'a'), - Collator::SORT_REGULAR, - array(2 => 'a', 0 => 'b', 1 => 'c'), - ), - ); - } - - /** - * @param string $locale - * - * @return \Collator - */ - abstract protected function getCollator($locale); -} diff --git a/vendor/symfony/intl/Symfony/Component/Intl/Tests/Collator/CollatorTest.php b/vendor/symfony/intl/Symfony/Component/Intl/Tests/Collator/CollatorTest.php deleted file mode 100644 index a4e4e56b..00000000 --- a/vendor/symfony/intl/Symfony/Component/Intl/Tests/Collator/CollatorTest.php +++ /dev/null @@ -1,109 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Intl\Tests\Collator; - -use Symfony\Component\Intl\Collator\Collator; -use Symfony\Component\Intl\Globals\IntlGlobals; - -class CollatorTest extends AbstractCollatorTest -{ - /** - * @expectedException \Symfony\Component\Intl\Exception\MethodArgumentValueNotImplementedException - */ - public function testConstructorWithUnsupportedLocale() - { - new Collator('pt_BR'); - } - - /** - * @expectedException \Symfony\Component\Intl\Exception\MethodNotImplementedException - */ - public function testCompare() - { - $collator = $this->getCollator('en'); - $collator->compare('a', 'b'); - } - - /** - * @expectedException \Symfony\Component\Intl\Exception\MethodNotImplementedException - */ - public function testGetAttribute() - { - $collator = $this->getCollator('en'); - $collator->getAttribute(Collator::NUMERIC_COLLATION); - } - - public function testGetErrorCode() - { - $collator = $this->getCollator('en'); - $this->assertEquals(IntlGlobals::U_ZERO_ERROR, $collator->getErrorCode()); - } - - public function testGetErrorMessage() - { - $collator = $this->getCollator('en'); - $this->assertEquals('U_ZERO_ERROR', $collator->getErrorMessage()); - } - - public function testGetLocale() - { - $collator = $this->getCollator('en'); - $this->assertEquals('en', $collator->getLocale()); - } - - /** - * @expectedException \Symfony\Component\Intl\Exception\MethodNotImplementedException - */ - public function testGetSortKey() - { - $collator = $this->getCollator('en'); - $collator->getSortKey('Hello'); - } - - /** - * @expectedException \Symfony\Component\Intl\Exception\MethodNotImplementedException - */ - public function testGetStrength() - { - $collator = $this->getCollator('en'); - $collator->getStrength(); - } - - /** - * @expectedException \Symfony\Component\Intl\Exception\MethodNotImplementedException - */ - public function testSetAttribute() - { - $collator = $this->getCollator('en'); - $collator->setAttribute(Collator::NUMERIC_COLLATION, Collator::ON); - } - - /** - * @expectedException \Symfony\Component\Intl\Exception\MethodNotImplementedException - */ - public function testSetStrength() - { - $collator = $this->getCollator('en'); - $collator->setStrength(Collator::PRIMARY); - } - - public function testStaticCreate() - { - $collator = Collator::create('en'); - $this->assertInstanceOf('\Symfony\Component\Intl\Collator\Collator', $collator); - } - - protected function getCollator($locale) - { - return new Collator($locale); - } -} diff --git a/vendor/symfony/intl/Symfony/Component/Intl/Tests/Collator/Verification/CollatorTest.php b/vendor/symfony/intl/Symfony/Component/Intl/Tests/Collator/Verification/CollatorTest.php deleted file mode 100644 index c8dbc131..00000000 --- a/vendor/symfony/intl/Symfony/Component/Intl/Tests/Collator/Verification/CollatorTest.php +++ /dev/null @@ -1,37 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Intl\Tests\Collator\Verification; - -use Symfony\Component\Intl\Locale; -use Symfony\Component\Intl\Tests\Collator\AbstractCollatorTest; -use Symfony\Component\Intl\Util\IntlTestHelper; - -/** - * Verifies that {@link AbstractCollatorTest} matches the behavior of the - * {@link \Collator} class in a specific version of ICU. - * - * @author Bernhard Schussek - */ -class CollatorTest extends AbstractCollatorTest -{ - protected function setUp() - { - IntlTestHelper::requireFullIntl($this); - - parent::setUp(); - } - - protected function getCollator($locale) - { - return new \Collator($locale); - } -} diff --git a/vendor/symfony/intl/Symfony/Component/Intl/Tests/DateFormatter/AbstractIntlDateFormatterTest.php b/vendor/symfony/intl/Symfony/Component/Intl/Tests/DateFormatter/AbstractIntlDateFormatterTest.php deleted file mode 100644 index 3ffb4909..00000000 --- a/vendor/symfony/intl/Symfony/Component/Intl/Tests/DateFormatter/AbstractIntlDateFormatterTest.php +++ /dev/null @@ -1,932 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Intl\Tests\DateFormatter; - -use Symfony\Component\Intl\DateFormatter\IntlDateFormatter; -use Symfony\Component\Intl\Globals\IntlGlobals; -use Symfony\Component\Intl\Intl; - -/** - * Test case for IntlDateFormatter implementations. - * - * @author Bernhard Schussek - */ -abstract class AbstractIntlDateFormatterTest extends \PHPUnit_Framework_TestCase -{ - /** - * When a time zone is not specified, it uses the system default however it returns null in the getter method - * @covers Symfony\Component\Intl\DateFormatter\IntlDateFormatter::getTimeZoneId - * @see StubIntlDateFormatterTest::testDefaultTimeZoneIntl() - */ - public function testConstructorDefaultTimeZone() - { - $formatter = $this->getDateFormatter('en', IntlDateFormatter::MEDIUM, IntlDateFormatter::SHORT); - - // In PHP 5.5 default timezone depends on `date_default_timezone_get()` method - if (version_compare(PHP_VERSION, '5.5.0-dev', '>=')) { - $this->assertEquals(date_default_timezone_get(), $formatter->getTimeZoneId()); - } else { - $this->assertNull($formatter->getTimeZoneId()); - } - } - - /** - * @dataProvider formatProvider - */ - public function testFormat($pattern, $timestamp, $expected) - { - $errorCode = IntlGlobals::U_ZERO_ERROR; - $errorMessage = 'U_ZERO_ERROR'; - - $formatter = $this->getDefaultDateFormatter($pattern); - $this->assertSame($expected, $formatter->format($timestamp)); - $this->assertIsIntlSuccess($formatter, $errorMessage, $errorCode); - } - - public function formatProvider() - { - $formatData = array( - /* general */ - array('y-M-d', 0, '1970-1-1'), - array("EEE, MMM d, ''yy", 0, "Thu, Jan 1, '70"), - array('h:mm a', 0, '12:00 AM'), - array('yyyyy.MMMM.dd hh:mm aaa', 0, '01970.January.01 12:00 AM'), - - /* escaping */ - array("'M'", 0, 'M'), - array("'yy'", 0, 'yy'), - array("'''yy'", 0, "'yy"), - array("''y", 0, "'1970"), - array("''yy", 0, "'70"), - array("H 'o'' clock'", 0, "0 o' clock"), - - /* month */ - array('M', 0, '1'), - array('MM', 0, '01'), - array('MMM', 0, 'Jan'), - array('MMMM', 0, 'January'), - array('MMMMM', 0, 'J'), - array('MMMMMM', 0, '000001'), - - array('L', 0, '1'), - array('LL', 0, '01'), - array('LLL', 0, 'Jan'), - array('LLLL', 0, 'January'), - array('LLLLL', 0, 'J'), - array('LLLLLL', 0, '000001'), - - /* year */ - array('y', 0, '1970'), - array('yy', 0, '70'), - array('yyy', 0, '1970'), - array('yyyy', 0, '1970'), - array('yyyyy', 0, '01970'), - array('yyyyyy', 0, '001970'), - - /* day */ - array('d', 0, '1'), - array('dd', 0, '01'), - array('ddd', 0, '001'), - - /* quarter */ - array('Q', 0, '1'), - array('QQ', 0, '01'), - array('QQQ', 0, 'Q1'), - array('QQQQ', 0, '1st quarter'), - array('QQQQQ', 0, '1st quarter'), - - array('q', 0, '1'), - array('qq', 0, '01'), - array('qqq', 0, 'Q1'), - array('qqqq', 0, '1st quarter'), - array('qqqqq', 0, '1st quarter'), - - // 4 months - array('Q', 7776000, '2'), - array('QQ', 7776000, '02'), - array('QQQ', 7776000, 'Q2'), - array('QQQQ', 7776000, '2nd quarter'), - - // 7 months - array('QQQQ', 15638400, '3rd quarter'), - - // 10 months - array('QQQQ', 23587200, '4th quarter'), - - /* 12-hour (1-12) */ - array('h', 0, '12'), - array('hh', 0, '12'), - array('hhh', 0, '012'), - - array('h', 1, '12'), - array('h', 3600, '1'), - array('h', 43200, '12'), // 12 hours - - /* day of year */ - array('D', 0, '1'), - array('D', 86400, '2'), // 1 day - array('D', 31536000, '1'), // 1 year - array('D', 31622400, '2'), // 1 year + 1 day - - /* day of week */ - array('E', 0, 'Thu'), - array('EE', 0, 'Thu'), - array('EEE', 0, 'Thu'), - array('EEEE', 0, 'Thursday'), - array('EEEEE', 0, 'T'), - array('EEEEEE', 0, 'Thu'), - - array('E', 1296540000, 'Tue'), // 2011-02-01 - array('E', 1296950400, 'Sun'), // 2011-02-06 - - /* am/pm marker */ - array('a', 0, 'AM'), - array('aa', 0, 'AM'), - array('aaa', 0, 'AM'), - array('aaaa', 0, 'AM'), - - // 12 hours - array('a', 43200, 'PM'), - array('aa', 43200, 'PM'), - array('aaa', 43200, 'PM'), - array('aaaa', 43200, 'PM'), - - /* 24-hour (0-23) */ - array('H', 0, '0'), - array('HH', 0, '00'), - array('HHH', 0, '000'), - - array('H', 1, '0'), - array('H', 3600, '1'), - array('H', 43200, '12'), - array('H', 46800, '13'), - - /* 24-hour (1-24) */ - array('k', 0, '24'), - array('kk', 0, '24'), - array('kkk', 0, '024'), - - array('k', 1, '24'), - array('k', 3600, '1'), - array('k', 43200, '12'), - array('k', 46800, '13'), - - /* 12-hour (0-11) */ - array('K', 0, '0'), - array('KK', 0, '00'), - array('KKK', 0, '000'), - - array('K', 1, '0'), - array('K', 3600, '1'), - array('K', 43200, '0'), // 12 hours - - /* minute */ - array('m', 0, '0'), - array('mm', 0, '00'), - array('mmm', 0, '000'), - - array('m', 1, '0'), - array('m', 60, '1'), - array('m', 120, '2'), - array('m', 180, '3'), - array('m', 3600, '0'), - array('m', 3660, '1'), - array('m', 43200, '0'), // 12 hours - - /* second */ - array('s', 0, '0'), - array('ss', 0, '00'), - array('sss', 0, '000'), - - array('s', 1, '1'), - array('s', 2, '2'), - array('s', 5, '5'), - array('s', 30, '30'), - array('s', 59, '59'), - array('s', 60, '0'), - array('s', 120, '0'), - array('s', 180, '0'), - array('s', 3600, '0'), - array('s', 3601, '1'), - array('s', 3630, '30'), - array('s', 43200, '0'), // 12 hours - - // general - array("yyyy.MM.dd 'at' HH:mm:ss zzz", 0, '1970.01.01 at 00:00:00 GMT'), - array('K:mm a, z', 0, '0:00 AM, GMT'), - - // timezone - array('z', 0, 'GMT'), - array('zz', 0, 'GMT'), - array('zzz', 0, 'GMT'), - array('zzzz', 0, 'GMT'), - array('zzzzz', 0, 'GMT'), - ); - - // As of PHP 5.3.4, IntlDateFormatter::format() accepts DateTime instances - if (version_compare(PHP_VERSION, '5.3.4', '>=')) { - $dateTime = new \DateTime('@0'); - - /* general, DateTime */ - $formatData[] = array('y-M-d', $dateTime, '1970-1-1'); - $formatData[] = array("EEE, MMM d, ''yy", $dateTime, "Thu, Jan 1, '70"); - $formatData[] = array('h:mm a', $dateTime, '12:00 AM'); - $formatData[] = array('yyyyy.MMMM.dd hh:mm aaa', $dateTime, '01970.January.01 12:00 AM'); - - $formatData[] = array("yyyy.MM.dd 'at' HH:mm:ss zzz", $dateTime, '1970.01.01 at 00:00:00 GMT'); - $formatData[] = array('K:mm a, z', $dateTime, '0:00 AM, GMT'); - } - - return $formatData; - } - - /** - * @dataProvider formatErrorProvider - */ - public function testFormatIllegalArgumentError($pattern, $timestamp, $errorMessage) - { - $errorCode = IntlGlobals::U_ILLEGAL_ARGUMENT_ERROR; - - $formatter = $this->getDefaultDateFormatter($pattern); - $this->assertFalse($formatter->format($timestamp)); - $this->assertIsIntlFailure($formatter, $errorMessage, $errorCode); - } - - public function formatErrorProvider() - { - // With PHP 5.5 IntlDateFormatter accepts empty values ('0') - if (version_compare(PHP_VERSION, '5.5.0-dev', '>=')) { - return array( - array('y-M-d', 'foobar', 'datefmt_format: string \'foobar\' is not numeric, which would be required for it to be a valid date: U_ILLEGAL_ARGUMENT_ERROR') - ); - } - - $message = 'datefmt_format: takes either an array or an integer timestamp value : U_ILLEGAL_ARGUMENT_ERROR'; - - if (version_compare(PHP_VERSION, '5.3.4', '>=')) { - $message = 'datefmt_format: takes either an array or an integer timestamp value or a DateTime object: U_ILLEGAL_ARGUMENT_ERROR'; - } - - return array( - array('y-M-d', '0', $message), - array('y-M-d', 'foobar', $message), - ); - } - - /** - * @dataProvider formatWithTimezoneProvider - */ - public function testFormatWithTimezone($timestamp, $timezone, $expected) - { - $pattern = 'yyyy-MM-dd HH:mm:ss'; - $formatter = $this->getDateFormatter('en', IntlDateFormatter::MEDIUM, IntlDateFormatter::SHORT, $timezone, IntlDateFormatter::GREGORIAN, $pattern); - $this->assertSame($expected, $formatter->format($timestamp)); - } - - public function formatWithTimezoneProvider() - { - $data = array( - array(0, 'UTC', '1970-01-01 00:00:00'), - array(0, 'GMT', '1970-01-01 00:00:00'), - array(0, 'GMT-03:00', '1969-12-31 21:00:00'), - array(0, 'GMT+03:00', '1970-01-01 03:00:00'), - array(0, 'Europe/Zurich', '1970-01-01 01:00:00'), - array(0, 'Europe/Paris', '1970-01-01 01:00:00'), - array(0, 'Africa/Cairo', '1970-01-01 02:00:00'), - array(0, 'Africa/Casablanca', '1970-01-01 00:00:00'), - array(0, 'Africa/Djibouti', '1970-01-01 03:00:00'), - array(0, 'Africa/Johannesburg', '1970-01-01 02:00:00'), - array(0, 'America/Antigua', '1969-12-31 20:00:00'), - array(0, 'America/Toronto', '1969-12-31 19:00:00'), - array(0, 'America/Vancouver', '1969-12-31 16:00:00'), - array(0, 'Asia/Aqtau', '1970-01-01 05:00:00'), - array(0, 'Asia/Bangkok', '1970-01-01 07:00:00'), - array(0, 'Asia/Dubai', '1970-01-01 04:00:00'), - array(0, 'Australia/Brisbane', '1970-01-01 10:00:00'), - array(0, 'Australia/Eucla', '1970-01-01 08:45:00'), - array(0, 'Australia/Melbourne', '1970-01-01 10:00:00'), - array(0, 'Europe/Berlin', '1970-01-01 01:00:00'), - array(0, 'Europe/Dublin', '1970-01-01 01:00:00'), - array(0, 'Europe/Warsaw', '1970-01-01 01:00:00'), - array(0, 'Pacific/Fiji', '1970-01-01 12:00:00'), - ); - - // As of PHP 5.5, intl ext no longer fallbacks invalid time zones to UTC - if (!version_compare(PHP_VERSION, '5.5.0-dev', '>=')) { - // When time zone not exists, uses UTC by default - $data[] = array(0, 'Foo/Bar', '1970-01-01 00:00:00'); - $data[] = array(0, 'UTC+04:30', '1970-01-01 00:00:00'); - $data[] = array(0, 'UTC+04:AA', '1970-01-01 00:00:00'); - } - - return $data; - } - - public function testFormatWithGmtTimezone() - { - $formatter = $this->getDefaultDateFormatter('zzzz'); - - if (version_compare(PHP_VERSION, '5.5.0-dev', '>=')) { - $formatter->setTimeZone('GMT+03:00'); - } else { - $formatter->setTimeZoneId('GMT+03:00'); - } - - $this->assertEquals('GMT+03:00', $formatter->format(0)); - } - - public function testFormatWithGmtTimeZoneAndMinutesOffset() - { - $formatter = $this->getDefaultDateFormatter('zzzz'); - - if (version_compare(PHP_VERSION, '5.5.0-dev', '>=')) { - $formatter->setTimeZone('GMT+00:30'); - } else { - $formatter->setTimeZoneId('GMT+00:30'); - } - - $this->assertEquals('GMT+00:30', $formatter->format(0)); - } - - public function testFormatWithNonStandardTimezone() - { - $formatter = $this->getDefaultDateFormatter('zzzz'); - - if (version_compare(PHP_VERSION, '5.5.0-dev', '>=')) { - $formatter->setTimeZone('Pacific/Fiji'); - } else { - $formatter->setTimeZoneId('Pacific/Fiji'); - } - - $this->assertEquals('Fiji Standard Time', $formatter->format(0)); - } - - public function testFormatWithConstructorTimezone() - { - $formatter = $this->getDateFormatter('en', IntlDateFormatter::MEDIUM, IntlDateFormatter::SHORT, 'UTC'); - $formatter->setPattern('yyyy-MM-dd HH:mm:ss'); - - $this->assertEquals( - $this->getDateTime(0)->format('Y-m-d H:i:s'), - $formatter->format(0) - ); - } - - public function testFormatWithTimezoneFromEnvironmentVariable() - { - if (version_compare(PHP_VERSION, '5.5.0-dev', '>=')) { - $this->markTestSkipped('IntlDateFormatter in PHP 5.5 no longer depends on TZ environment.'); - } - - $tz = getenv('TZ'); - putenv('TZ=Europe/London'); - - $formatter = $this->getDateFormatter('en', IntlDateFormatter::MEDIUM, IntlDateFormatter::SHORT); - $formatter->setPattern('yyyy-MM-dd HH:mm:ss'); - - $this->assertEquals( - $this->getDateTime(0)->format('Y-m-d H:i:s'), - $formatter->format(0) - ); - - $this->assertEquals('Europe/London', getenv('TZ')); - - // Restores TZ. - putenv('TZ='.$tz); - } - - public function testFormatWithTimezoneFromPhp() - { - if (!version_compare(PHP_VERSION, '5.5.0-dev', '>=')) { - $this->markTestSkipped('Only in PHP 5.5 IntlDateFormatter depends on default timezone (`date_default_timezone_get()`).'); - } - - $tz = date_default_timezone_get(); - date_default_timezone_set('Europe/London'); - - $formatter = $this->getDateFormatter('en', IntlDateFormatter::MEDIUM, IntlDateFormatter::SHORT); - $formatter->setPattern('yyyy-MM-dd HH:mm:ss'); - - $this->assertEquals( - $this->getDateTime(0)->format('Y-m-d H:i:s'), - $formatter->format(0) - ); - - $this->assertEquals('Europe/London', date_default_timezone_get()); - - // Restores TZ. - date_default_timezone_set($tz); - } - - /** - * @dataProvider dateAndTimeTypeProvider - */ - public function testDateAndTimeType($timestamp, $datetype, $timetype, $expected) - { - $formatter = $this->getDateFormatter('en', $datetype, $timetype, 'UTC'); - $this->assertSame($expected, $formatter->format($timestamp)); - } - - public function dateAndTimeTypeProvider() - { - return array( - array(0, IntlDateFormatter::FULL, IntlDateFormatter::NONE, 'Thursday, January 1, 1970'), - array(0, IntlDateFormatter::LONG, IntlDateFormatter::NONE, 'January 1, 1970'), - array(0, IntlDateFormatter::MEDIUM, IntlDateFormatter::NONE, 'Jan 1, 1970'), - array(0, IntlDateFormatter::SHORT, IntlDateFormatter::NONE, '1/1/70'), - array(0, IntlDateFormatter::NONE, IntlDateFormatter::FULL, '12:00:00 AM GMT'), - array(0, IntlDateFormatter::NONE, IntlDateFormatter::LONG, '12:00:00 AM GMT'), - array(0, IntlDateFormatter::NONE, IntlDateFormatter::MEDIUM, '12:00:00 AM'), - array(0, IntlDateFormatter::NONE, IntlDateFormatter::SHORT, '12:00 AM'), - ); - } - - public function testGetCalendar() - { - $formatter = $this->getDefaultDateFormatter(); - $this->assertEquals(IntlDateFormatter::GREGORIAN, $formatter->getCalendar()); - } - - public function testGetDateType() - { - $formatter = $this->getDateFormatter('en', IntlDateFormatter::FULL, IntlDateFormatter::NONE); - $this->assertEquals(IntlDateFormatter::FULL, $formatter->getDateType()); - } - - public function testGetLocale() - { - $formatter = $this->getDefaultDateFormatter(); - $this->assertEquals('en', $formatter->getLocale()); - } - - public function testGetPattern() - { - $formatter = $this->getDateFormatter('en', IntlDateFormatter::FULL, IntlDateFormatter::NONE, 'UTC', IntlDateFormatter::GREGORIAN, 'yyyy-MM-dd'); - $this->assertEquals('yyyy-MM-dd', $formatter->getPattern()); - } - - public function testGetTimeType() - { - $formatter = $this->getDateFormatter('en', IntlDateFormatter::NONE, IntlDateFormatter::FULL); - $this->assertEquals(IntlDateFormatter::FULL, $formatter->getTimeType()); - } - - /** - * @dataProvider parseProvider - */ - public function testParse($pattern, $value, $expected) - { - $errorCode = IntlGlobals::U_ZERO_ERROR; - $errorMessage = 'U_ZERO_ERROR'; - - $formatter = $this->getDefaultDateFormatter($pattern); - $this->assertSame($expected, $formatter->parse($value)); - $this->assertIsIntlSuccess($formatter, $errorMessage, $errorCode); - } - - public function parseProvider() - { - return array_merge( - $this->parseYearProvider(), - $this->parseQuarterProvider(), - $this->parseMonthProvider(), - $this->parseStandaloneMonthProvider(), - $this->parseDayProvider(), - $this->parseDayOfWeekProvider(), - $this->parseDayOfYearProvider(), - $this->parseHour12ClockOneBasedProvider(), - $this->parseHour12ClockZeroBasedProvider(), - $this->parseHour24ClockOneBasedProvider(), - $this->parseHour24ClockZeroBasedProvider(), - $this->parseMinuteProvider(), - $this->parseSecondProvider(), - $this->parseTimezoneProvider(), - $this->parseAmPmProvider(), - $this->parseStandaloneAmPmProvider(), - $this->parseRegexMetaCharsProvider(), - $this->parseQuoteCharsProvider(), - $this->parseDashSlashProvider() - ); - } - - public function parseYearProvider() - { - return array( - array('y-M-d', '1970-1-1', 0), - array('yy-M-d', '70-1-1', 0), - ); - } - - public function parseQuarterProvider() - { - return array( - array('Q', '1', 0), - array('QQ', '01', 0), - array('QQQ', 'Q1', 0), - array('QQQQ', '1st quarter', 0), - array('QQQQQ', '1st quarter', 0), - - array('Q', '2', 7776000), - array('QQ', '02', 7776000), - array('QQQ', 'Q2', 7776000), - array('QQQQ', '2nd quarter', 7776000), - array('QQQQQ', '2nd quarter', 7776000), - - array('q', '1', 0), - array('qq', '01', 0), - array('qqq', 'Q1', 0), - array('qqqq', '1st quarter', 0), - array('qqqqq', '1st quarter', 0), - ); - } - - public function parseMonthProvider() - { - return array( - array('y-M-d', '1970-1-1', 0), - array('y-MMM-d', '1970-Jan-1', 0), - array('y-MMMM-d', '1970-January-1', 0), - ); - } - - public function parseStandaloneMonthProvider() - { - return array( - array('y-L-d', '1970-1-1', 0), - array('y-LLL-d', '1970-Jan-1', 0), - array('y-LLLL-d', '1970-January-1', 0), - ); - } - - public function parseDayProvider() - { - return array( - array('y-M-d', '1970-1-1', 0), - array('y-M-dd', '1970-1-01', 0), - array('y-M-ddd', '1970-1-001', 0), - ); - } - - public function parseDayOfWeekProvider() - { - return array( - array('E', 'Thu', 0), - array('EE', 'Thu', 0), - array('EEE', 'Thu', 0), - array('EEEE', 'Thursday', 0), - array('EEEEE', 'T', 432000), - array('EEEEEE', 'Thu', 0), - ); - } - - public function parseDayOfYearProvider() - { - return array( - array('D', '1', 0), - array('D', '2', 86400), - ); - } - - public function parseHour12ClockOneBasedProvider() - { - return array( - // 12 hours (1-12) - array('y-M-d h', '1970-1-1 1', 3600), - array('y-M-d h', '1970-1-1 10', 36000), - array('y-M-d hh', '1970-1-1 11', 39600), - array('y-M-d hh', '1970-1-1 12', 0), - array('y-M-d hh a', '1970-1-1 0 AM', 0), - array('y-M-d hh a', '1970-1-1 1 AM', 3600), - array('y-M-d hh a', '1970-1-1 10 AM', 36000), - array('y-M-d hh a', '1970-1-1 11 AM', 39600), - array('y-M-d hh a', '1970-1-1 12 AM', 0), - array('y-M-d hh a', '1970-1-1 23 AM', 82800), - array('y-M-d hh a', '1970-1-1 24 AM', 86400), - array('y-M-d hh a', '1970-1-1 0 PM', 43200), - array('y-M-d hh a', '1970-1-1 1 PM', 46800), - array('y-M-d hh a', '1970-1-1 10 PM', 79200), - array('y-M-d hh a', '1970-1-1 11 PM', 82800), - array('y-M-d hh a', '1970-1-1 12 PM', 43200), - array('y-M-d hh a', '1970-1-1 23 PM', 126000), - array('y-M-d hh a', '1970-1-1 24 PM', 129600), - ); - } - - public function parseHour12ClockZeroBasedProvider() - { - return array( - // 12 hours (0-11) - array('y-M-d K', '1970-1-1 1', 3600), - array('y-M-d K', '1970-1-1 10', 36000), - array('y-M-d KK', '1970-1-1 11', 39600), - array('y-M-d KK', '1970-1-1 12', 43200), - array('y-M-d KK a', '1970-1-1 0 AM', 0), - array('y-M-d KK a', '1970-1-1 1 AM', 3600), - array('y-M-d KK a', '1970-1-1 10 AM', 36000), - array('y-M-d KK a', '1970-1-1 11 AM', 39600), - array('y-M-d KK a', '1970-1-1 12 AM', 43200), - array('y-M-d KK a', '1970-1-1 23 AM', 82800), - array('y-M-d KK a', '1970-1-1 24 AM', 86400), - array('y-M-d KK a', '1970-1-1 0 PM', 43200), - array('y-M-d KK a', '1970-1-1 1 PM', 46800), - array('y-M-d KK a', '1970-1-1 10 PM', 79200), - array('y-M-d KK a', '1970-1-1 11 PM', 82800), - array('y-M-d KK a', '1970-1-1 12 PM', 86400), - array('y-M-d KK a', '1970-1-1 23 PM', 126000), - array('y-M-d KK a', '1970-1-1 24 PM', 129600), - ); - } - - public function parseHour24ClockOneBasedProvider() - { - return array( - // 24 hours (1-24) - array('y-M-d k', '1970-1-1 1', 3600), - array('y-M-d k', '1970-1-1 10', 36000), - array('y-M-d kk', '1970-1-1 11', 39600), - array('y-M-d kk', '1970-1-1 12', 43200), - array('y-M-d kk', '1970-1-1 23', 82800), - array('y-M-d kk', '1970-1-1 24', 0), - array('y-M-d kk a', '1970-1-1 0 AM', 0), - array('y-M-d kk a', '1970-1-1 1 AM', 0), - array('y-M-d kk a', '1970-1-1 10 AM', 0), - array('y-M-d kk a', '1970-1-1 11 AM', 0), - array('y-M-d kk a', '1970-1-1 12 AM', 0), - array('y-M-d kk a', '1970-1-1 23 AM', 0), - array('y-M-d kk a', '1970-1-1 24 AM', 0), - array('y-M-d kk a', '1970-1-1 0 PM', 43200), - array('y-M-d kk a', '1970-1-1 1 PM', 43200), - array('y-M-d kk a', '1970-1-1 10 PM', 43200), - array('y-M-d kk a', '1970-1-1 11 PM', 43200), - array('y-M-d kk a', '1970-1-1 12 PM', 43200), - array('y-M-d kk a', '1970-1-1 23 PM', 43200), - array('y-M-d kk a', '1970-1-1 24 PM', 43200), - ); - } - - public function parseHour24ClockZeroBasedProvider() - { - return array( - // 24 hours (0-23) - array('y-M-d H', '1970-1-1 0', 0), - array('y-M-d H', '1970-1-1 1', 3600), - array('y-M-d H', '1970-1-1 10', 36000), - array('y-M-d HH', '1970-1-1 11', 39600), - array('y-M-d HH', '1970-1-1 12', 43200), - array('y-M-d HH', '1970-1-1 23', 82800), - array('y-M-d HH a', '1970-1-1 0 AM', 0), - array('y-M-d HH a', '1970-1-1 1 AM', 0), - array('y-M-d HH a', '1970-1-1 10 AM', 0), - array('y-M-d HH a', '1970-1-1 11 AM', 0), - array('y-M-d HH a', '1970-1-1 12 AM', 0), - array('y-M-d HH a', '1970-1-1 23 AM', 0), - array('y-M-d HH a', '1970-1-1 24 AM', 0), - array('y-M-d HH a', '1970-1-1 0 PM', 43200), - array('y-M-d HH a', '1970-1-1 1 PM', 43200), - array('y-M-d HH a', '1970-1-1 10 PM', 43200), - array('y-M-d HH a', '1970-1-1 11 PM', 43200), - array('y-M-d HH a', '1970-1-1 12 PM', 43200), - array('y-M-d HH a', '1970-1-1 23 PM', 43200), - array('y-M-d HH a', '1970-1-1 24 PM', 43200), - ); - } - - public function parseMinuteProvider() - { - return array( - array('y-M-d HH:m', '1970-1-1 0:1', 60), - array('y-M-d HH:mm', '1970-1-1 0:10', 600), - ); - } - - public function parseSecondProvider() - { - return array( - array('y-M-d HH:mm:s', '1970-1-1 00:01:1', 61), - array('y-M-d HH:mm:ss', '1970-1-1 00:01:10', 70), - ); - } - - public function parseTimezoneProvider() - { - return array( - array('y-M-d HH:mm:ss zzzz', '1970-1-1 00:00:00 GMT-03:00', 10800), - array('y-M-d HH:mm:ss zzzz', '1970-1-1 00:00:00 GMT-04:00', 14400), - array('y-M-d HH:mm:ss zzzz', '1970-1-1 00:00:00 GMT-00:00', 0), - array('y-M-d HH:mm:ss zzzz', '1970-1-1 00:00:00 GMT+03:00', -10800), - array('y-M-d HH:mm:ss zzzz', '1970-1-1 00:00:00 GMT+04:00', -14400), - array('y-M-d HH:mm:ss zzzz', '1970-1-1 00:00:00 GMT-0300', 10800), - array('y-M-d HH:mm:ss zzzz', '1970-1-1 00:00:00 GMT+0300', -10800), - - // a previous timezone parsing should not change the timezone for the next parsing - array('y-M-d HH:mm:ss', '1970-1-1 00:00:00', 0), - ); - } - - public function parseAmPmProvider() - { - return array( - // AM/PM (already covered by hours tests) - array('y-M-d HH:mm:ss a', '1970-1-1 00:00:00 AM', 0), - array('y-M-d HH:mm:ss a', '1970-1-1 00:00:00 PM', 43200), - ); - } - - public function parseStandaloneAmPmProvider() - { - return array( - array('a', 'AM', 0), - array('a', 'PM', 43200), - ); - } - - public function parseRegexMetaCharsProvider() - { - return array( - // regexp meta chars in the pattern string - array('y[M-d', '1970[1-1', 0), - array('y[M/d', '1970[1/1', 0), - ); - } - - public function parseQuoteCharsProvider() - { - return array( - array("'M'", 'M', 0), - array("'yy'", 'yy', 0), - array("'''yy'", "'yy", 0), - array("''y", "'1970", 0), - array("H 'o'' clock'", "0 o' clock", 0), - ); - } - - public function parseDashSlashProvider() - { - return array( - array('y-M-d', '1970/1/1', 0), - array('yy-M-d', '70/1/1', 0), - array('y/M/d', '1970-1-1', 0), - array('yy/M/d', '70-1-1', 0), - ); - } - - /** - * @dataProvider parseErrorProvider - */ - public function testParseError($pattern, $value) - { - $errorCode = IntlGlobals::U_PARSE_ERROR; - $errorMessage = 'Date parsing failed: U_PARSE_ERROR'; - - $formatter = $this->getDefaultDateFormatter($pattern); - $this->assertFalse($formatter->parse($value)); - $this->assertIsIntlFailure($formatter, $errorMessage, $errorCode); - } - - public function parseErrorProvider() - { - return array( - // 1 char month - array('y-MMMMM-d', '1970-J-1'), - array('y-MMMMM-d', '1970-S-1'), - - // standalone 1 char month - array('y-LLLLL-d', '1970-J-1'), - array('y-LLLLL-d', '1970-S-1'), - ); - } - - /* - * https://github.com/symfony/symfony/issues/4242 - */ - public function testParseAfterError() - { - $this->testParseError('y-MMMMM-d', '1970-J-1'); - $this->testParse('y-M-d', '1970-1-1', 0); - } - - public function testParseWithNullPositionValue() - { - $position = null; - $formatter = $this->getDefaultDateFormatter('y'); - $this->assertSame(0, $formatter->parse('1970', $position)); - $this->assertNull($position); - } - - public function testSetPattern() - { - $formatter = $this->getDefaultDateFormatter(); - $formatter->setPattern('yyyy-MM-dd'); - $this->assertEquals('yyyy-MM-dd', $formatter->getPattern()); - } - - /** - * @covers Symfony\Component\Intl\DateFormatter\IntlDateFormatter::getTimeZoneId - * @dataProvider setTimeZoneIdProvider - */ - public function testSetTimeZoneId($timeZoneId, $expectedTimeZoneId) - { - $formatter = $this->getDefaultDateFormatter(); - - if (version_compare(PHP_VERSION, '5.5.0-dev', '>=')) { - $formatter->setTimeZone($timeZoneId); - } else { - $formatter->setTimeZoneId($timeZoneId); - } - - $this->assertEquals($expectedTimeZoneId, $formatter->getTimeZoneId()); - } - - public function setTimeZoneIdProvider() - { - return array( - array('UTC', 'UTC'), - array('GMT', 'GMT'), - array('GMT-03:00', 'GMT-03:00'), - array('Europe/Zurich', 'Europe/Zurich'), - array('GMT-0300', 'GMT-0300'), - array('Foo/Bar', 'Foo/Bar'), - array('GMT+00:AA', 'GMT+00:AA'), - array('GMT+00AA', 'GMT+00AA'), - ); - } - - protected function getDefaultDateFormatter($pattern = null) - { - return $this->getDateFormatter('en', IntlDateFormatter::MEDIUM, IntlDateFormatter::SHORT, 'UTC', IntlDateFormatter::GREGORIAN, $pattern); - } - - protected function getDateTime($timestamp = null) - { - if (version_compare(PHP_VERSION, '5.5.0-dev', '>=')) { - $timeZone = date_default_timezone_get(); - } else { - $timeZone = getenv('TZ') ?: 'UTC'; - } - - $dateTime = new \DateTime(); - $dateTime->setTimestamp(null === $timestamp ? time() : $timestamp); - $dateTime->setTimeZone(new \DateTimeZone($timeZone)); - - return $dateTime; - } - - protected function assertIsIntlFailure($formatter, $errorMessage, $errorCode) - { - $this->assertSame($errorMessage, $this->getIntlErrorMessage()); - $this->assertSame($errorCode, $this->getIntlErrorCode()); - $this->assertTrue($this->isIntlFailure($this->getIntlErrorCode())); - $this->assertSame($errorMessage, $formatter->getErrorMessage()); - $this->assertSame($errorCode, $formatter->getErrorCode()); - $this->assertTrue($this->isIntlFailure($formatter->getErrorCode())); - } - - protected function assertIsIntlSuccess($formatter, $errorMessage, $errorCode) - { - /* @var IntlDateFormatter $formatter */ - $this->assertSame($errorMessage, $this->getIntlErrorMessage()); - $this->assertSame($errorCode, $this->getIntlErrorCode()); - $this->assertFalse($this->isIntlFailure($this->getIntlErrorCode())); - $this->assertSame($errorMessage, $formatter->getErrorMessage()); - $this->assertSame($errorCode, $formatter->getErrorCode()); - $this->assertFalse($this->isIntlFailure($formatter->getErrorCode())); - } - - /** - * @param $locale - * @param $datetype - * @param $timetype - * @param null $timezone - * @param int $calendar - * @param null $pattern - * - * @return mixed - */ - abstract protected function getDateFormatter($locale, $datetype, $timetype, $timezone = null, $calendar = IntlDateFormatter::GREGORIAN, $pattern = null); - - /** - * @return string - */ - abstract protected function getIntlErrorMessage(); - - /** - * @return integer - */ - abstract protected function getIntlErrorCode(); - - /** - * @param integer $errorCode - * - * @return Boolean - */ - abstract protected function isIntlFailure($errorCode); -} diff --git a/vendor/symfony/intl/Symfony/Component/Intl/Tests/DateFormatter/IntlDateFormatterTest.php b/vendor/symfony/intl/Symfony/Component/Intl/Tests/DateFormatter/IntlDateFormatterTest.php deleted file mode 100644 index d7227aeb..00000000 --- a/vendor/symfony/intl/Symfony/Component/Intl/Tests/DateFormatter/IntlDateFormatterTest.php +++ /dev/null @@ -1,220 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Intl\Tests\DateFormatter; - -use Symfony\Component\Intl\DateFormatter\IntlDateFormatter; -use Symfony\Component\Intl\Globals\IntlGlobals; - -class IntlDateFormatterTest extends AbstractIntlDateFormatterTest -{ - public function testConstructor() - { - $formatter = new IntlDateFormatter('en', IntlDateFormatter::MEDIUM, IntlDateFormatter::SHORT, 'UTC', IntlDateFormatter::GREGORIAN, 'y-M-d'); - $this->assertEquals('y-M-d', $formatter->getPattern()); - } - - /** - * @expectedException \Symfony\Component\Intl\Exception\MethodArgumentValueNotImplementedException - */ - public function testConstructorWithUnsupportedLocale() - { - new IntlDateFormatter('pt_BR', IntlDateFormatter::MEDIUM, IntlDateFormatter::SHORT); - } - - public function testStaticCreate() - { - $formatter = IntlDateFormatter::create('en', IntlDateFormatter::MEDIUM, IntlDateFormatter::SHORT); - $this->assertInstanceOf('\Symfony\Component\Intl\DateFormatter\IntlDateFormatter', $formatter); - } - - public function testFormatWithUnsupportedTimestampArgument() - { - $formatter = $this->getDefaultDateFormatter(); - - $localtime = array( - 'tm_sec' => 59, - 'tm_min' => 3, - 'tm_hour' => 15, - 'tm_mday' => 15, - 'tm_mon' => 3, - 'tm_year' => 112, - 'tm_wday' => 0, - 'tm_yday' => 105, - 'tm_isdst' => 0 - ); - - try { - $formatter->format($localtime); - } catch (\Exception $e) { - $this->assertInstanceOf('Symfony\Component\Intl\Exception\MethodArgumentValueNotImplementedException', $e); - - if (version_compare(PHP_VERSION, '5.3.4', '>=')) { - $this->assertStringEndsWith('Only integer unix timestamps and DateTime objects are supported. Please install the "intl" extension for full localization capabilities.', $e->getMessage()); - } else { - $this->assertStringEndsWith('Only integer unix timestamps are supported. Please install the "intl" extension for full localization capabilities.', $e->getMessage()); - } - } - } - - /** - * @expectedException \Symfony\Component\Intl\Exception\NotImplementedException - */ - public function testFormatWithUnimplementedChars() - { - $pattern = 'Y'; - $formatter = new IntlDateFormatter('en', IntlDateFormatter::MEDIUM, IntlDateFormatter::SHORT, 'UTC', IntlDateFormatter::GREGORIAN, $pattern); - $formatter->format(0); - } - - /** - * @expectedException \Symfony\Component\Intl\Exception\NotImplementedException - */ - public function testFormatWithNonIntegerTimestamp() - { - $formatter = $this->getDefaultDateFormatter(); - $formatter->format(array()); - } - - public function testGetErrorCode() - { - $formatter = $this->getDefaultDateFormatter(); - $this->assertEquals(IntlGlobals::getErrorCode(), $formatter->getErrorCode()); - } - - public function testGetErrorMessage() - { - $formatter = $this->getDefaultDateFormatter(); - $this->assertEquals(IntlGlobals::getErrorMessage(), $formatter->getErrorMessage()); - } - - public function testIsLenient() - { - $formatter = $this->getDefaultDateFormatter(); - $this->assertFalse($formatter->isLenient()); - } - - /** - * @expectedException \Symfony\Component\Intl\Exception\MethodNotImplementedException - */ - public function testLocaltime() - { - $formatter = $this->getDefaultDateFormatter(); - $formatter->localtime('Wednesday, December 31, 1969 4:00:00 PM PT'); - } - - /** - * @expectedException \Symfony\Component\Intl\Exception\MethodArgumentNotImplementedException - */ - public function testParseWithNotNullPositionValue() - { - $position = 0; - $formatter = $this->getDefaultDateFormatter('y'); - $this->assertSame(0, $formatter->parse('1970', $position)); - } - - /** - * @expectedException \Symfony\Component\Intl\Exception\MethodNotImplementedException - */ - public function testSetCalendar() - { - $formatter = $this->getDefaultDateFormatter(); - $formatter->setCalendar(IntlDateFormatter::GREGORIAN); - } - - /** - * @expectedException \Symfony\Component\Intl\Exception\MethodArgumentValueNotImplementedException - */ - public function testSetLenient() - { - $formatter = $this->getDefaultDateFormatter(); - $formatter->setLenient(true); - } - - /** - * @expectedException \Symfony\Component\Intl\Exception\NotImplementedException - */ - public function testFormatWithGmtTimeZoneAndMinutesOffset() - { - parent::testFormatWithGmtTimeZoneAndMinutesOffset(); - } - - /** - * @expectedException \Symfony\Component\Intl\Exception\NotImplementedException - */ - public function testFormatWithNonStandardTimezone() - { - parent::testFormatWithNonStandardTimezone(); - } - - public function parseStandaloneAmPmProvider() - { - return $this->notImplemented(parent::parseStandaloneAmPmProvider()); - } - - public function parseDayOfWeekProvider() - { - return $this->notImplemented(parent::parseDayOfWeekProvider()); - } - - public function parseDayOfYearProvider() - { - return $this->notImplemented(parent::parseDayOfYearProvider()); - } - - public function parseQuarterProvider() - { - return $this->notImplemented(parent::parseQuarterProvider()); - } - - protected function getDateFormatter($locale, $datetype, $timetype, $timezone = null, $calendar = IntlDateFormatter::GREGORIAN, $pattern = null) - { - return new IntlDateFormatter($locale, $datetype, $timetype, $timezone, $calendar, $pattern); - } - - protected function getIntlErrorMessage() - { - return IntlGlobals::getErrorMessage(); - } - - protected function getIntlErrorCode() - { - return IntlGlobals::getErrorCode(); - } - - protected function isIntlFailure($errorCode) - { - return IntlGlobals::isFailure($errorCode); - } - - /** - * Just to document the differences between the stub and the intl - * implementations. The intl can parse any of the tested formats alone. The - * stub does not implement them as it would be needed to add more - * abstraction, passing more context to the transformers objects. Any of the - * formats are ignored alone or with date/time data (years, months, days, - * hours, minutes and seconds). - * - * Also in intl, format like 'ss E' for '10 2' (2nd day of year - * + 10 seconds) are added, then we have 86,400 seconds (24h * 60min * 60s) - * + 10 seconds - * - * @param array $dataSets - * - * @return array - */ - private function notImplemented(array $dataSets) - { - return array_map(function ($row) { - return array($row[0], $row[1], 0); - }, $dataSets); - } -} diff --git a/vendor/symfony/intl/Symfony/Component/Intl/Tests/DateFormatter/Verification/IntlDateFormatterTest.php b/vendor/symfony/intl/Symfony/Component/Intl/Tests/DateFormatter/Verification/IntlDateFormatterTest.php deleted file mode 100644 index 7fbf854f..00000000 --- a/vendor/symfony/intl/Symfony/Component/Intl/Tests/DateFormatter/Verification/IntlDateFormatterTest.php +++ /dev/null @@ -1,64 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Intl\Tests\DateFormatter\Verification; - -use Symfony\Component\Intl\DateFormatter\IntlDateFormatter; -use Symfony\Component\Intl\Tests\DateFormatter\AbstractIntlDateFormatterTest; -use Symfony\Component\Intl\Util\IntlTestHelper; - -/** - * Verifies that {@link AbstractIntlDateFormatterTest} matches the behavior of - * the {@link \IntlDateFormatter} class in a specific version of ICU. - * - * @author Bernhard Schussek - */ -class IntlDateFormatterTest extends AbstractIntlDateFormatterTest -{ - protected function setUp() - { - IntlTestHelper::requireFullIntl($this); - - parent::setUp(); - } - - /** - * It seems IntlDateFormatter caches the timezone id when not explicitly set via constructor or by the - * setTimeZoneId() method. Since testFormatWithDefaultTimezoneIntl() runs using the default environment - * time zone, this test would use it too if not running in a separated process. - * - * @runInSeparateProcess - */ - public function testFormatWithTimezoneFromEnvironmentVariable() - { - parent::testFormatWithTimezoneFromEnvironmentVariable(); - } - - protected function getDateFormatter($locale, $datetype, $timetype, $timezone = null, $calendar = IntlDateFormatter::GREGORIAN, $pattern = null) - { - return new \IntlDateFormatter($locale, $datetype, $timetype, $timezone, $calendar, $pattern); - } - - protected function getIntlErrorMessage() - { - return intl_get_error_message(); - } - - protected function getIntlErrorCode() - { - return intl_get_error_code(); - } - - protected function isIntlFailure($errorCode) - { - return intl_is_failure($errorCode); - } -} diff --git a/vendor/symfony/intl/Symfony/Component/Intl/Tests/Globals/AbstractIntlGlobalsTest.php b/vendor/symfony/intl/Symfony/Component/Intl/Tests/Globals/AbstractIntlGlobalsTest.php deleted file mode 100644 index 0a937d5e..00000000 --- a/vendor/symfony/intl/Symfony/Component/Intl/Tests/Globals/AbstractIntlGlobalsTest.php +++ /dev/null @@ -1,41 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Intl\Tests\Globals; - -/** - * Test case for intl function implementations. - * - * @author Bernhard Schussek - */ -abstract class AbstractIntlGlobalsTest extends \PHPUnit_Framework_TestCase -{ - public function errorNameProvider() - { - return array ( - array(-129, '[BOGUS UErrorCode]'), - array(0, 'U_ZERO_ERROR'), - array(1, 'U_ILLEGAL_ARGUMENT_ERROR'), - array(9, 'U_PARSE_ERROR'), - array(129, '[BOGUS UErrorCode]'), - ); - } - - /** - * @dataProvider errorNameProvider - */ - public function testGetErrorName($errorCode, $errorName) - { - $this->assertSame($errorName, $this->getIntlErrorName($errorCode)); - } - - abstract protected function getIntlErrorName($errorCode); -} diff --git a/vendor/symfony/intl/Symfony/Component/Intl/Tests/Globals/IntlGlobalsTest.php b/vendor/symfony/intl/Symfony/Component/Intl/Tests/Globals/IntlGlobalsTest.php deleted file mode 100644 index 34e3a6a3..00000000 --- a/vendor/symfony/intl/Symfony/Component/Intl/Tests/Globals/IntlGlobalsTest.php +++ /dev/null @@ -1,22 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Intl\Tests\Globals; - -use Symfony\Component\Intl\Globals\IntlGlobals; - -class IntlGlobalsTest extends AbstractIntlGlobalsTest -{ - protected function getIntlErrorName($errorCode) - { - return IntlGlobals::getErrorName($errorCode); - } -} diff --git a/vendor/symfony/intl/Symfony/Component/Intl/Tests/Globals/Verification/IntlGlobalsTest.php b/vendor/symfony/intl/Symfony/Component/Intl/Tests/Globals/Verification/IntlGlobalsTest.php deleted file mode 100644 index c46033d8..00000000 --- a/vendor/symfony/intl/Symfony/Component/Intl/Tests/Globals/Verification/IntlGlobalsTest.php +++ /dev/null @@ -1,36 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Intl\Tests\Globals\Verification; - -use Symfony\Component\Intl\Tests\Globals\AbstractIntlGlobalsTest; -use Symfony\Component\Intl\Util\IntlTestHelper; - -/** - * Verifies that {@link AbstractIntlGlobalsTest} matches the behavior of the - * intl functions with a specific version of ICU. - * - * @author Bernhard Schussek - */ -class IntlGlobalsTest extends AbstractIntlGlobalsTest -{ - protected function setUp() - { - IntlTestHelper::requireFullIntl($this); - - parent::setUp(); - } - - protected function getIntlErrorName($errorCode) - { - return intl_error_name($errorCode); - } -} diff --git a/vendor/symfony/intl/Symfony/Component/Intl/Tests/Locale/AbstractLocaleTest.php b/vendor/symfony/intl/Symfony/Component/Intl/Tests/Locale/AbstractLocaleTest.php deleted file mode 100644 index 08569fad..00000000 --- a/vendor/symfony/intl/Symfony/Component/Intl/Tests/Locale/AbstractLocaleTest.php +++ /dev/null @@ -1,29 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Intl\Tests\Locale; - -/** - * Test case for Locale implementations. - * - * @author Bernhard Schussek - */ -abstract class AbstractLocaleTest extends \PHPUnit_Framework_TestCase -{ - public function testSetDefault() - { - $this->call('setDefault', 'en_GB'); - - $this->assertSame('en_GB', $this->call('getDefault')); - } - - abstract protected function call($methodName); -} diff --git a/vendor/symfony/intl/Symfony/Component/Intl/Tests/Locale/LocaleTest.php b/vendor/symfony/intl/Symfony/Component/Intl/Tests/Locale/LocaleTest.php deleted file mode 100644 index 7e957187..00000000 --- a/vendor/symfony/intl/Symfony/Component/Intl/Tests/Locale/LocaleTest.php +++ /dev/null @@ -1,159 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Intl\Tests\Locale; - -class LocaleTest extends AbstractLocaleTest -{ - /** - * @expectedException \Symfony\Component\Intl\Exception\MethodNotImplementedException - */ - public function testAcceptFromHttp() - { - $this->call('acceptFromHttp', 'pt-br,en-us;q=0.7,en;q=0.5'); - } - - /** - * @expectedException \Symfony\Component\Intl\Exception\MethodNotImplementedException - */ - public function testComposeLocale() - { - $subtags = array( - 'language' => 'pt', - 'script' => 'Latn', - 'region' => 'BR' - ); - $this->call('composeLocale', $subtags); - } - - /** - * @expectedException \Symfony\Component\Intl\Exception\MethodNotImplementedException - */ - public function testFilterMatches() - { - $this->call('filterMatches', 'pt-BR', 'pt-BR'); - } - - /** - * @expectedException \Symfony\Component\Intl\Exception\MethodNotImplementedException - */ - public function testGetAllVariants() - { - $this->call('getAllVariants', 'pt_BR_Latn'); - } - - /** - * @expectedException \Symfony\Component\Intl\Exception\MethodNotImplementedException - */ - public function testGetDisplayLanguage() - { - $this->call('getDisplayLanguage', 'pt-Latn-BR', 'en'); - } - - /** - * @expectedException \Symfony\Component\Intl\Exception\MethodNotImplementedException - */ - public function testGetDisplayName() - { - $this->call('getDisplayName', 'pt-Latn-BR', 'en'); - } - - /** - * @expectedException \Symfony\Component\Intl\Exception\MethodNotImplementedException - */ - public function testGetDisplayRegion() - { - $this->call('getDisplayRegion', 'pt-Latn-BR', 'en'); - } - - /** - * @expectedException \Symfony\Component\Intl\Exception\MethodNotImplementedException - */ - public function testGetDisplayScript() - { - $this->call('getDisplayScript', 'pt-Latn-BR', 'en'); - } - - /** - * @expectedException \Symfony\Component\Intl\Exception\MethodNotImplementedException - */ - public function testGetDisplayVariant() - { - $this->call('getDisplayVariant', 'pt-Latn-BR', 'en'); - } - - /** - * @expectedException \Symfony\Component\Intl\Exception\MethodNotImplementedException - */ - public function testGetKeywords() - { - $this->call('getKeywords', 'pt-BR@currency=BRL'); - } - - /** - * @expectedException \Symfony\Component\Intl\Exception\MethodNotImplementedException - */ - public function testGetPrimaryLanguage() - { - $this->call('getPrimaryLanguage', 'pt-Latn-BR'); - } - - /** - * @expectedException \Symfony\Component\Intl\Exception\MethodNotImplementedException - */ - public function testGetRegion() - { - $this->call('getRegion', 'pt-Latn-BR'); - } - - /** - * @expectedException \Symfony\Component\Intl\Exception\MethodNotImplementedException - */ - public function testGetScript() - { - $this->call('getScript', 'pt-Latn-BR'); - } - - /** - * @expectedException \Symfony\Component\Intl\Exception\MethodNotImplementedException - */ - public function testLookup() - { - $langtag = array( - 'pt-Latn-BR', - 'pt-BR' - ); - $this->call('lookup', $langtag, 'pt-BR-x-priv1'); - } - - /** - * @expectedException \Symfony\Component\Intl\Exception\MethodNotImplementedException - */ - public function testParseLocale() - { - $this->call('parseLocale', 'pt-Latn-BR'); - } - - /** - * @expectedException \Symfony\Component\Intl\Exception\MethodNotImplementedException - */ - public function testSetDefault() - { - $this->call('setDefault', 'pt_BR'); - } - - protected function call($methodName) - { - $args = array_slice(func_get_args(), 1); - - return call_user_func_array(array('Symfony\Component\Intl\Locale\Locale', $methodName), $args); - } -} diff --git a/vendor/symfony/intl/Symfony/Component/Intl/Tests/Locale/Verification/LocaleTest.php b/vendor/symfony/intl/Symfony/Component/Intl/Tests/Locale/Verification/LocaleTest.php deleted file mode 100644 index 39d4f3cb..00000000 --- a/vendor/symfony/intl/Symfony/Component/Intl/Tests/Locale/Verification/LocaleTest.php +++ /dev/null @@ -1,38 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Intl\Tests\Locale\Verification; - -use Symfony\Component\Intl\Tests\Locale\AbstractLocaleTest; -use Symfony\Component\Intl\Util\IntlTestHelper; - -/** - * Verifies that {@link AbstractLocaleTest} matches the behavior of the - * {@link Locale} class with a specific version of ICU. - * - * @author Bernhard Schussek - */ -class LocaleTest extends AbstractLocaleTest -{ - protected function setUp() - { - IntlTestHelper::requireFullIntl($this); - - parent::setUp(); - } - - protected function call($methodName) - { - $args = array_slice(func_get_args(), 1); - - return call_user_func_array(array('Locale', $methodName), $args); - } -} diff --git a/vendor/symfony/intl/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php b/vendor/symfony/intl/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php deleted file mode 100644 index ad5581b4..00000000 --- a/vendor/symfony/intl/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php +++ /dev/null @@ -1,707 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Intl\Tests\NumberFormatter; - -use Symfony\Component\Intl\Globals\IntlGlobals; -use Symfony\Component\Intl\Intl; -use Symfony\Component\Intl\Locale; -use Symfony\Component\Intl\NumberFormatter\NumberFormatter; -use Symfony\Component\Intl\Util\IntlTestHelper; - -/** - * Note that there are some values written like -2147483647 - 1. This is the lower 32bit int max and is a known - * behavior of PHP. - */ -abstract class AbstractNumberFormatterTest extends \PHPUnit_Framework_TestCase -{ - /** - * @dataProvider formatCurrencyWithDecimalStyleProvider - */ - public function testFormatCurrencyWithDecimalStyle($value, $currency, $expected) - { - $formatter = $this->getNumberFormatter('en', NumberFormatter::DECIMAL); - $this->assertEquals($expected, $formatter->formatCurrency($value, $currency)); - } - - public function formatCurrencyWithDecimalStyleProvider() - { - return array( - array(100, 'ALL', '100'), - array(100, 'BRL', '100.00'), - array(100, 'CRC', '100'), - array(100, 'JPY', '100'), - array(100, 'CHF', '100'), - array(-100, 'ALL', '-100'), - array(-100, 'BRL', '-100'), - array(-100, 'CRC', '-100'), - array(-100, 'JPY', '-100'), - array(-100, 'CHF', '-100'), - array(1000.12, 'ALL', '1,000.12'), - array(1000.12, 'BRL', '1,000.12'), - array(1000.12, 'CRC', '1,000.12'), - array(1000.12, 'JPY', '1,000.12'), - array(1000.12, 'CHF', '1,000.12') - ); - } - - /** - * @dataProvider formatCurrencyWithCurrencyStyleProvider - */ - public function testFormatCurrencyWithCurrencyStyle($value, $currency, $expected) - { - $formatter = $this->getNumberFormatter('en', NumberFormatter::CURRENCY); - $this->assertEquals($expected, $formatter->formatCurrency($value, $currency)); - } - - public function formatCurrencyWithCurrencyStyleProvider() - { - return array( - array(100, 'ALL', 'ALL100'), - array(-100, 'ALL', '(ALL100)'), - array(1000.12, 'ALL', 'ALL1,000'), - - array(100, 'JPY', '¥100'), - array(-100, 'JPY', '(¥100)'), - array(1000.12, 'JPY', '¥1,000'), - - array(100, 'EUR', '€100.00'), - array(-100, 'EUR', '(€100.00)'), - array(1000.12, 'EUR', '€1,000.12'), - ); - } - - /** - * @dataProvider formatCurrencyWithCurrencyStyleCostaRicanColonsRoundingProvider - */ - public function testFormatCurrencyWithCurrencyStyleCostaRicanColonsRounding($value, $currency, $symbol, $expected) - { - $formatter = $this->getNumberFormatter('en', NumberFormatter::CURRENCY); - $this->assertEquals(sprintf($expected, $symbol), $formatter->formatCurrency($value, $currency)); - } - - public function formatCurrencyWithCurrencyStyleCostaRicanColonsRoundingProvider() - { - return array( - array(100, 'CRC', 'CRC', '%s100'), - array(-100, 'CRC', 'CRC', '(%s100)'), - array(1000.12, 'CRC', 'CRC', '%s1,000'), - ); - } - - /** - * @dataProvider formatCurrencyWithCurrencyStyleBrazilianRealRoundingProvider - */ - public function testFormatCurrencyWithCurrencyStyleBrazilianRealRounding($value, $currency, $symbol, $expected) - { - $formatter = $this->getNumberFormatter('en', NumberFormatter::CURRENCY); - $this->assertEquals(sprintf($expected, $symbol), $formatter->formatCurrency($value, $currency)); - } - - public function formatCurrencyWithCurrencyStyleBrazilianRealRoundingProvider() - { - return array( - array(100, 'BRL', 'R', '%s$100.00'), - array(-100, 'BRL', 'R', '(%s$100.00)'), - array(1000.12, 'BRL', 'R', '%s$1,000.12'), - - // Rounding checks - array(1000.121, 'BRL', 'R', '%s$1,000.12'), - array(1000.123, 'BRL', 'R', '%s$1,000.12'), - array(1000.125, 'BRL', 'R', '%s$1,000.12'), - array(1000.127, 'BRL', 'R', '%s$1,000.13'), - array(1000.129, 'BRL', 'R', '%s$1,000.13'), - array(11.50999, 'BRL', 'R', '%s$11.51'), - array(11.9999464, 'BRL', 'R', '%s$12.00') - ); - } - - /** - * @dataProvider formatCurrencyWithCurrencyStyleSwissRoundingProvider - */ - public function testFormatCurrencyWithCurrencyStyleSwissRounding($value, $currency, $symbol, $expected) - { - $formatter = $this->getNumberFormatter('en', NumberFormatter::CURRENCY); - $this->assertEquals(sprintf($expected, $symbol), $formatter->formatCurrency($value, $currency)); - } - - public function formatCurrencyWithCurrencyStyleSwissRoundingProvider() - { - return array( - array(100, 'CHF', 'CHF', '%s100.00'), - array(-100, 'CHF', 'CHF', '(%s100.00)'), - array(1000.12, 'CHF', 'CHF', '%s1,000.10'), - array('1000.12', 'CHF', 'CHF', '%s1,000.10'), - - // Rounding checks - array(1000.121, 'CHF', 'CHF', '%s1,000.10'), - array(1000.123, 'CHF', 'CHF', '%s1,000.10'), - array(1000.125, 'CHF', 'CHF', '%s1,000.10'), - array(1000.127, 'CHF', 'CHF', '%s1,000.15'), - array(1000.129, 'CHF', 'CHF', '%s1,000.15'), - - array(1200000.00, 'CHF', 'CHF', '%s1,200,000.00'), - array(1200000.1, 'CHF', 'CHF', '%s1,200,000.10'), - array(1200000.10, 'CHF', 'CHF', '%s1,200,000.10'), - array(1200000.101, 'CHF', 'CHF', '%s1,200,000.10') - ); - } - - public function testFormat() - { - $errorCode = IntlGlobals::U_ZERO_ERROR; - $errorMessage = 'U_ZERO_ERROR'; - - $formatter = $this->getNumberFormatter('en', NumberFormatter::DECIMAL); - $this->assertSame('9.555', $formatter->format(9.555)); - - $this->assertSame($errorMessage, $this->getIntlErrorMessage()); - $this->assertSame($errorCode, $this->getIntlErrorCode()); - $this->assertFalse($this->isIntlFailure($this->getIntlErrorCode())); - $this->assertSame($errorMessage, $formatter->getErrorMessage()); - $this->assertSame($errorCode, $formatter->getErrorCode()); - $this->assertFalse($this->isIntlFailure($formatter->getErrorCode())); - } - - public function testFormatWithCurrencyStyle() - { - $formatter = $this->getNumberFormatter('en', NumberFormatter::CURRENCY); - $this->assertEquals('¤1.00', $formatter->format(1)); - } - - /** - * @dataProvider formatTypeInt32Provider - */ - public function testFormatTypeInt32($formatter, $value, $expected, $message = '') - { - $formattedValue = $formatter->format($value, NumberFormatter::TYPE_INT32); - $this->assertEquals($expected, $formattedValue, $message); - } - - public function formatTypeInt32Provider() - { - $formatter = $this->getNumberFormatter('en', NumberFormatter::DECIMAL); - - $message = '->format() TYPE_INT32 formats inconsistently an integer if out of the 32 bit range.'; - - return array( - array($formatter, 1, '1'), - array($formatter, 1.1, '1'), - array($formatter, 2147483648, '-2,147,483,648', $message), - array($formatter, -2147483649, '2,147,483,647', $message), - ); - } - - /** - * @dataProvider formatTypeInt32WithCurrencyStyleProvider - */ - public function testFormatTypeInt32WithCurrencyStyle($formatter, $value, $expected, $message = '') - { - $formattedValue = $formatter->format($value, NumberFormatter::TYPE_INT32); - $this->assertEquals($expected, $formattedValue, $message); - } - - public function formatTypeInt32WithCurrencyStyleProvider() - { - $formatter = $this->getNumberFormatter('en', NumberFormatter::CURRENCY); - - $message = '->format() TYPE_INT32 formats inconsistently an integer if out of the 32 bit range.'; - - return array( - array($formatter, 1, '¤1.00'), - array($formatter, 1.1, '¤1.00'), - array($formatter, 2147483648, '(¤2,147,483,648.00)', $message), - array($formatter, -2147483649, '¤2,147,483,647.00', $message) - ); - } - - /** - * The parse() method works differently with integer out of the 32 bit range. format() works fine. - * @dataProvider formatTypeInt64Provider - */ - public function testFormatTypeInt64($formatter, $value, $expected) - { - $formattedValue = $formatter->format($value, NumberFormatter::TYPE_INT64); - $this->assertEquals($expected, $formattedValue); - } - - public function formatTypeInt64Provider() - { - $formatter = $this->getNumberFormatter('en', NumberFormatter::DECIMAL); - - return array( - array($formatter, 1, '1'), - array($formatter, 1.1, '1'), - array($formatter, 2147483648, '2,147,483,648'), - array($formatter, -2147483649, '-2,147,483,649'), - ); - } - - /** - * @dataProvider formatTypeInt64WithCurrencyStyleProvider - */ - public function testFormatTypeInt64WithCurrencyStyle($formatter, $value, $expected) - { - $formattedValue = $formatter->format($value, NumberFormatter::TYPE_INT64); - $this->assertEquals($expected, $formattedValue); - } - - public function formatTypeInt64WithCurrencyStyleProvider() - { - $formatter = $this->getNumberFormatter('en', NumberFormatter::CURRENCY); - - return array( - array($formatter, 1, '¤1.00'), - array($formatter, 1.1, '¤1.00'), - array($formatter, 2147483648, '¤2,147,483,648.00'), - array($formatter, -2147483649, '(¤2,147,483,649.00)') - ); - } - - /** - * @dataProvider formatTypeDoubleProvider - */ - public function testFormatTypeDouble($formatter, $value, $expected) - { - $formattedValue = $formatter->format($value, NumberFormatter::TYPE_DOUBLE); - $this->assertEquals($expected, $formattedValue); - } - - public function formatTypeDoubleProvider() - { - $formatter = $this->getNumberFormatter('en', NumberFormatter::DECIMAL); - - return array( - array($formatter, 1, '1'), - array($formatter, 1.1, '1.1'), - ); - } - - /** - * @dataProvider formatTypeDoubleWithCurrencyStyleProvider - */ - public function testFormatTypeDoubleWithCurrencyStyle($formatter, $value, $expected) - { - $formattedValue = $formatter->format($value, NumberFormatter::TYPE_DOUBLE); - $this->assertEquals($expected, $formattedValue); - } - - public function formatTypeDoubleWithCurrencyStyleProvider() - { - $formatter = $this->getNumberFormatter('en', NumberFormatter::CURRENCY); - - return array( - array($formatter, 1, '¤1.00'), - array($formatter, 1.1, '¤1.10'), - ); - } - - /** - * @dataProvider formatTypeCurrencyProvider - * @expectedException \PHPUnit_Framework_Error_Warning - */ - public function testFormatTypeCurrency($formatter, $value) - { - $formatter->format($value, NumberFormatter::TYPE_CURRENCY); - } - - /** - * @dataProvider formatTypeCurrencyProvider - */ - public function testFormatTypeCurrencyReturn($formatter, $value) - { - $this->assertFalse(@$formatter->format($value, NumberFormatter::TYPE_CURRENCY)); - } - - public function formatTypeCurrencyProvider() - { - $df = $this->getNumberFormatter('en', NumberFormatter::DECIMAL); - $cf = $this->getNumberFormatter('en', NumberFormatter::CURRENCY); - - return array( - array($df, 1), - array($cf, 1), - ); - } - - /** - * @dataProvider formatFractionDigitsProvider - */ - public function testFormatFractionDigits($value, $expected, $fractionDigits = null, $expectedFractionDigits = 1) - { - $formatter = $this->getNumberFormatter('en', NumberFormatter::DECIMAL); - - if (null !== $fractionDigits) { - $attributeRet = $formatter->setAttribute(NumberFormatter::FRACTION_DIGITS, $fractionDigits); - } - - $formattedValue = $formatter->format($value); - $this->assertSame($expected, $formattedValue); - $this->assertSame($expectedFractionDigits, $formatter->getAttribute(NumberFormatter::FRACTION_DIGITS)); - - if (isset($attributeRet)) { - $this->assertTrue($attributeRet); - } - } - - public function formatFractionDigitsProvider() - { - return array( - array(1.123, '1.123', null, 0), - array(1.123, '1', 0, 0), - array(1.123, '1.1', 1, 1), - array(1.123, '1.12', 2, 2), - array(1.123, '1', -1, 0), - array(1.123, '1', 'abc', 0) - ); - } - - /** - * @dataProvider formatGroupingUsedProvider - */ - public function testFormatGroupingUsed($value, $expected, $groupingUsed = null, $expectedGroupingUsed = 1) - { - $formatter = $this->getNumberFormatter('en', NumberFormatter::DECIMAL); - - if (null !== $groupingUsed) { - $attributeRet = $formatter->setAttribute(NumberFormatter::GROUPING_USED, $groupingUsed); - } - - $formattedValue = $formatter->format($value); - $this->assertSame($expected, $formattedValue); - $this->assertSame($expectedGroupingUsed, $formatter->getAttribute(NumberFormatter::GROUPING_USED)); - - if (isset($attributeRet)) { - $this->assertTrue($attributeRet); - } - } - - public function formatGroupingUsedProvider() - { - return array( - array(1000, '1,000', null, 1), - array(1000, '1000', 0, 0), - array(1000, '1,000', 1, 1), - array(1000, '1,000', 2, 1), - array(1000, '1000', 'abc', 0), - array(1000, '1,000', -1, 1), - ); - } - - /** - * @dataProvider formatRoundingModeRoundHalfUpProvider - */ - public function testFormatRoundingModeHalfUp($value, $expected) - { - $formatter = $this->getNumberFormatter('en', NumberFormatter::DECIMAL); - $formatter->setAttribute(NumberFormatter::FRACTION_DIGITS, 2); - - $formatter->setAttribute(NumberFormatter::ROUNDING_MODE, NumberFormatter::ROUND_HALFUP); - $this->assertSame($expected, $formatter->format($value), '->format() with ROUND_HALFUP rounding mode.'); - } - - public function formatRoundingModeRoundHalfUpProvider() - { - // The commented value is differently rounded by intl's NumberFormatter in 32 and 64 bit architectures - return array( - array(1.121, '1.12'), - array(1.123, '1.12'), - // array(1.125, '1.13'), - array(1.127, '1.13'), - array(1.129, '1.13'), - ); - } - - /** - * @dataProvider formatRoundingModeRoundHalfDownProvider - */ - public function testFormatRoundingModeHalfDown($value, $expected) - { - $formatter = $this->getNumberFormatter('en', NumberFormatter::DECIMAL); - $formatter->setAttribute(NumberFormatter::FRACTION_DIGITS, 2); - - $formatter->setAttribute(NumberFormatter::ROUNDING_MODE, NumberFormatter::ROUND_HALFDOWN); - $this->assertSame($expected, $formatter->format($value), '->format() with ROUND_HALFDOWN rounding mode.'); - } - - public function formatRoundingModeRoundHalfDownProvider() - { - return array( - array(1.121, '1.12'), - array(1.123, '1.12'), - array(1.125, '1.12'), - array(1.127, '1.13'), - array(1.129, '1.13'), - ); - } - - /** - * @dataProvider formatRoundingModeRoundHalfEvenProvider - */ - public function testFormatRoundingModeHalfEven($value, $expected) - { - $formatter = $this->getNumberFormatter('en', NumberFormatter::DECIMAL); - $formatter->setAttribute(NumberFormatter::FRACTION_DIGITS, 2); - - $formatter->setAttribute(NumberFormatter::ROUNDING_MODE, NumberFormatter::ROUND_HALFEVEN); - $this->assertSame($expected, $formatter->format($value), '->format() with ROUND_HALFEVEN rounding mode.'); - } - - public function formatRoundingModeRoundHalfEvenProvider() - { - return array( - array(1.121, '1.12'), - array(1.123, '1.12'), - array(1.125, '1.12'), - array(1.127, '1.13'), - array(1.129, '1.13'), - ); - } - - public function testGetLocale() - { - $formatter = $this->getNumberFormatter('en', NumberFormatter::DECIMAL); - $this->assertEquals('en', $formatter->getLocale()); - } - - /** - * @dataProvider parseProvider - */ - public function testParse($value, $expected, $message = '') - { - $formatter = $this->getNumberFormatter('en', NumberFormatter::DECIMAL); - $parsedValue = $formatter->parse($value, NumberFormatter::TYPE_DOUBLE); - $this->assertSame($expected, $parsedValue, $message); - - if ($expected === false) { - $errorCode = IntlGlobals::U_PARSE_ERROR; - $errorMessage = 'Number parsing failed: U_PARSE_ERROR'; - } else { - $errorCode = IntlGlobals::U_ZERO_ERROR; - $errorMessage = 'U_ZERO_ERROR'; - } - - $this->assertSame($errorMessage, $this->getIntlErrorMessage()); - $this->assertSame($errorCode, $this->getIntlErrorCode()); - $this->assertSame($errorCode !== 0, $this->isIntlFailure($this->getIntlErrorCode())); - $this->assertSame($errorMessage, $formatter->getErrorMessage()); - $this->assertSame($errorCode, $formatter->getErrorCode()); - $this->assertSame($errorCode !== 0, $this->isIntlFailure($formatter->getErrorCode())); - } - - public function parseProvider() - { - return array( - array('prefix1', false, '->parse() does not parse a number with a string prefix.'), - array('1suffix', (float) 1, '->parse() parses a number with a string suffix.'), - ); - } - - /** - * @expectedException \PHPUnit_Framework_Error_Warning - */ - public function testParseTypeDefault() - { - $formatter = $this->getNumberFormatter('en', NumberFormatter::DECIMAL); - $formatter->parse('1', NumberFormatter::TYPE_DEFAULT); - } - - /** - * @dataProvider parseTypeInt32Provider - */ - public function testParseTypeInt32($value, $expected, $message = '') - { - $formatter = $this->getNumberFormatter('en', NumberFormatter::DECIMAL); - $parsedValue = $formatter->parse($value, NumberFormatter::TYPE_INT32); - $this->assertSame($expected, $parsedValue); - } - - public function parseTypeInt32Provider() - { - return array( - array('1', 1), - array('1.1', 1), - array('2,147,483,647', 2147483647), - array('-2,147,483,648', -2147483647 - 1), - array('2,147,483,648', false, '->parse() TYPE_INT32 returns false when the number is greater than the integer positive range.'), - array('-2,147,483,649', false, '->parse() TYPE_INT32 returns false when the number is greater than the integer negative range.') - ); - } - - public function testParseTypeInt64With32BitIntegerInPhp32Bit() - { - IntlTestHelper::require32Bit($this); - - $formatter = $this->getNumberFormatter('en', NumberFormatter::DECIMAL); - - $parsedValue = $formatter->parse('2,147,483,647', NumberFormatter::TYPE_INT64); - $this->assertInternalType('integer', $parsedValue); - $this->assertEquals(2147483647, $parsedValue); - - $parsedValue = $formatter->parse('-2,147,483,648', NumberFormatter::TYPE_INT64); - - // Bug #59597 was fixed on PHP 5.3.14 and 5.4.4 - // The negative PHP_INT_MAX was being converted to float - if ( - (version_compare(PHP_VERSION, '5.4.0', '<') && version_compare(PHP_VERSION, '5.3.14', '>=')) || - version_compare(PHP_VERSION, '5.4.4', '>=') - ) { - $this->assertInternalType('int', $parsedValue); - } else { - $this->assertInternalType('float', $parsedValue); - } - - $this->assertEquals(-2147483648, $parsedValue); - } - - public function testParseTypeInt64With32BitIntegerInPhp64Bit() - { - IntlTestHelper::require64Bit($this); - - $formatter = $this->getNumberFormatter('en', NumberFormatter::DECIMAL); - - $parsedValue = $formatter->parse('2,147,483,647', NumberFormatter::TYPE_INT64); - $this->assertInternalType('integer', $parsedValue); - $this->assertEquals(2147483647, $parsedValue); - - $parsedValue = $formatter->parse('-2,147,483,648', NumberFormatter::TYPE_INT64); - $this->assertInternalType('integer', $parsedValue); - $this->assertEquals(-2147483647 - 1, $parsedValue); - } - - /** - * If PHP is compiled in 32bit mode, the returned value for a 64bit integer are float numbers. - */ - public function testParseTypeInt64With64BitIntegerInPhp32Bit() - { - IntlTestHelper::require32Bit($this); - - $formatter = $this->getNumberFormatter('en', NumberFormatter::DECIMAL); - - // int 64 using only 32 bit range strangeness - $parsedValue = $formatter->parse('2,147,483,648', NumberFormatter::TYPE_INT64); - $this->assertInternalType('float', $parsedValue); - $this->assertEquals(2147483648, $parsedValue, '->parse() TYPE_INT64 does not use true 64 bit integers, using only the 32 bit range.'); - - $parsedValue = $formatter->parse('-2,147,483,649', NumberFormatter::TYPE_INT64); - $this->assertInternalType('float', $parsedValue); - $this->assertEquals(-2147483649, $parsedValue, '->parse() TYPE_INT64 does not use true 64 bit integers, using only the 32 bit range.'); - } - - /** - * If PHP is compiled in 64bit mode, the returned value for a 64bit integer are 32bit integer numbers. - */ - public function testParseTypeInt64With64BitIntegerInPhp64Bit() - { - IntlTestHelper::require64Bit($this); - - $formatter = $this->getNumberFormatter('en', NumberFormatter::DECIMAL); - - $parsedValue = $formatter->parse('2,147,483,648', NumberFormatter::TYPE_INT64); - $this->assertInternalType('integer', $parsedValue); - - // Bug #59597 was fixed on PHP 5.3.14 and 5.4.4 - // A 32 bit integer was being generated instead of a 64 bit integer - if ( - (version_compare(PHP_VERSION, '5.3.14', '<')) || - (version_compare(PHP_VERSION, '5.4.0', '>=') && version_compare(PHP_VERSION, '5.4.4', '<')) - ) { - $this->assertEquals(-2147483648, $parsedValue, '->parse() TYPE_INT64 does not use true 64 bit integers, using only the 32 bit range (PHP < 5.3.14 and PHP < 5.4.4).'); - } else { - $this->assertEquals(2147483648, $parsedValue, '->parse() TYPE_INT64 uses true 64 bit integers (PHP >= 5.3.14 and PHP >= 5.4.4).'); - } - - $parsedValue = $formatter->parse('-2,147,483,649', NumberFormatter::TYPE_INT64); - $this->assertInternalType('integer', $parsedValue); - - // Bug #59597 was fixed on PHP 5.3.14 and 5.4.4 - // A 32 bit integer was being generated instead of a 64 bit integer - if ( - (version_compare(PHP_VERSION, '5.3.14', '<')) || - (version_compare(PHP_VERSION, '5.4.0', '>=') && version_compare(PHP_VERSION, '5.4.4', '<')) - ) { - $this->assertEquals(2147483647, $parsedValue, '->parse() TYPE_INT64 does not use true 64 bit integers, using only the 32 bit range (PHP < 5.3.14 and PHP < 5.4.4).'); - } else { - $this->assertEquals(-2147483649, $parsedValue, '->parse() TYPE_INT64 uses true 64 bit integers (PHP >= 5.3.14 and PHP >= 5.4.4).'); - } - } - - /** - * @dataProvider parseTypeDoubleProvider - */ - public function testParseTypeDouble($value, $expectedValue) - { - $formatter = $this->getNumberFormatter('en', NumberFormatter::DECIMAL); - $parsedValue = $formatter->parse($value, NumberFormatter::TYPE_DOUBLE); - $this->assertSame($expectedValue, $parsedValue); - } - - public function parseTypeDoubleProvider() - { - return array( - array('1', (float) 1), - array('1.1', 1.1), - array('9,223,372,036,854,775,808', 9223372036854775808), - array('-9,223,372,036,854,775,809', -9223372036854775809), - ); - } - - /** - * @expectedException \PHPUnit_Framework_Error_Warning - */ - public function testParseTypeCurrency() - { - $formatter = $this->getNumberFormatter('en', NumberFormatter::DECIMAL); - $formatter->parse('1', NumberFormatter::TYPE_CURRENCY); - } - - public function testParseWithNullPositionValue() - { - $position = null; - $formatter = $this->getNumberFormatter('en', NumberFormatter::DECIMAL); - $formatter->parse('123', NumberFormatter::TYPE_INT32, $position); - $this->assertNull($position); - } - - public function testParseWithNotNullPositionValue() - { - $position = 1; - $formatter = $this->getNumberFormatter('en', NumberFormatter::DECIMAL); - $formatter->parse('123', NumberFormatter::TYPE_DOUBLE, $position); - $this->assertEquals(3, $position); - } - - /** - * @param string $locale - * @param null $style - * @param null $pattern - * - * @return \NumberFormatter - */ - abstract protected function getNumberFormatter($locale = 'en', $style = null, $pattern = null); - - /** - * @return string - */ - abstract protected function getIntlErrorMessage(); - - /** - * @return integer - */ - abstract protected function getIntlErrorCode(); - - /** - * @param integer $errorCode - * - * @return Boolean - */ - abstract protected function isIntlFailure($errorCode); -} diff --git a/vendor/symfony/intl/Symfony/Component/Intl/Tests/NumberFormatter/NumberFormatterTest.php b/vendor/symfony/intl/Symfony/Component/Intl/Tests/NumberFormatter/NumberFormatterTest.php deleted file mode 100644 index 36e89149..00000000 --- a/vendor/symfony/intl/Symfony/Component/Intl/Tests/NumberFormatter/NumberFormatterTest.php +++ /dev/null @@ -1,239 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Intl\Tests\NumberFormatter; - -use Symfony\Component\Intl\Globals\IntlGlobals; -use Symfony\Component\Intl\NumberFormatter\NumberFormatter; -use Symfony\Component\Intl\Util\IntlTestHelper; - -/** - * Note that there are some values written like -2147483647 - 1. This is the lower 32bit int max and is a known - * behavior of PHP. - */ -class NumberFormatterTest extends AbstractNumberFormatterTest -{ - protected function setUp() - { - IntlTestHelper::requireIntl($this); - - parent::setUp(); - } - - /** - * @expectedException \Symfony\Component\Intl\Exception\MethodArgumentValueNotImplementedException - */ - public function testConstructorWithUnsupportedLocale() - { - new NumberFormatter('pt_BR'); - } - - /** - * @expectedException \Symfony\Component\Intl\Exception\MethodArgumentValueNotImplementedException - */ - public function testConstructorWithUnsupportedStyle() - { - new NumberFormatter('en', NumberFormatter::PATTERN_DECIMAL); - } - - /** - * @expectedException \Symfony\Component\Intl\Exception\MethodArgumentNotImplementedException - */ - public function testConstructorWithPatternDifferentThanNull() - { - new NumberFormatter('en', NumberFormatter::DECIMAL, ''); - } - - /** - * @expectedException \Symfony\Component\Intl\Exception\MethodArgumentValueNotImplementedException - */ - public function testSetAttributeWithUnsupportedAttribute() - { - $formatter = $this->getNumberFormatter('en', NumberFormatter::DECIMAL); - $formatter->setAttribute(NumberFormatter::LENIENT_PARSE, null); - } - - /** - * @expectedException \Symfony\Component\Intl\Exception\MethodArgumentValueNotImplementedException - */ - public function testSetAttributeInvalidRoundingMode() - { - $formatter = $this->getNumberFormatter('en', NumberFormatter::DECIMAL); - $formatter->setAttribute(NumberFormatter::ROUNDING_MODE, null); - } - - public function testCreate() - { - $this->assertInstanceOf( - '\Symfony\Component\Intl\NumberFormatter\NumberFormatter', - NumberFormatter::create('en', NumberFormatter::DECIMAL) - ); - } - - /** - * @expectedException \RuntimeException - */ - public function testFormatWithCurrencyStyle() - { - parent::testFormatWithCurrencyStyle(); - } - - /** - * @dataProvider formatTypeInt32Provider - * @expectedException \Symfony\Component\Intl\Exception\MethodArgumentValueNotImplementedException - */ - public function testFormatTypeInt32($formatter, $value, $expected, $message = '') - { - parent::testFormatTypeInt32($formatter, $value, $expected, $message); - } - - /** - * @dataProvider formatTypeInt32WithCurrencyStyleProvider - * @expectedException \Symfony\Component\Intl\Exception\NotImplementedException - */ - public function testFormatTypeInt32WithCurrencyStyle($formatter, $value, $expected, $message = '') - { - parent::testFormatTypeInt32WithCurrencyStyle($formatter, $value, $expected, $message); - } - - /** - * @dataProvider formatTypeInt64Provider - * @expectedException \Symfony\Component\Intl\Exception\MethodArgumentValueNotImplementedException - */ - public function testFormatTypeInt64($formatter, $value, $expected) - { - parent::testFormatTypeInt64($formatter, $value, $expected); - } - - /** - * @dataProvider formatTypeInt64WithCurrencyStyleProvider - * @expectedException \Symfony\Component\Intl\Exception\NotImplementedException - */ - public function testFormatTypeInt64WithCurrencyStyle($formatter, $value, $expected) - { - parent::testFormatTypeInt64WithCurrencyStyle($formatter, $value, $expected); - } - - /** - * @dataProvider formatTypeDoubleProvider - * @expectedException \Symfony\Component\Intl\Exception\MethodArgumentValueNotImplementedException - */ - public function testFormatTypeDouble($formatter, $value, $expected) - { - parent::testFormatTypeDouble($formatter, $value, $expected); - } - - /** - * @dataProvider formatTypeDoubleWithCurrencyStyleProvider - * @expectedException \Symfony\Component\Intl\Exception\NotImplementedException - */ - public function testFormatTypeDoubleWithCurrencyStyle($formatter, $value, $expected) - { - parent::testFormatTypeDoubleWithCurrencyStyle($formatter, $value, $expected); - } - - /** - * @expectedException \Symfony\Component\Intl\Exception\MethodNotImplementedException - */ - public function testGetPattern() - { - $formatter = $this->getNumberFormatter('en', NumberFormatter::DECIMAL); - $formatter->getPattern(); - } - - /** - * @expectedException \Symfony\Component\Intl\Exception\MethodNotImplementedException - */ - public function testGetSymbol() - { - $formatter = $this->getNumberFormatter('en', NumberFormatter::DECIMAL); - $formatter->getSymbol(null); - } - - /** - * @expectedException \Symfony\Component\Intl\Exception\MethodNotImplementedException - */ - public function testGetTextAttribute() - { - $formatter = $this->getNumberFormatter('en', NumberFormatter::DECIMAL); - $formatter->getTextAttribute(null); - } - - public function testGetErrorCode() - { - $formatter = $this->getNumberFormatter('en', NumberFormatter::DECIMAL); - $this->assertEquals(IntlGlobals::U_ZERO_ERROR, $formatter->getErrorCode()); - } - - /** - * @expectedException \Symfony\Component\Intl\Exception\MethodNotImplementedException - */ - public function testParseCurrency() - { - $formatter = $this->getNumberFormatter('en', NumberFormatter::DECIMAL); - $formatter->parseCurrency(null, $currency); - } - - /** - * @expectedException \Symfony\Component\Intl\Exception\MethodArgumentNotImplementedException - */ - public function testParseWithNotNullPositionValue() - { - parent::testParseWithNotNullPositionValue(); - } - - /** - * @expectedException \Symfony\Component\Intl\Exception\MethodNotImplementedException - */ - public function testSetPattern() - { - $formatter = $this->getNumberFormatter('en', NumberFormatter::DECIMAL); - $formatter->setPattern(null); - } - - /** - * @expectedException \Symfony\Component\Intl\Exception\MethodNotImplementedException - */ - public function testSetSymbol() - { - $formatter = $this->getNumberFormatter('en', NumberFormatter::DECIMAL); - $formatter->setSymbol(null, null); - } - - /** - * @expectedException \Symfony\Component\Intl\Exception\MethodNotImplementedException - */ - public function testSetTextAttribute() - { - $formatter = $this->getNumberFormatter('en', NumberFormatter::DECIMAL); - $formatter->setTextAttribute(null, null); - } - - protected function getNumberFormatter($locale = 'en', $style = null, $pattern = null) - { - return new NumberFormatter($locale, $style, $pattern); - } - - protected function getIntlErrorMessage() - { - return IntlGlobals::getErrorMessage(); - } - - protected function getIntlErrorCode() - { - return IntlGlobals::getErrorCode(); - } - - protected function isIntlFailure($errorCode) - { - return IntlGlobals::isFailure($errorCode); - } -} diff --git a/vendor/symfony/intl/Symfony/Component/Intl/Tests/NumberFormatter/Verification/NumberFormatterTest.php b/vendor/symfony/intl/Symfony/Component/Intl/Tests/NumberFormatter/Verification/NumberFormatterTest.php deleted file mode 100644 index 28e6fe90..00000000 --- a/vendor/symfony/intl/Symfony/Component/Intl/Tests/NumberFormatter/Verification/NumberFormatterTest.php +++ /dev/null @@ -1,54 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Intl\Tests\NumberFormatter\Verification; - -use Symfony\Component\Intl\Tests\NumberFormatter\AbstractNumberFormatterTest; -use Symfony\Component\Intl\Util\IntlTestHelper; - -/** - * Note that there are some values written like -2147483647 - 1. This is the lower 32bit int max and is a known - * behavior of PHP. - */ -class NumberFormatterTest extends AbstractNumberFormatterTest -{ - protected function setUp() - { - IntlTestHelper::requireFullIntl($this); - - parent::setUp(); - } - - public function testCreate() - { - $this->assertInstanceOf('\NumberFormatter', \NumberFormatter::create('en', \NumberFormatter::DECIMAL)); - } - - protected function getNumberFormatter($locale = 'en', $style = null, $pattern = null) - { - return new \NumberFormatter($locale, $style, $pattern); - } - - protected function getIntlErrorMessage() - { - return intl_get_error_message(); - } - - protected function getIntlErrorCode() - { - return intl_get_error_code(); - } - - protected function isIntlFailure($errorCode) - { - return intl_is_failure($errorCode); - } -} diff --git a/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/AbstractBundleTest.php b/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/AbstractBundleTest.php deleted file mode 100644 index 6b075865..00000000 --- a/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/AbstractBundleTest.php +++ /dev/null @@ -1,55 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Intl\Tests\ResourceBundle; - -/** - * @author Bernhard Schussek - */ -class AbstractBundleTest extends \PHPUnit_Framework_TestCase -{ - const RES_DIR = '/base/dirName'; - - /** - * @var \Symfony\Component\Intl\ResourceBundle\AbstractBundle - */ - private $bundle; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - private $reader; - - protected function setUp() - { - $this->reader = $this->getMock('Symfony\Component\Intl\ResourceBundle\Reader\StructuredBundleReaderInterface'); - $this->bundle = $this->getMockForAbstractClass( - 'Symfony\Component\Intl\ResourceBundle\AbstractBundle', - array(self::RES_DIR, $this->reader) - ); - - $this->bundle->expects($this->any()) - ->method('getDirectoryName') - ->will($this->returnValue('dirName')); - } - - public function testGetLocales() - { - $locales = array('de', 'en', 'fr'); - - $this->reader->expects($this->once()) - ->method('getLocales') - ->with(self::RES_DIR) - ->will($this->returnValue($locales)); - - $this->assertSame($locales, $this->bundle->getLocales()); - } -} diff --git a/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/CurrencyBundleTest.php b/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/CurrencyBundleTest.php deleted file mode 100644 index b66a6727..00000000 --- a/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/CurrencyBundleTest.php +++ /dev/null @@ -1,98 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Intl\Tests\ResourceBundle; - -use Symfony\Component\Intl\ResourceBundle\CurrencyBundle; - -/** - * @author Bernhard Schussek - */ -class CurrencyBundleTest extends \PHPUnit_Framework_TestCase -{ - const RES_DIR = '/base/curr'; - - /** - * @var CurrencyBundle - */ - private $bundle; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - private $reader; - - protected function setUp() - { - $this->reader = $this->getMock('Symfony\Component\Intl\ResourceBundle\Reader\StructuredBundleReaderInterface'); - $this->bundle = new CurrencyBundle(self::RES_DIR, $this->reader); - } - - public function testGetCurrencySymbol() - { - $this->reader->expects($this->once()) - ->method('readEntry') - ->with(self::RES_DIR, 'en', array('Currencies', 'EUR', 1)) - ->will($this->returnValue('€')); - - $this->assertSame('€', $this->bundle->getCurrencySymbol('EUR', 'en')); - } - - public function testGetCurrencyName() - { - $this->reader->expects($this->once()) - ->method('readEntry') - ->with(self::RES_DIR, 'en', array('Currencies', 'EUR', 0)) - ->will($this->returnValue('Euro')); - - $this->assertSame('Euro', $this->bundle->getCurrencyName('EUR', 'en')); - } - - public function testGetCurrencyNames() - { - $sortedCurrencies = array( - 'USD' => array(0 => 'Dollar'), - 'EUR' => array(0 => 'Euro'), - ); - - $this->reader->expects($this->once()) - ->method('readEntry') - ->with(self::RES_DIR, 'en', array('Currencies')) - ->will($this->returnValue($sortedCurrencies)); - - $sortedNames = array( - 'USD' => 'Dollar', - 'EUR' => 'Euro', - ); - - $this->assertSame($sortedNames, $this->bundle->getCurrencyNames('en')); - } - - public function testGetFractionDigits() - { - $this->reader->expects($this->once()) - ->method('readEntry') - ->with(self::RES_DIR, 'en', array('Currencies', 'EUR', 2)) - ->will($this->returnValue(123)); - - $this->assertSame(123, $this->bundle->getFractionDigits('EUR')); - } - - public function testGetRoundingIncrement() - { - $this->reader->expects($this->once()) - ->method('readEntry') - ->with(self::RES_DIR, 'en', array('Currencies', 'EUR', 3)) - ->will($this->returnValue(123)); - - $this->assertSame(123, $this->bundle->getRoundingIncrement('EUR')); - } -} diff --git a/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/LanguageBundleTest.php b/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/LanguageBundleTest.php deleted file mode 100644 index 96031fc7..00000000 --- a/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/LanguageBundleTest.php +++ /dev/null @@ -1,197 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Intl\Tests\ResourceBundle; - -use Symfony\Component\Intl\ResourceBundle\LanguageBundle; - -/** - * @author Bernhard Schussek - */ -class LanguageBundleTest extends \PHPUnit_Framework_TestCase -{ - const RES_DIR = '/base/lang'; - - /** - * @var LanguageBundle - */ - private $bundle; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - private $reader; - - protected function setUp() - { - $this->reader = $this->getMock('Symfony\Component\Intl\ResourceBundle\Reader\StructuredBundleReaderInterface'); - $this->bundle = new LanguageBundle(self::RES_DIR, $this->reader); - } - - public function testGetLanguageName() - { - $languages = array( - 'de' => 'German', - 'en' => 'English', - ); - - $this->reader->expects($this->once()) - ->method('readEntry') - ->with(self::RES_DIR, 'en', array('Languages')) - ->will($this->returnValue($languages)); - - $this->assertSame('German', $this->bundle->getLanguageName('de', null, 'en')); - } - - public function testGetLanguageNameWithRegion() - { - $languages = array( - 'de' => 'German', - 'en' => 'English', - 'en_GB' => 'British English', - ); - - $this->reader->expects($this->once()) - ->method('readEntry') - ->with(self::RES_DIR, 'en', array('Languages')) - ->will($this->returnValue($languages)); - - $this->assertSame('British English', $this->bundle->getLanguageName('en', 'GB', 'en')); - } - - public function testGetLanguageNameWithUntranslatedRegion() - { - $languages = array( - 'de' => 'German', - 'en' => 'English', - ); - - $this->reader->expects($this->once()) - ->method('readEntry') - ->with(self::RES_DIR, 'en', array('Languages')) - ->will($this->returnValue($languages)); - - $this->assertSame('English', $this->bundle->getLanguageName('en', 'US', 'en')); - } - - public function testGetLanguageNames() - { - $sortedLanguages = array( - 'en' => 'English', - 'de' => 'German', - ); - - $this->reader->expects($this->once()) - ->method('readEntry') - ->with(self::RES_DIR, 'en', array('Languages')) - ->will($this->returnValue($sortedLanguages)); - - $this->assertSame($sortedLanguages, $this->bundle->getLanguageNames('en')); - } - - public function testGetScriptName() - { - $data = array( - 'Languages' => array( - 'de' => 'German', - 'en' => 'English', - ), - 'Scripts' => array( - 'Latn' => 'latin', - 'Cyrl' => 'cyrillique', - ), - ); - - $this->reader->expects($this->once()) - ->method('read') - ->with(self::RES_DIR, 'en') - ->will($this->returnValue($data)); - - $this->assertSame('latin', $this->bundle->getScriptName('Latn', null, 'en')); - } - - public function testGetScriptNameIncludedInLanguage() - { - $data = array( - 'Languages' => array( - 'de' => 'German', - 'en' => 'English', - 'zh_Hans' => 'Simplified Chinese', - ), - 'Scripts' => array( - 'Latn' => 'latin', - 'Cyrl' => 'cyrillique', - ), - ); - - $this->reader->expects($this->once()) - ->method('read') - ->with(self::RES_DIR, 'en') - ->will($this->returnValue($data)); - - // Null because the script is included in the language anyway - $this->assertNull($this->bundle->getScriptName('Hans', 'zh', 'en')); - } - - public function testGetScriptNameIncludedInLanguageInBraces() - { - $data = array( - 'Languages' => array( - 'de' => 'German', - 'en' => 'English', - 'zh_Hans' => 'Chinese (simplified)', - ), - 'Scripts' => array( - 'Latn' => 'latin', - 'Cyrl' => 'cyrillique', - ), - ); - - $this->reader->expects($this->once()) - ->method('read') - ->with(self::RES_DIR, 'en') - ->will($this->returnValue($data)); - - $this->assertSame('simplified', $this->bundle->getScriptName('Hans', 'zh', 'en')); - } - - public function testGetScriptNameNoScriptsBlock() - { - $data = array( - 'Languages' => array( - 'de' => 'German', - 'en' => 'English', - ), - ); - - $this->reader->expects($this->once()) - ->method('read') - ->with(self::RES_DIR, 'en') - ->will($this->returnValue($data)); - - $this->assertNull($this->bundle->getScriptName('Latn', null, 'en')); - } - - public function testGetScriptNames() - { - $sortedScripts = array( - 'Cyrl' => 'cyrillique', - 'Latn' => 'latin', - ); - - $this->reader->expects($this->once()) - ->method('readEntry') - ->with(self::RES_DIR, 'en', array('Scripts')) - ->will($this->returnValue($sortedScripts)); - - $this->assertSame($sortedScripts, $this->bundle->getScriptNames('en')); - } -} diff --git a/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/LocaleBundleTest.php b/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/LocaleBundleTest.php deleted file mode 100644 index ddfdc3d2..00000000 --- a/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/LocaleBundleTest.php +++ /dev/null @@ -1,64 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Intl\Tests\ResourceBundle; - -use Symfony\Component\Intl\ResourceBundle\LocaleBundle; - -/** - * @author Bernhard Schussek - */ -class LocaleBundleTest extends \PHPUnit_Framework_TestCase -{ - const RES_DIR = '/base/locales'; - - /** - * @var LocaleBundle - */ - private $bundle; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - private $reader; - - protected function setUp() - { - $this->reader = $this->getMock('Symfony\Component\Intl\ResourceBundle\Reader\StructuredBundleReaderInterface'); - $this->bundle = new LocaleBundle(self::RES_DIR, $this->reader); - } - - public function testGetLocaleName() - { - $this->reader->expects($this->once()) - ->method('readEntry') - ->with(self::RES_DIR, 'en', array('Locales', 'de_AT')) - ->will($this->returnValue('German (Austria)')); - - $this->assertSame('German (Austria)', $this->bundle->getLocaleName('de_AT', 'en')); - } - - public function testGetLocaleNames() - { - $sortedLocales = array( - 'en_IE' => 'English (Ireland)', - 'en_GB' => 'English (United Kingdom)', - 'en_US' => 'English (United States)', - ); - - $this->reader->expects($this->once()) - ->method('readEntry') - ->with(self::RES_DIR, 'en', array('Locales')) - ->will($this->returnValue($sortedLocales)); - - $this->assertSame($sortedLocales, $this->bundle->getLocaleNames('en')); - } -} diff --git a/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Reader/AbstractBundleReaderTest.php b/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Reader/AbstractBundleReaderTest.php deleted file mode 100644 index 2da7f90d..00000000 --- a/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Reader/AbstractBundleReaderTest.php +++ /dev/null @@ -1,64 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Intl\Tests\ResourceBundle\Reader; - -use Symfony\Component\Filesystem\Filesystem; - -/** - * @author Bernhard Schussek - */ -class AbstractBundleReaderTest extends \PHPUnit_Framework_TestCase -{ - private $directory; - - /** - * @var Filesystem - */ - private $filesystem; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - private $reader; - - protected function setUp() - { - $this->directory = sys_get_temp_dir() . '/AbstractBundleReaderTest/' . rand(1000, 9999); - $this->filesystem = new Filesystem(); - $this->reader = $this->getMockForAbstractClass('Symfony\Component\Intl\ResourceBundle\Reader\AbstractBundleReader'); - - $this->filesystem->mkdir($this->directory); - } - - protected function tearDown() - { - $this->filesystem->remove($this->directory); - } - - public function testGetLocales() - { - $this->filesystem->touch($this->directory . '/en.foo'); - $this->filesystem->touch($this->directory . '/de.foo'); - $this->filesystem->touch($this->directory . '/fr.foo'); - $this->filesystem->touch($this->directory . '/bo.txt'); - $this->filesystem->touch($this->directory . '/gu.bin'); - $this->filesystem->touch($this->directory . '/s.lol'); - - $this->reader->expects($this->any()) - ->method('getFileExtension') - ->will($this->returnValue('foo')); - - $sortedLocales = array('de', 'en', 'fr'); - - $this->assertSame($sortedLocales, $this->reader->getLocales($this->directory)); - } -} diff --git a/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Reader/BinaryBundleReaderTest.php b/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Reader/BinaryBundleReaderTest.php deleted file mode 100644 index 3aefbae7..00000000 --- a/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Reader/BinaryBundleReaderTest.php +++ /dev/null @@ -1,58 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Intl\Tests\ResourceBundle\Reader; - -use Symfony\Component\Intl\ResourceBundle\Reader\BinaryBundleReader; -use Symfony\Component\Intl\Util\IntlTestHelper; - -/** - * @author Bernhard Schussek - */ -class BinaryBundleReaderTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var BinaryBundleReader - */ - private $reader; - - protected function setUp() - { - IntlTestHelper::requireFullIntl($this); - - $this->reader = new BinaryBundleReader(); - } - - public function testReadReturnsArrayAccess() - { - $data = $this->reader->read(__DIR__ . '/Fixtures', 'en'); - - $this->assertInstanceOf('\ArrayAccess', $data); - $this->assertSame('Bar', $data['Foo']); - $this->assertFalse(isset($data['ExistsNot'])); - } - - /** - * @expectedException \Symfony\Component\Intl\Exception\RuntimeException - */ - public function testReadFailsIfNonExistingLocale() - { - $this->reader->read(__DIR__ . '/Fixtures', 'foo'); - } - - /** - * @expectedException \Symfony\Component\Intl\Exception\RuntimeException - */ - public function testReadFailsIfNonExistingDirectory() - { - $this->reader->read(__DIR__ . '/foo', 'en'); - } -} diff --git a/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Reader/Fixtures/NotAFile/en.php/.gitkeep b/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Reader/Fixtures/NotAFile/en.php/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Reader/Fixtures/en.php b/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Reader/Fixtures/en.php deleted file mode 100644 index f2b06a91..00000000 --- a/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Reader/Fixtures/en.php +++ /dev/null @@ -1,14 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -return array( - 'Foo' => 'Bar', -); diff --git a/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Reader/Fixtures/en.res b/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Reader/Fixtures/en.res deleted file mode 100644 index c78e9045..00000000 Binary files a/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Reader/Fixtures/en.res and /dev/null differ diff --git a/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Reader/Fixtures/en.txt b/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Reader/Fixtures/en.txt deleted file mode 100644 index c788e996..00000000 --- a/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Reader/Fixtures/en.txt +++ /dev/null @@ -1,3 +0,0 @@ -en{ - Foo{"Bar"} -} diff --git a/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Reader/PhpBundleReaderTest.php b/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Reader/PhpBundleReaderTest.php deleted file mode 100644 index 2fee3559..00000000 --- a/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Reader/PhpBundleReaderTest.php +++ /dev/null @@ -1,63 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Intl\Tests\ResourceBundle\Reader; - -use Symfony\Component\Intl\ResourceBundle\Reader\PhpBundleReader; - -/** - * @author Bernhard Schussek - */ -class PhpBundleReaderTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var PhpBundleReader - */ - private $reader; - - protected function setUp() - { - $this->reader = new PhpBundleReader(); - } - - public function testReadReturnsArray() - { - $data = $this->reader->read(__DIR__ . '/Fixtures', 'en'); - - $this->assertTrue(is_array($data)); - $this->assertSame('Bar', $data['Foo']); - $this->assertFalse(isset($data['ExistsNot'])); - } - - /** - * @expectedException \Symfony\Component\Intl\Exception\InvalidArgumentException - */ - public function testReadFailsIfLocaleOtherThanEn() - { - $this->reader->read(__DIR__ . '/Fixtures', 'foo'); - } - - /** - * @expectedException \Symfony\Component\Intl\Exception\RuntimeException - */ - public function testReadFailsIfNonExistingDirectory() - { - $this->reader->read(__DIR__ . '/foo', 'en'); - } - - /** - * @expectedException \Symfony\Component\Intl\Exception\RuntimeException - */ - public function testReadFailsIfNotAFile() - { - $this->reader->read(__DIR__ . '/Fixtures/NotAFile', 'en'); - } -} diff --git a/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Reader/StructuredBundleReaderTest.php b/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Reader/StructuredBundleReaderTest.php deleted file mode 100644 index 600236eb..00000000 --- a/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Reader/StructuredBundleReaderTest.php +++ /dev/null @@ -1,223 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Intl\Tests\ResourceBundle\Reader; - -use Symfony\Component\Intl\ResourceBundle\Reader\StructuredBundleReader; - -/** - * @author Bernhard Schussek - */ -class StructuredBundleReaderTest extends \PHPUnit_Framework_TestCase -{ - const RES_DIR = '/res/dir'; - - /** - * @var StructuredBundleReader - */ - private $reader; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - private $readerImpl; - - protected function setUp() - { - $this->readerImpl = $this->getMock('Symfony\Component\Intl\ResourceBundle\Reader\StructuredBundleReaderInterface'); - $this->reader = new StructuredBundleReader($this->readerImpl); - } - - public function testGetLocales() - { - $locales = array('en', 'de', 'fr'); - - $this->readerImpl->expects($this->once()) - ->method('getLocales') - ->with(self::RES_DIR) - ->will($this->returnValue($locales)); - - $this->assertSame($locales, $this->reader->getLocales(self::RES_DIR)); - } - - public function testRead() - { - $data = array('foo', 'bar'); - - $this->readerImpl->expects($this->once()) - ->method('read') - ->with(self::RES_DIR, 'en') - ->will($this->returnValue($data)); - - $this->assertSame($data, $this->reader->read(self::RES_DIR, 'en')); - } - - public function testReadEntryNoParams() - { - $data = array('foo', 'bar'); - - $this->readerImpl->expects($this->once()) - ->method('read') - ->with(self::RES_DIR, 'en') - ->will($this->returnValue($data)); - - $this->assertSame($data, $this->reader->readEntry(self::RES_DIR, 'en', array())); - } - - public function testReadEntryWithParam() - { - $data = array('Foo' => array('Bar' => 'Baz')); - - $this->readerImpl->expects($this->once()) - ->method('read') - ->with(self::RES_DIR, 'en') - ->will($this->returnValue($data)); - - $this->assertSame('Baz', $this->reader->readEntry(self::RES_DIR, 'en', array('Foo', 'Bar'))); - } - - public function testReadEntryWithUnresolvablePath() - { - $data = array('Foo' => 'Baz'); - - $this->readerImpl->expects($this->once()) - ->method('read') - ->with(self::RES_DIR, 'en') - ->will($this->returnValue($data)); - - $this->assertNull($this->reader->readEntry(self::RES_DIR, 'en', array('Foo', 'Bar'))); - } - - public function readMergedEntryProvider() - { - return array( - array('foo', null, 'foo'), - array(null, 'foo', 'foo'), - array(array('foo', 'bar'), null, array('foo', 'bar')), - array(array('foo', 'bar'), array(), array('foo', 'bar')), - array(null, array('baz'), array('baz')), - array(array(), array('baz'), array('baz')), - array(array('foo', 'bar'), array('baz'), array('baz', 'foo', 'bar')), - ); - } - - /** - * @dataProvider readMergedEntryProvider - */ - public function testReadMergedEntryNoParams($childData, $parentData, $result) - { - $this->readerImpl->expects($this->at(0)) - ->method('read') - ->with(self::RES_DIR, 'en_GB') - ->will($this->returnValue($childData)); - - if (null === $childData || is_array($childData)) { - $this->readerImpl->expects($this->at(1)) - ->method('read') - ->with(self::RES_DIR, 'en') - ->will($this->returnValue($parentData)); - } - - $this->assertSame($result, $this->reader->readEntry(self::RES_DIR, 'en_GB', array(), true)); - } - - /** - * @dataProvider readMergedEntryProvider - */ - public function testReadMergedEntryWithParams($childData, $parentData, $result) - { - $this->readerImpl->expects($this->at(0)) - ->method('read') - ->with(self::RES_DIR, 'en_GB') - ->will($this->returnValue(array('Foo' => array('Bar' => $childData)))); - - if (null === $childData || is_array($childData)) { - $this->readerImpl->expects($this->at(1)) - ->method('read') - ->with(self::RES_DIR, 'en') - ->will($this->returnValue(array('Foo' => array('Bar' => $parentData)))); - } - - $this->assertSame($result, $this->reader->readEntry(self::RES_DIR, 'en_GB', array('Foo', 'Bar'), true)); - } - - public function testReadMergedEntryWithUnresolvablePath() - { - $this->readerImpl->expects($this->at(0)) - ->method('read') - ->with(self::RES_DIR, 'en_GB') - ->will($this->returnValue(array('Foo' => 'Baz'))); - - $this->readerImpl->expects($this->at(1)) - ->method('read') - ->with(self::RES_DIR, 'en') - ->will($this->returnValue(array('Foo' => 'Bar'))); - - $this->assertNull($this->reader->readEntry(self::RES_DIR, 'en_GB', array('Foo', 'Bar'), true)); - } - - public function testReadMergedEntryWithUnresolvablePathInParent() - { - $this->readerImpl->expects($this->at(0)) - ->method('read') - ->with(self::RES_DIR, 'en_GB') - ->will($this->returnValue(array('Foo' => array('Bar' => array('three'))))); - - $this->readerImpl->expects($this->at(1)) - ->method('read') - ->with(self::RES_DIR, 'en') - ->will($this->returnValue(array('Foo' => 'Bar'))); - - $result = array('three'); - - $this->assertSame($result, $this->reader->readEntry(self::RES_DIR, 'en_GB', array('Foo', 'Bar'), true)); - } - - public function testReadMergedEntryWithUnresolvablePathInChild() - { - $this->readerImpl->expects($this->at(0)) - ->method('read') - ->with(self::RES_DIR, 'en_GB') - ->will($this->returnValue(array('Foo' => 'Baz'))); - - $this->readerImpl->expects($this->at(1)) - ->method('read') - ->with(self::RES_DIR, 'en') - ->will($this->returnValue(array('Foo' => array('Bar' => array('one', 'two'))))); - - $result = array('one', 'two'); - - $this->assertSame($result, $this->reader->readEntry(self::RES_DIR, 'en_GB', array('Foo', 'Bar'), true)); - } - - /** - * @dataProvider readMergedEntryProvider - */ - public function testReadMergedEntryWithTraversables($childData, $parentData, $result) - { - $parentData = is_array($parentData) ? new \ArrayObject($parentData) : $parentData; - $childData = is_array($childData) ? new \ArrayObject($childData) : $childData; - - $this->readerImpl->expects($this->at(0)) - ->method('read') - ->with(self::RES_DIR, 'en_GB') - ->will($this->returnValue(array('Foo' => array('Bar' => $childData)))); - - if (null === $childData || $childData instanceof \ArrayObject) { - $this->readerImpl->expects($this->at(1)) - ->method('read') - ->with(self::RES_DIR, 'en') - ->will($this->returnValue(array('Foo' => array('Bar' => $parentData)))); - } - - $this->assertSame($result, $this->reader->readEntry(self::RES_DIR, 'en_GB', array('Foo', 'Bar'), true)); - } -} diff --git a/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/RegionBundleTest.php b/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/RegionBundleTest.php deleted file mode 100644 index ccdf904c..00000000 --- a/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/RegionBundleTest.php +++ /dev/null @@ -1,63 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Intl\Tests\ResourceBundle; - -use Symfony\Component\Intl\ResourceBundle\RegionBundle; - -/** - * @author Bernhard Schussek - */ -class RegionBundleTest extends \PHPUnit_Framework_TestCase -{ - const RES_DIR = '/base/region'; - - /** - * @var RegionBundle - */ - private $bundle; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - private $reader; - - protected function setUp() - { - $this->reader = $this->getMock('Symfony\Component\Intl\ResourceBundle\Reader\StructuredBundleReaderInterface'); - $this->bundle = new RegionBundle(self::RES_DIR, $this->reader); - } - - public function testGetCountryName() - { - $this->reader->expects($this->once()) - ->method('readEntry') - ->with(self::RES_DIR, 'en', array('Countries', 'AT')) - ->will($this->returnValue('Austria')); - - $this->assertSame('Austria', $this->bundle->getCountryName('AT', 'en')); - } - - public function testGetCountryNames() - { - $sortedCountries = array( - 'AT' => 'Austria', - 'DE' => 'Germany', - ); - - $this->reader->expects($this->once()) - ->method('readEntry') - ->with(self::RES_DIR, 'en', array('Countries')) - ->will($this->returnValue($sortedCountries)); - - $this->assertSame($sortedCountries, $this->bundle->getCountryNames('en')); - } -} diff --git a/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Util/RingBufferTest.php b/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Util/RingBufferTest.php deleted file mode 100644 index d6f7d8a0..00000000 --- a/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Util/RingBufferTest.php +++ /dev/null @@ -1,101 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Intl\Tests\ResourceBundle\Util; - -use Symfony\Component\Intl\ResourceBundle\Util\RingBuffer; - -/** - * @author Bernhard Schussek - */ -class RingBufferTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var RingBuffer - */ - private $buffer; - - protected function setUp() - { - $this->buffer = new RingBuffer(2); - } - - public function testWriteWithinBuffer() - { - $this->buffer[0] = 'foo'; - $this->buffer['bar'] = 'baz'; - - $this->assertTrue(isset($this->buffer[0])); - $this->assertTrue(isset($this->buffer['bar'])); - $this->assertSame('foo', $this->buffer[0]); - $this->assertSame('baz', $this->buffer['bar']); - } - - public function testWritePastBuffer() - { - $this->buffer[0] = 'foo'; - $this->buffer['bar'] = 'baz'; - $this->buffer[2] = 'bam'; - - $this->assertTrue(isset($this->buffer['bar'])); - $this->assertTrue(isset($this->buffer[2])); - $this->assertSame('baz', $this->buffer['bar']); - $this->assertSame('bam', $this->buffer[2]); - } - - /** - * @expectedException \Symfony\Component\Intl\Exception\OutOfBoundsException - */ - public function testReadNonExistingFails() - { - $this->buffer['foo']; - } - - public function testQueryNonExisting() - { - $this->assertFalse(isset($this->buffer['foo'])); - } - - public function testUnsetNonExistingSucceeds() - { - unset($this->buffer['foo']); - - $this->assertFalse(isset($this->buffer['foo'])); - } - - /** - * @expectedException \Symfony\Component\Intl\Exception\OutOfBoundsException - */ - public function testReadOverwrittenFails() - { - $this->buffer[0] = 'foo'; - $this->buffer['bar'] = 'baz'; - $this->buffer[2] = 'bam'; - - $this->buffer[0]; - } - - public function testQueryOverwritten() - { - $this->assertFalse(isset($this->buffer[0])); - } - - public function testUnsetOverwrittenSucceeds() - { - $this->buffer[0] = 'foo'; - $this->buffer['bar'] = 'baz'; - $this->buffer[2] = 'bam'; - - unset($this->buffer[0]); - - $this->assertFalse(isset($this->buffer[0])); - } -} diff --git a/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Writer/Fixtures/en.php b/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Writer/Fixtures/en.php deleted file mode 100644 index 1ded57a7..00000000 --- a/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Writer/Fixtures/en.php +++ /dev/null @@ -1,23 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -return array( - 'Entry1' => array( - 'Array' => array( - 0 => 'foo', - 1 => 'bar', - ), - 'Integer' => 5, - 'Boolean' => false, - 'Float' => 1.23, - ), - 'Entry2' => 'String', -); diff --git a/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Writer/Fixtures/en.res b/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Writer/Fixtures/en.res deleted file mode 100644 index 7c1f71eb..00000000 Binary files a/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Writer/Fixtures/en.res and /dev/null differ diff --git a/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Writer/Fixtures/en.txt b/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Writer/Fixtures/en.txt deleted file mode 100644 index 0ee0d7f2..00000000 --- a/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Writer/Fixtures/en.txt +++ /dev/null @@ -1,23 +0,0 @@ -en{ - Entry1{ - Array{ - "foo", - "bar", - { - Key{"value"} - }, - } - Integer:int{5} - IntVector:intvector{ - 0, - 1, - 2, - 3, - } - FalseBoolean{"false"} - TrueBoolean{"true"} - Null{""} - Float{"1.23"} - } - Entry2{"String"} -} diff --git a/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Writer/PhpBundleWriterTest.php b/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Writer/PhpBundleWriterTest.php deleted file mode 100644 index 03302834..00000000 --- a/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Writer/PhpBundleWriterTest.php +++ /dev/null @@ -1,62 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Intl\Tests\ResourceBundle\Writer; - -use Symfony\Component\Filesystem\Filesystem; -use Symfony\Component\Intl\ResourceBundle\Writer\PhpBundleWriter; - -/** - * @author Bernhard Schussek - */ -class PhpBundleWriterTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var PhpBundleWriter - */ - private $writer; - - private $directory; - - /** - * @var Filesystem - */ - private $filesystem; - - protected function setUp() - { - $this->writer = new PhpBundleWriter(); - $this->directory = sys_get_temp_dir() . '/PhpBundleWriterTest/' . rand(1000, 9999); - $this->filesystem = new Filesystem(); - - $this->filesystem->mkdir($this->directory); - } - - protected function tearDown() - { - $this->filesystem->remove($this->directory); - } - - public function testWrite() - { - $this->writer->write($this->directory, 'en', array( - 'Entry1' => array( - 'Array' => array('foo', 'bar'), - 'Integer' => 5, - 'Boolean' => false, - 'Float' => 1.23, - ), - 'Entry2' => 'String', - )); - - $this->assertFileEquals(__DIR__ . '/Fixtures/en.php', $this->directory . '/en.php'); - } -} diff --git a/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Writer/TextBundleWriterTest.php b/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Writer/TextBundleWriterTest.php deleted file mode 100644 index cbe0c8d8..00000000 --- a/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Writer/TextBundleWriterTest.php +++ /dev/null @@ -1,67 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Intl\Tests\ResourceBundle\Writer; - -use Symfony\Component\Filesystem\Filesystem; -use Symfony\Component\Intl\ResourceBundle\Writer\TextBundleWriter; - -/** - * @author Bernhard Schussek - * - * @see http://source.icu-project.org/repos/icu/icuhtml/trunk/design/bnf_rb.txt - */ -class TextBundleWriterTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var TextBundleWriter - */ - private $writer; - - private $directory; - - /** - * @var Filesystem - */ - private $filesystem; - - protected function setUp() - { - $this->writer = new TextBundleWriter(); - $this->directory = sys_get_temp_dir() . '/TextBundleWriterTest/' . rand(1000, 9999); - $this->filesystem = new Filesystem(); - - $this->filesystem->mkdir($this->directory); - } - - protected function tearDown() - { - $this->filesystem->remove($this->directory); - } - - public function testWrite() - { - $this->writer->write($this->directory, 'en', array( - 'Entry1' => array( - 'Array' => array('foo', 'bar', array('Key' => 'value')), - 'Integer' => 5, - 'IntVector' => array(0, 1, 2, 3), - 'FalseBoolean' => false, - 'TrueBoolean' => true, - 'Null' => null, - 'Float' => 1.23, - ), - 'Entry2' => 'String', - )); - - $this->assertFileEquals(__DIR__ . '/Fixtures/en.txt', $this->directory . '/en.txt'); - } -} diff --git a/vendor/symfony/intl/Symfony/Component/Intl/Tests/Util/IcuVersionTest.php b/vendor/symfony/intl/Symfony/Component/Intl/Tests/Util/IcuVersionTest.php deleted file mode 100644 index d1a7e8c1..00000000 --- a/vendor/symfony/intl/Symfony/Component/Intl/Tests/Util/IcuVersionTest.php +++ /dev/null @@ -1,111 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Intl\Tests\Util; - -use Symfony\Component\Intl\Util\IcuVersion; - -/** - * @author Bernhard Schussek - */ -class IcuVersionTest extends \PHPUnit_Framework_TestCase -{ - public function normalizeProvider() - { - return array( - array(null, '1', '10'), - array(null, '1.2', '12'), - array(null, '1.2.3', '12.3'), - array(null, '1.2.3.4', '12.3.4'), - array(1, '1', '10'), - array(1, '1.2', '12'), - array(1, '1.2.3', '12'), - array(1, '1.2.3.4', '12'), - array(2, '1', '10'), - array(2, '1.2', '12'), - array(2, '1.2.3', '12.3'), - array(2, '1.2.3.4', '12.3'), - array(3, '1', '10'), - array(3, '1.2', '12'), - array(3, '1.2.3', '12.3'), - array(3, '1.2.3.4', '12.3.4'), - ); - } - - /** - * @dataProvider normalizeProvider - */ - public function testNormalize($precision, $version, $result) - { - $this->assertSame($result, IcuVersion::normalize($version, $precision)); - } - - public function compareProvider() - { - return array( - array(null, '1', '==', '1', true), - array(null, '1.0', '==', '1.1', false), - array(null, '1.0.0', '==', '1.0.1', false), - array(null, '1.0.0.0', '==', '1.0.0.1', false), - array(null, '1.0.0.0.0', '==', '1.0.0.0.1', false), - - array(null, '1', '==', '10', true), - array(null, '1.0', '==', '11', false), - array(null, '1.0.0', '==', '10.1', false), - array(null, '1.0.0.0', '==', '10.0.1', false), - array(null, '1.0.0.0.0', '==', '10.0.0.1', false), - - array(1, '1', '==', '1', true), - array(1, '1.0', '==', '1.1', false), - array(1, '1.0.0', '==', '1.0.1', true), - array(1, '1.0.0.0', '==', '1.0.0.1', true), - array(1, '1.0.0.0.0', '==', '1.0.0.0.1', true), - - array(1, '1', '==', '10', true), - array(1, '1.0', '==', '11', false), - array(1, '1.0.0', '==', '10.1', true), - array(1, '1.0.0.0', '==', '10.0.1', true), - array(1, '1.0.0.0.0', '==', '10.0.0.1', true), - - array(2, '1', '==', '1', true), - array(2, '1.0', '==', '1.1', false), - array(2, '1.0.0', '==', '1.0.1', false), - array(2, '1.0.0.0', '==', '1.0.0.1', true), - array(2, '1.0.0.0.0', '==', '1.0.0.0.1', true), - - array(2, '1', '==', '10', true), - array(2, '1.0', '==', '11', false), - array(2, '1.0.0', '==', '10.1', false), - array(2, '1.0.0.0', '==', '10.0.1', true), - array(2, '1.0.0.0.0', '==', '10.0.0.1', true), - - array(3, '1', '==', '1', true), - array(3, '1.0', '==', '1.1', false), - array(3, '1.0.0', '==', '1.0.1', false), - array(3, '1.0.0.0', '==', '1.0.0.1', false), - array(3, '1.0.0.0.0', '==', '1.0.0.0.1', true), - - array(3, '1', '==', '10', true), - array(3, '1.0', '==', '11', false), - array(3, '1.0.0', '==', '10.1', false), - array(3, '1.0.0.0', '==', '10.0.1', false), - array(3, '1.0.0.0.0', '==', '10.0.0.1', true), - ); - } - - /** - * @dataProvider compareProvider - */ - public function testCompare($precision, $version1, $operator, $version2, $result) - { - $this->assertSame($result, IcuVersion::compare($version1, $version2, $operator, $precision)); - } -} diff --git a/vendor/symfony/intl/Symfony/Component/Intl/Tests/Util/VersionTest.php b/vendor/symfony/intl/Symfony/Component/Intl/Tests/Util/VersionTest.php deleted file mode 100644 index 60cec6c0..00000000 --- a/vendor/symfony/intl/Symfony/Component/Intl/Tests/Util/VersionTest.php +++ /dev/null @@ -1,87 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Intl\Tests\Util; - -use Symfony\Component\Intl\Util\Version; - -/** - * @author Bernhard Schussek - */ -class VersionTest extends \PHPUnit_Framework_TestCase -{ - public function normalizeProvider() - { - return array( - array(null, '1', '1'), - array(null, '1.2', '1.2'), - array(null, '1.2.3', '1.2.3'), - array(null, '1.2.3.4', '1.2.3.4'), - array(1, '1', '1'), - array(1, '1.2', '1'), - array(1, '1.2.3', '1'), - array(1, '1.2.3.4', '1'), - array(2, '1', '1'), - array(2, '1.2', '1.2'), - array(2, '1.2.3', '1.2'), - array(2, '1.2.3.4', '1.2'), - array(3, '1', '1'), - array(3, '1.2', '1.2'), - array(3, '1.2.3', '1.2.3'), - array(3, '1.2.3.4', '1.2.3'), - array(4, '1', '1'), - array(4, '1.2', '1.2'), - array(4, '1.2.3', '1.2.3'), - array(4, '1.2.3.4', '1.2.3.4'), - ); - } - - /** - * @dataProvider normalizeProvider - */ - public function testNormalize($precision, $version, $result) - { - $this->assertSame($result, Version::normalize($version, $precision)); - } - - public function compareProvider() - { - return array( - array(null, '1', '==', '1', true), - array(null, '1.0', '==', '1.1', false), - array(null, '1.0.0', '==', '1.0.1', false), - array(null, '1.0.0.0', '==', '1.0.0.1', false), - - array(1, '1', '==', '1', true), - array(1, '1.0', '==', '1.1', true), - array(1, '1.0.0', '==', '1.0.1', true), - array(1, '1.0.0.0', '==', '1.0.0.1', true), - - array(2, '1', '==', '1', true), - array(2, '1.0', '==', '1.1', false), - array(2, '1.0.0', '==', '1.0.1', true), - array(2, '1.0.0.0', '==', '1.0.0.1', true), - - array(3, '1', '==', '1', true), - array(3, '1.0', '==', '1.1', false), - array(3, '1.0.0', '==', '1.0.1', false), - array(3, '1.0.0.0', '==', '1.0.0.1', true), - ); - } - - /** - * @dataProvider compareProvider - */ - public function testCompare($precision, $version1, $operator, $version2, $result) - { - $this->assertSame($result, Version::compare($version1, $version2, $operator, $precision)); - } -} -- cgit v1.2.3