From ff2ead17f9c3763bcf941baa6c9beb6c7411042c Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Wed, 1 Jul 2015 15:03:16 +0200 Subject: [PATCH 1/4] Move HHVM tests out of the allowed failures --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index c13f0a5a32..b596948217 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,7 +22,6 @@ matrix: - php: hhvm allow_failures: - php: nightly - - php: hhvm fast_finish: true services: mongodb From efd927a660b821f11f7843adc9f5afbe8c3790dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=9E=C9=99hriyar=20=C4=B0manov?= Date: Tue, 30 Jun 2015 15:41:45 +0300 Subject: [PATCH 2/4] Azerbaijani language pluralization rule In AZ, as in TR, pluralization is always 0: 0 kitab (zero books) 1 kitab (1 book) 3 kitab (3 books) 104 kitab (104 books) Apparently ZF ruleset was wrong in the first place :) --- src/Symfony/Component/Translation/PluralizationRules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/Translation/PluralizationRules.php b/src/Symfony/Component/Translation/PluralizationRules.php index 9cedd337f8..4264e5c802 100644 --- a/src/Symfony/Component/Translation/PluralizationRules.php +++ b/src/Symfony/Component/Translation/PluralizationRules.php @@ -56,6 +56,7 @@ class PluralizationRules * Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) */ switch ($locale) { + case 'az': case 'bo': case 'dz': case 'id': @@ -74,7 +75,6 @@ class PluralizationRules break; case 'af': - case 'az': case 'bn': case 'bg': case 'ca': From 8319ca3b057e8df238b8cf804849c2977fed6a98 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Wed, 1 Jul 2015 17:12:49 +0200 Subject: [PATCH 3/4] Mock microtime() and time() in transient tests --- .../HttpFoundation/Tests/ClockMock.php | 24 ++++++++++++ .../HttpFoundation/Tests/CookieTest.php | 2 + .../Tests/ResponseHeaderBagTest.php | 2 + .../Component/Stopwatch/Tests/ClockMock.php | 39 +++++++++++++++++++ .../Stopwatch/Tests/StopwatchEventTest.php | 2 + .../Stopwatch/Tests/StopwatchTest.php | 2 + 6 files changed, 71 insertions(+) create mode 100644 src/Symfony/Component/HttpFoundation/Tests/ClockMock.php create mode 100644 src/Symfony/Component/Stopwatch/Tests/ClockMock.php diff --git a/src/Symfony/Component/HttpFoundation/Tests/ClockMock.php b/src/Symfony/Component/HttpFoundation/Tests/ClockMock.php new file mode 100644 index 0000000000..04a842d9b5 --- /dev/null +++ b/src/Symfony/Component/HttpFoundation/Tests/ClockMock.php @@ -0,0 +1,24 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpFoundation; + +function time($asFloat = false) +{ + return Tests\time(); +} + +namespace Symfony\Component\HttpFoundation\Tests; + +function time() +{ + return $_SERVER['REQUEST_TIME']; +} diff --git a/src/Symfony/Component/HttpFoundation/Tests/CookieTest.php b/src/Symfony/Component/HttpFoundation/Tests/CookieTest.php index 0aaeb6baa1..b8474db15f 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/CookieTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/CookieTest.php @@ -13,6 +13,8 @@ namespace Symfony\Component\HttpFoundation\Tests; use Symfony\Component\HttpFoundation\Cookie; +require_once __DIR__.'/ClockMock.php'; + /** * CookieTest. * diff --git a/src/Symfony/Component/HttpFoundation/Tests/ResponseHeaderBagTest.php b/src/Symfony/Component/HttpFoundation/Tests/ResponseHeaderBagTest.php index 8ff8662e99..b4164c8a28 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/ResponseHeaderBagTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/ResponseHeaderBagTest.php @@ -14,6 +14,8 @@ namespace Symfony\Component\HttpFoundation\Tests; use Symfony\Component\HttpFoundation\ResponseHeaderBag; use Symfony\Component\HttpFoundation\Cookie; +require_once __DIR__.'/ClockMock.php'; + class ResponseHeaderBagTest extends \PHPUnit_Framework_TestCase { /** diff --git a/src/Symfony/Component/Stopwatch/Tests/ClockMock.php b/src/Symfony/Component/Stopwatch/Tests/ClockMock.php new file mode 100644 index 0000000000..5bbe6b1db8 --- /dev/null +++ b/src/Symfony/Component/Stopwatch/Tests/ClockMock.php @@ -0,0 +1,39 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Stopwatch; + +function microtime($asFloat = false) +{ + return Tests\microtime($asFloat); +} + +namespace Symfony\Component\Stopwatch\Tests; + +function usleep($us) +{ + static $now; + + if (null === $now) { + $now = \microtime(true); + } + + return $now += $us / 1000000; +} + +function microtime($asFloat = false) +{ + if (!$asFloat) { + return \microtime(false); + } + + return usleep(1); +} diff --git a/src/Symfony/Component/Stopwatch/Tests/StopwatchEventTest.php b/src/Symfony/Component/Stopwatch/Tests/StopwatchEventTest.php index 9ef3abaea9..44928ace19 100644 --- a/src/Symfony/Component/Stopwatch/Tests/StopwatchEventTest.php +++ b/src/Symfony/Component/Stopwatch/Tests/StopwatchEventTest.php @@ -13,6 +13,8 @@ namespace Symfony\Component\Stopwatch\Tests; use Symfony\Component\Stopwatch\StopwatchEvent; +require_once __DIR__.'/ClockMock.php'; + /** * StopwatchEventTest. * diff --git a/src/Symfony/Component/Stopwatch/Tests/StopwatchTest.php b/src/Symfony/Component/Stopwatch/Tests/StopwatchTest.php index 74ad1d8da1..f13955d30b 100644 --- a/src/Symfony/Component/Stopwatch/Tests/StopwatchTest.php +++ b/src/Symfony/Component/Stopwatch/Tests/StopwatchTest.php @@ -13,6 +13,8 @@ namespace Symfony\Component\Stopwatch\Tests; use Symfony\Component\Stopwatch\Stopwatch; +require_once __DIR__.'/ClockMock.php'; + /** * StopwatchTest. * From 27b824a6b7718e4ab2b5fb9064f197b5bc38b3ad Mon Sep 17 00:00:00 2001 From: zhil Date: Wed, 1 Jul 2015 15:52:14 +0300 Subject: [PATCH 4/4] Update DateTimeToArrayTransformer.php --- .../Core/DataTransformer/DateTimeToArrayTransformer.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToArrayTransformer.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToArrayTransformer.php index afbfc1041e..07070952f5 100644 --- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToArrayTransformer.php +++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToArrayTransformer.php @@ -179,15 +179,16 @@ class DateTimeToArrayTransformer extends BaseDateTimeTransformer try { $dateTime = new \DateTime(sprintf( - '%s-%s-%s %s:%s:%s %s', + '%s-%s-%s %s:%s:%s', empty($value['year']) ? '1970' : $value['year'], empty($value['month']) ? '1' : $value['month'], empty($value['day']) ? '1' : $value['day'], empty($value['hour']) ? '0' : $value['hour'], empty($value['minute']) ? '0' : $value['minute'], - empty($value['second']) ? '0' : $value['second'], - $this->outputTimezone - )); + empty($value['second']) ? '0' : $value['second'] + ), + new \DateTimeZone($this->outputTimezone) + ); if ($this->inputTimezone !== $this->outputTimezone) { $dateTime->setTimezone(new \DateTimeZone($this->inputTimezone));