Skip to content

Commit 3b96768

Browse files
mazhalaiOlga Kopylova
authored andcommitted
MAGETWO-44929: [PHP7] Unit tests PHPReadinessCheck and Maintenance fail on bamboo
- renaming function name
1 parent d046fa2 commit 3b96768

File tree

1 file changed

+31
-16
lines changed

1 file changed

+31
-16
lines changed

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

Lines changed: 31 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,6 @@ public function testCheckPhpSettings()
193193
50
194194
);
195195

196-
$this->setUpNoPrettyVersionParser();
197196
$rawPostMessage = sprintf(
198197
'Your PHP Version is %s, but always_populate_raw_post_data = -1.
199198
$HTTP_RAW_POST_DATA is deprecated from PHP 5.6 onwards and will be removed in PHP 7.0.
@@ -209,13 +208,16 @@ public function testCheckPhpSettings()
209208
'message' => $xdebugMessage,
210209
'error' => false,
211210
],
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-
]
217211
]
218212
];
213+
if (!$this->isPhp7OrHhvm()) {
214+
$this->setUpNoPrettyVersionParser();
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

@@ -231,7 +233,6 @@ public function testCheckPhpSettingsFailed()
231233
200
232234
);
233235

234-
$this->setUpNoPrettyVersionParser();
235236
$rawPostMessage = sprintf(
236237
'Your PHP Version is %s, but always_populate_raw_post_data = -1.
237238
$HTTP_RAW_POST_DATA is deprecated from PHP 5.6 onwards and will be removed in PHP 7.0.
@@ -246,22 +247,24 @@ public function testCheckPhpSettingsFailed()
246247
'xdebug_max_nesting_level' => [
247248
'message' => $xdebugMessage,
248249
'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
254250
]
255251
]
256252
];
253+
if (!$this->isPhp7OrHhvm()) {
254+
$this->setUpNoPrettyVersionParser();
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

260264
public function testCheckPhpSettingsNoXDebug()
261265
{
262266
$this->phpInfo->expects($this->once())->method('getCurrent')->willReturn([]);
263267

264-
$this->setUpNoPrettyVersionParser();
265268
$rawPostMessage = sprintf(
266269
'Your PHP Version is %s, but always_populate_raw_post_data = -1.
267270
$HTTP_RAW_POST_DATA is deprecated from PHP 5.6 onwards and will be removed in PHP 7.0.
@@ -272,14 +275,18 @@ public function testCheckPhpSettingsNoXDebug()
272275
);
273276
$expected = [
274277
'responseType' => ResponseTypeInterface::RESPONSE_TYPE_SUCCESS,
275-
'data' => [
278+
'data' => []
279+
];
280+
if (!$this->isPhp7OrHhvm()) {
281+
$this->setUpNoPrettyVersionParser();
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 isPhp7OrHhvm()
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)