Skip to content

Commit

Permalink
Resolve PHP 7 unit test issues and remove allow_failures config (issue
Browse files Browse the repository at this point in the history
  • Loading branch information
David Alger committed Nov 24, 2015
1 parent da282a0 commit 703dcd2
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 15 deletions.
2 changes: 0 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ matrix:
env: TEST_SUITE=static_phpcs
- php: 5.6
env: TEST_SUITE=static_annotation
allow_failures:
- php: 7.0
before_install:
- sudo apt-get update -qq
- sudo apt-get install -y -qq postfix
Expand Down
41 changes: 28 additions & 13 deletions setup/src/Magento/Setup/Test/Unit/Model/PhpReadinessCheckTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -209,13 +209,15 @@ public function testCheckPhpSettings()
'message' => $xdebugMessage,
'error' => false,
],
'always_populate_raw_post_data' => [
'message' => $rawPostMessage,
'helpUrl' => 'http://php.net/manual/en/ini.core.php#ini.always-populate-settings-data',
'error' => false
]
]
];
if (!$this->isPhp7OrHackLang()) {
$expected['data']['always_populate_raw_post_data'] = [
'message' => $rawPostMessage,
'helpUrl' => 'http://php.net/manual/en/ini.core.php#ini.always-populate-settings-data',
'error' => false
];
}
$this->assertEquals($expected, $this->phpReadinessCheck->checkPhpSettings());
}

Expand Down Expand Up @@ -246,14 +248,16 @@ public function testCheckPhpSettingsFailed()
'xdebug_max_nesting_level' => [
'message' => $xdebugMessage,
'error' => true,
],
'always_populate_raw_post_data' => [
'message' => $rawPostMessage,
'helpUrl' => 'http://php.net/manual/en/ini.core.php#ini.always-populate-settings-data',
'error' => false
]
]
];
if (!$this->isPhp7OrHackLang()) {
$expected['data']['always_populate_raw_post_data'] = [
'message' => $rawPostMessage,
'helpUrl' => 'http://php.net/manual/en/ini.core.php#ini.always-populate-settings-data',
'error' => false
];
}
$this->assertEquals($expected, $this->phpReadinessCheck->checkPhpSettings());
}

Expand All @@ -272,14 +276,17 @@ public function testCheckPhpSettingsNoXDebug()
);
$expected = [
'responseType' => ResponseTypeInterface::RESPONSE_TYPE_SUCCESS,
'data' => [
'data' => []
];
if (!$this->isPhp7OrHackLang()) {
$expected['data'] = [
'always_populate_raw_post_data' => [
'message' => $rawPostMessage,
'helpUrl' => 'http://php.net/manual/en/ini.core.php#ini.always-populate-settings-data',
'error' => false
]
]
];
];
}
$this->assertEquals($expected, $this->phpReadinessCheck->checkPhpSettings());
}

Expand Down Expand Up @@ -333,6 +340,14 @@ public function testCheckPhpExtensionsFailed()
];
$this->assertEquals($expected, $this->phpReadinessCheck->checkPhpExtensions());
}

/**
* @return bool
*/
protected function isPhp7OrHackLang()
{
return version_compare(PHP_VERSION, '7.0.0-beta') >= 0 || defined('HHVM_VERSION');
}
}

namespace Magento\Setup\Model;
Expand Down

0 comments on commit 703dcd2

Please sign in to comment.