From 4f5b44bd3bd490309eb2ba7b44df4769816ba729 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Sat, 3 Aug 2013 19:26:54 +0200 Subject: twig implementation --- .../Intl/Tests/Collator/AbstractCollatorTest.php | 62 ++++++++++++ .../Component/Intl/Tests/Collator/CollatorTest.php | 109 +++++++++++++++++++++ .../Tests/Collator/Verification/CollatorTest.php | 37 +++++++ 3 files changed, 208 insertions(+) create mode 100644 vendor/symfony/intl/Symfony/Component/Intl/Tests/Collator/AbstractCollatorTest.php create mode 100644 vendor/symfony/intl/Symfony/Component/Intl/Tests/Collator/CollatorTest.php create mode 100644 vendor/symfony/intl/Symfony/Component/Intl/Tests/Collator/Verification/CollatorTest.php (limited to 'vendor/symfony/intl/Symfony/Component/Intl/Tests/Collator') diff --git a/vendor/symfony/intl/Symfony/Component/Intl/Tests/Collator/AbstractCollatorTest.php b/vendor/symfony/intl/Symfony/Component/Intl/Tests/Collator/AbstractCollatorTest.php new file mode 100644 index 00000000..08f3a566 --- /dev/null +++ b/vendor/symfony/intl/Symfony/Component/Intl/Tests/Collator/AbstractCollatorTest.php @@ -0,0 +1,62 @@ + + * + * 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 new file mode 100644 index 00000000..a4e4e56b --- /dev/null +++ b/vendor/symfony/intl/Symfony/Component/Intl/Tests/Collator/CollatorTest.php @@ -0,0 +1,109 @@ + + * + * 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 new file mode 100644 index 00000000..c8dbc131 --- /dev/null +++ b/vendor/symfony/intl/Symfony/Component/Intl/Tests/Collator/Verification/CollatorTest.php @@ -0,0 +1,37 @@ + + * + * 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); + } +} -- cgit v1.2.3