Skip to content

Commit eca45b7

Browse files
minor #15664 [3.0] Fix tests (nicolas-grekas)
This PR was merged into the 3.0-dev branch. Discussion ---------- [3.0] Fix tests | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - Should make tests green again on travis and appveyor Commits ------- 37e1f1a [3.0] Fix tests
2 parents 6a41f11 + 37e1f1a commit eca45b7

File tree

12 files changed

+11
-69
lines changed

12 files changed

+11
-69
lines changed

.travis.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ addons:
1010
matrix:
1111
include:
1212
- php: hhvm
13-
- php: 5.5.9
1413
- php: 5.5
1514
- php: 5.6
1615
- php: 5.6

src/Symfony/Bridge/Twig/Tests/Node/TransNodeTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,6 @@ protected function getVariableGetterWithStrictCheck($name)
4747
return sprintf('(isset($context["%s"]) || array_key_exists("%s", $context) ? $context["%s"] : $this->notFound("%s", 0))', $name, $name, $name, $name);
4848
}
4949

50-
return sprintf('$this->getContext($context, "%s")', $name);
50+
return sprintf('(isset($context["%1$s"]) ? $context["%1$s"] : $this->getContext($context, "%1$s"))', $name);
5151
}
5252
}

src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -295,12 +295,11 @@ public function testHandleUserError()
295295

296296
public function testHandleDeprecation()
297297
{
298-
$that = $this;
299-
$logArgCheck = function ($level, $message, $context) use ($that) {
300-
$that->assertEquals(LogLevel::INFO, $level);
301-
$that->assertArrayHasKey('level', $context);
302-
$that->assertEquals(E_RECOVERABLE_ERROR | E_USER_ERROR | E_DEPRECATED | E_USER_DEPRECATED, $context['level']);
303-
$that->assertArrayHasKey('stack', $context);
298+
$logArgCheck = function ($level, $message, $context) {
299+
$this->assertEquals(LogLevel::INFO, $level);
300+
$this->assertArrayHasKey('level', $context);
301+
$this->assertEquals(E_RECOVERABLE_ERROR | E_USER_ERROR | E_DEPRECATED | E_USER_DEPRECATED, $context['level']);
302+
$this->assertArrayHasKey('stack', $context);
304303
};
305304

306305
$logger = $this->getMock('Psr\Log\LoggerInterface');

src/Symfony/Component/Intl/DateFormatter/IntlDateFormatter.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -207,10 +207,7 @@ public function format($timestamp)
207207
// behave like the intl extension
208208
$argumentError = null;
209209
if (!is_int($timestamp) && !$timestamp instanceof \DateTime) {
210-
$argumentError = 'datefmt_format: takes either an array or an integer timestamp value or a DateTime object';
211-
if (!is_int($timestamp)) {
212-
$argumentError = sprintf('datefmt_format: string \'%s\' is not numeric, which would be required for it to be a valid date', $timestamp);
213-
}
210+
$argumentError = sprintf('datefmt_format: string \'%s\' is not numeric, which would be required for it to be a valid date', $timestamp);
214211
}
215212

216213
if (null !== $argumentError) {

src/Symfony/Component/Intl/NumberFormatter/NumberFormatter.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -857,6 +857,10 @@ private function getInt64Value($value)
857857
return false;
858858
}
859859

860+
if (PHP_INT_SIZE !== 8 && ($value > self::$int32Range['positive'] || $value < self::$int32Range['negative'])) {
861+
return (float) $value;
862+
}
863+
860864
return (int) $value;
861865
}
862866

src/Symfony/Component/Intl/Tests/Data/Bundle/Reader/IntlBundleReaderTest.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,6 @@ public function testReadFollowsAlias()
5555

5656
public function testReadDoesNotFollowFallback()
5757
{
58-
if (PHP_VERSION_ID < 50307 || PHP_VERSION_ID === 50400) {
59-
$this->markTestSkipped('ResourceBundle handles disabling fallback properly only as of PHP 5.3.7 and 5.4.1.');
60-
}
61-
6258
if (defined('HHVM_VERSION')) {
6359
$this->markTestSkipped('ResourceBundle does not support disabling fallback properly on HHVM.');
6460
}
@@ -75,10 +71,6 @@ public function testReadDoesNotFollowFallback()
7571

7672
public function testReadDoesNotFollowFallbackAlias()
7773
{
78-
if (PHP_VERSION_ID < 50307 || PHP_VERSION_ID === 50400) {
79-
$this->markTestSkipped('ResourceBundle handles disabling fallback properly only as of PHP 5.3.7 and 5.4.1.');
80-
}
81-
8274
if (defined('HHVM_VERSION')) {
8375
$this->markTestSkipped('ResourceBundle does not support disabling fallback properly on HHVM.');
8476
}

src/Symfony/Component/Intl/Tests/Data/Bundle/Writer/PhpBundleWriterTest.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,6 @@ public function testWriteResourceBundle()
7171
$this->markTestSkipped('The intl extension is not available.');
7272
}
7373

74-
if (PHP_VERSION_ID < 50315 || (PHP_VERSION_ID >= 50400 && PHP_VERSION_ID < 50404)) {
75-
$this->markTestSkipped('ResourceBundle implements Traversable only as of PHP 5.3.15 and 5.4.4');
76-
}
77-
7874
$bundle = new \ResourceBundle('rb', __DIR__.'/Fixtures', false);
7975

8076
$this->writer->write($this->directory, 'en', $bundle);

src/Symfony/Component/Intl/Tests/DateFormatter/AbstractIntlDateFormatterTest.php

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -306,10 +306,6 @@ public function formatWithTimezoneProvider()
306306
array(0, 'Europe/Dublin', '1970-01-01 01:00:00'),
307307
array(0, 'Europe/Warsaw', '1970-01-01 01:00:00'),
308308
array(0, 'Pacific/Fiji', '1970-01-01 12:00:00'),
309-
array(0, 'Foo/Bar', '1970-01-01 00:00:00'),
310-
array(0, 'Foo/Bar', '1970-01-01 00:00:00'),
311-
array(0, 'UTC+04:30', '1970-01-01 00:00:00'),
312-
array(0, 'UTC+04:AA', '1970-01-01 00:00:00'),
313309
);
314310

315311
return $data;
@@ -382,25 +378,6 @@ public function testFormatWithIntlTimeZone()
382378
$this->assertEquals('GMT+03:00', $formatter->format(0));
383379
}
384380

