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 --- .../Component/Intl/Tests/Util/VersionTest.php | 87 ++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 vendor/symfony/intl/Symfony/Component/Intl/Tests/Util/VersionTest.php (limited to 'vendor/symfony/intl/Symfony/Component/Intl/Tests/Util/VersionTest.php') diff --git a/vendor/symfony/intl/Symfony/Component/Intl/Tests/Util/VersionTest.php b/vendor/symfony/intl/Symfony/Component/Intl/Tests/Util/VersionTest.php new file mode 100644 index 00000000..60cec6c0 --- /dev/null +++ b/vendor/symfony/intl/Symfony/Component/Intl/Tests/Util/VersionTest.php @@ -0,0 +1,87 @@ + + * + * 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