Skip to content

Commit 703dcd2

Browse files
author
David Alger
committed
Resolve PHP 7 unit test issues and remove allow_failures config (issue #1858)
1 parent da282a0 commit 703dcd2

File tree

2 files changed

+28
-15
lines changed

2 files changed

+28
-15
lines changed

.travis.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ matrix:
2121
env: TEST_SUITE=static_phpcs
2222
- php: 5.6
2323
env: TEST_SUITE=static_annotation
24-
allow_failures:
25-
- php: 7.0
2624
before_install:
2725
- sudo apt-get update -qq
2826
- sudo apt-get install -y -qq postfix

setup/src/Magento/Setup/Test/Unit/Model/PhpReadinessCheckTest.php

Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -209,13 +209,15 @@ public function testCheckPhpSettings()
209209
'message' => $xdebugMessage,
210210
'error' => false,
211211
],
212-
'always_populate_raw_post_data' => [
213-
'message' => $rawPostMessage,
214-
'helpUrl' => 'http://php.net/manual/en/ini.core.php#ini.always-populate-settings-data',
215-
'error' => false
216-
]
217212
]
218213
];
214+
if (!$this->isPhp7OrHackLang()) {
215+
$expected['data']['always_populate_raw_post_data'] = [
216+
'message' => $rawPostMessage,
217+
'helpUrl' => 'http://php.net/manual/en/ini.core.php#ini.always-populate-settings-data',
218+
'error' => false
219+
];
220+
}
219221
$this->assertEquals($expected, $this->phpReadinessCheck->checkPhpSettings());
220222
}
221223

@@ -246,14 +248,16 @@ public function testCheckPhpSettingsFailed()
246248
'xdebug_max_nesting_level' => [
247249
'message' => $xdebugMessage,
248250
'error' => true,
249-
],
250-
'always_populate_raw_post_data' => [
251-
'message' => $rawPostMessage,
252-
'helpUrl' => 'http://php.net/manual/en/ini.core.php#ini.always-populate-settings-data',
253-
'error' => false
254251
]
255252
]
256253
];
254+
if (!$this->isPhp7OrHackLang()) {
255+
$expected['data']['always_populate_raw_post_data'] = [
256+
'message' => $rawPostMessage,
257+
'helpUrl' => 'http://php.net/manual/en/ini.core.php#ini.always-populate-settings-data',
258+
'error' => false
259+
];
260+
}
257261
$this->assertEquals($expected, $this->phpReadinessCheck->checkPhpSettings());
258262
}
259263

@@ -272,14 +276,17 @@ public function testCheckPhpSettingsNoXDebug()
272276
);
273277
$expected = [
274278
'responseType' => ResponseTypeInterface::RESPONSE_TYPE_SUCCESS,
275-
'data' => [
279+
'data' => []
280+
];
281+
if (!$this->isPhp7OrHackLang()) {
282+
$expected['data'] = [
276283
'always_populate_raw_post_data' => [
277284
'message' => $rawPostMessage,
278285
'helpUrl' => 'http://php.net/manual/en/ini.core.php#ini.always-populate-settings-data',
279286
'error' => false
280287
]
281-
]
282-
];
288+
];
289+
}
283290
$this->assertEquals($expected, $this->phpReadinessCheck->checkPhpSettings());
284291
}
285292

@@ -333,6 +340,14 @@ public function testCheckPhpExtensionsFailed()
333340
];
334341
$this->assertEquals($expected, $this->phpReadinessCheck->checkPhpExtensions());
335342
}
343+
344+
/**
345+
* @return bool
346+
*/
347+
protected function isPhp7OrHackLang()
348+
{
349+
return version_compare(PHP_VERSION, '7.0.0-beta') >= 0 || defined('HHVM_VERSION');
350+
}
336351
}
337352

338353
namespace Magento\Setup\Model;

0 commit comments

Comments
 (0)