385-
public function testFormatWithTimezoneFromEnvironmentVariable()
386-
{
387-
$tz = getenv('TZ');
388-
putenv('TZ=Europe/London');
389-
390-
$formatter = $this->getDateFormatter('en', IntlDateFormatter::MEDIUM, IntlDateFormatter::SHORT);
391-
$formatter->setPattern('yyyy-MM-dd HH:mm:ss');
392-
393-
$this->assertEquals(
394-
$this->getDateTime(0, 'Europe/London')->format('Y-m-d H:i:s'),
395-
$formatter->format(0)
396-
);
397-
398-
$this->assertEquals('Europe/London', getenv('TZ'));
399-
400-
// Restores TZ.
401-
putenv('TZ='.$tz);
402-
}
403-
404381
public function testFormatWithTimezoneFromPhp()
405382
{
406383
$tz = date_default_timezone_get();

src/Symfony/Component/Intl/Tests/DateFormatter/Verification/IntlDateFormatterTest.php

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,6 @@ protected function setUp()
3030
parent::setUp();
3131
}
3232

33-
/**
34-
* It seems IntlDateFormatter caches the timezone id when not explicitly set via constructor or by the
35-
* setTimeZoneId() method. Since testFormatWithDefaultTimezoneIntl() runs using the default environment
36-
* time zone, this test would use it too if not running in a separated process.
37-
*
38-
* @runInSeparateProcess
39-
* @preserveGlobalState disabled
40-
*/
41-
public function testFormatWithTimezoneFromEnvironmentVariable()
42-
{
43-
parent::testFormatWithTimezoneFromEnvironmentVariable();
44-
}
45-
4633
protected function getDateFormatter($locale, $datetype, $timetype, $timezone = null, $calendar = IntlDateFormatter::GREGORIAN, $pattern = null)
4734
{
4835
if (!$formatter = new \IntlDateFormatter($locale, $datetype, $timetype, $timezone, $calendar, $pattern)) {

src/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -683,9 +683,7 @@ public function testParseTypeInt64With32BitIntegerInPhp32Bit()
683683
$this->assertEquals(2147483647, $parsedValue);
684684

685685
$parsedValue = $formatter->parse('-2,147,483,648', NumberFormatter::TYPE_INT64);
686-
687686
$this->assertInternalType('int', $parsedValue);
688-
689687
$this->assertEquals(-2147483648, $parsedValue);
690688
}
691689

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy