Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[3.0] Fix tests #15664

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 3, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ addons:
matrix:
include:
- php: hhvm
- php: 5.5.9
- php: 5.5
- php: 5.6
- php: 5.6
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Bridge/Twig/Tests/Node/TransNodeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,6 @@ protected function getVariableGetterWithStrictCheck($name)
return sprintf('(isset($context["%s"]) || array_key_exists("%s", $context) ? $context["%s"] : $this->notFound("%s", 0))', $name, $name, $name, $name);
}

return sprintf('$this->getContext($context, "%s")', $name);
return sprintf('(isset($context["%1$s"]) ? $context["%1$s"] : $this->getContext($context, "%1$s"))', $name);
}
}
11 changes: 5 additions & 6 deletions src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -295,12 +295,11 @@ public function testHandleUserError()

public function testHandleDeprecation()
{
$that = $this;
$logArgCheck = function ($level, $message, $context) use ($that) {
$that->assertEquals(LogLevel::INFO, $level);
$that->assertArrayHasKey('level', $context);
$that->assertEquals(E_RECOVERABLE_ERROR | E_USER_ERROR | E_DEPRECATED | E_USER_DEPRECATED, $context['level']);
$that->assertArrayHasKey('stack', $context);
$logArgCheck = function ($level, $message, $context) {
$this->assertEquals(LogLevel::INFO, $level);
$this->assertArrayHasKey('level', $context);
$this->assertEquals(E_RECOVERABLE_ERROR | E_USER_ERROR | E_DEPRECATED | E_USER_DEPRECATED, $context['level']);
$this->assertArrayHasKey('stack', $context);
};

$logger = $this->getMock('Psr\Log\LoggerInterface');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,10 +207,7 @@ public function format($timestamp)
// behave like the intl extension
$argumentError = null;
if (!is_int($timestamp) && !$timestamp instanceof \DateTime) {
$argumentError = 'datefmt_format: takes either an array or an integer timestamp value or a DateTime object';
if (!is_int($timestamp)) {
$argumentError = sprintf('datefmt_format: string \'%s\' is not numeric, which would be required for it to be a valid date', $timestamp);
}
$argumentError = sprintf('datefmt_format: string \'%s\' is not numeric, which would be required for it to be a valid date', $timestamp);
}

if (null !== $argumentError) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -857,6 +857,10 @@ private function getInt64Value($value)
return false;
}

if (PHP_INT_SIZE !== 8 && ($value > self::$int32Range['positive'] || $value < self::$int32Range['negative'])) {
return (float) $value;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the phpdoc needs to be updated though, as it says it returns int|false

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See #15672

}

return (int) $value;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,6 @@ public function testReadFollowsAlias()

public function testReadDoesNotFollowFallback()
{
if (PHP_VERSION_ID < 50307 || PHP_VERSION_ID === 50400) {
$this->markTestSkipped('ResourceBundle handles disabling fallback properly only as of PHP 5.3.7 and 5.4.1.');
}

if (defined('HHVM_VERSION')) {
$this->markTestSkipped('ResourceBundle does not support disabling fallback properly on HHVM.');
}
Expand All @@ -75,10 +71,6 @@ public function testReadDoesNotFollowFallback()

public function testReadDoesNotFollowFallbackAlias()
{
if (PHP_VERSION_ID < 50307 || PHP_VERSION_ID === 50400) {
$this->markTestSkipped('ResourceBundle handles disabling fallback properly only as of PHP 5.3.7 and 5.4.1.');
}

if (defined('HHVM_VERSION')) {
$this->markTestSkipped('ResourceBundle does not support disabling fallback properly on HHVM.');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,6 @@ public function testWriteResourceBundle()
$this->markTestSkipped('The intl extension is not available.');
}

if (PHP_VERSION_ID < 50315 || (PHP_VERSION_ID >= 50400 && PHP_VERSION_ID < 50404)) {
$this->markTestSkipped('ResourceBundle implements Traversable only as of PHP 5.3.15 and 5.4.4');
}

$bundle = new \ResourceBundle('rb', __DIR__.'/Fixtures', false);

$this->writer->write($this->directory, 'en', $bundle);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,10 +306,6 @@ public function formatWithTimezoneProvider()
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'),
array(0, 'Foo/Bar', '1970-01-01 00:00:00'),
array(0, 'Foo/Bar', '1970-01-01 00:00:00'),
array(0, 'UTC+04:30', '1970-01-01 00:00:00'),
array(0, 'UTC+04:AA', '1970-01-01 00:00:00'),
);

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

public function testFormatWithTimezoneFromEnvironmentVariable()
{
$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, 'Europe/London')->format('Y-m-d H:i:s'),
$formatter->format(0)
);

$this->assertEquals('Europe/London', getenv('TZ'));

// Restores TZ.
putenv('TZ='.$tz);
}

public function testFormatWithTimezoneFromPhp()
{
$tz = date_default_timezone_get();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,6 @@ protected function setUp()
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
* @preserveGlobalState disabled
*/
public function testFormatWithTimezoneFromEnvironmentVariable()
{
parent::testFormatWithTimezoneFromEnvironmentVariable();
}

protected function getDateFormatter($locale, $datetype, $timetype, $timezone = null, $calendar = IntlDateFormatter::GREGORIAN, $pattern = null)
{
if (!$formatter = new \IntlDateFormatter($locale, $datetype, $timetype, $timezone, $calendar, $pattern)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -683,9 +683,7 @@ public function testParseTypeInt64With32BitIntegerInPhp32Bit()
$this->assertEquals(2147483647, $parsedValue);

$parsedValue = $formatter->parse('-2,147,483,648', NumberFormatter::TYPE_INT64);

$this->assertInternalType('int', $parsedValue);

$this->assertEquals(-2147483648, $parsedValue);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,6 @@ public function testInvalidComparisonToValue($dirtyValue, $dirtyValueAsString, $
// Make sure we have the correct version loaded
if ($dirtyValue instanceof \DateTime || $dirtyValue instanceof \DateTimeInterface) {
IntlTestHelper::requireIntl($this);

if (PHP_VERSION_ID < 50304 && !(extension_loaded('intl') && method_exists('IntlDateFormatter', 'setTimeZone'))) {
$this->markTestSkipped('Intl supports formatting DateTime objects since 5.3.4');
}
}

$constraint = $this->createConstraint(array('value' => $comparedValue));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,6 @@ public function provideInvalidComparisons()
array($object, '2', $object, '2', __NAMESPACE__.'\ComparisonTest_Class'),
);

$immutableDate = new \DateTimeImmutable('2000-01-01');
$comparisons[] = array($immutableDate, 'Jan 1, 2000, 12:00 AM', $immutableDate, 'Jan 1, 2000, 12:00 AM', 'DateTime');

return $comparisons;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is it removed ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, I was not aware of this nice trick

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't this be done in older branches though ?

}