Skip to content

Commit c50d42c

Browse files
committed
MAGETWO-51580: Misleading error messages during installation
- fixing functional tests
1 parent 5718369 commit c50d42c

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

dev/tests/functional/tests/app/Magento/Install/Test/Constraint/AssertSuccessfulReadinessCheck.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class AssertSuccessfulReadinessCheck extends AbstractConstraint
2727
/**
2828
* File permission message.
2929
*/
30-
const FILE_PERMISSION_REGEXP = 'File permissions does not meet requirements.';
30+
const FILE_PERMISSION_REGEXP = '/You meet (\d+) out of \1 writable file permission requirements\./';
3131

3232
/**
3333
* Assert that PHP Version, PHP Extensions and File Permission are ok.
@@ -47,7 +47,7 @@ public function processAssert(Install $installPage)
4747
$installPage->getReadinessBlock()->getPhpExtensionsCheck(),
4848
'PHP extensions missed.'
4949
);
50-
\PHPUnit_Framework_Assert::assertContains(
50+
\PHPUnit_Framework_Assert::assertRegExp(
5151
self::FILE_PERMISSION_REGEXP,
5252
$installPage->getReadinessBlock()->getFilePermissionCheck(),
5353
'File permissions does not meet requirements.'

setup/src/Magento/Setup/Controller/Environment.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,18 +162,24 @@ public function filePermissionsAction()
162162
$responseType = ResponseTypeInterface::RESPONSE_TYPE_SUCCESS;
163163
$missingWritePermissionPaths = $this->permissions->getMissingWritablePathsForInstallation(true);
164164

165+
$currentPaths = [];
165166
$requiredPaths = [];
166167
if ($missingWritePermissionPaths) {
167-
$responseType = ResponseTypeInterface::RESPONSE_TYPE_ERROR;
168168
foreach ($missingWritePermissionPaths as $key => $value) {
169-
$requiredPaths[] = ['path' => $key, 'missing' => $value];
169+
if (is_array($value)) {
170+
$requiredPaths[] = ['path' => $key, 'missing' => $value];
171+
$responseType = ResponseTypeInterface::RESPONSE_TYPE_ERROR;
172+
} else {
173+
$requiredPaths[] = ['path' => $key];
174+
$currentPaths[] = $key;
175+
}
170176
}
171177
}
172178
$data = [
173179
'responseType' => $responseType,
174180
'data' => [
175181
'required' => $requiredPaths,
176-
'current' => $this->permissions->getInstallationCurrentWritableDirectories(),
182+
'current' => $currentPaths,
177183
],
178184
];
179185

0 commit comments

Comments
 (0)