Skip to content
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

fix(requirement-checker): update the message to avoid confusing the users #906

Merged
merged 3 commits into from
Oct 16, 2023
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
5 changes: 2 additions & 3 deletions requirement-checker/src/Checker.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,11 @@ public static function printCheck($checkPassed, Printer $printer, RequirementCol
$printer->printv('> Using PHP ', $verbosity);
$printer->printvln(PHP_VERSION, $verbosity, 'green');

$printer->printvln('> PHP is using the following php.ini file:', $verbosity);

if ($iniPath) {
$printer->printvln('> PHP is using the following php.ini file:', $verbosity);
$printer->printvln(' '.$iniPath, $verbosity, 'green');
} else {
$printer->printvln(' WARNING: No configuration file (php.ini) used by PHP!', $verbosity, 'yellow');
$printer->printvln('> PHP is not using any php.ini file.', $verbosity, 'yellow');
}

$printer->printvln('', $verbosity);
Expand Down
17 changes: 16 additions & 1 deletion requirement-checker/src/RequirementCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,21 @@ final class RequirementCollection implements IteratorAggregate, Countable
*/
private $requirements = [];

/**
* @var string|false
*/
private $phpIniPath;

/**
* @param string|false|null $phpIniPath
*/
public function __construct($phpIniPath = null)
{
$this->phpIniPath = null === $phpIniPath
? get_cfg_var('cfg_file_path')
: $phpIniPath;
}

/**
* @return Traversable<Requirement>
*/
Expand Down Expand Up @@ -83,7 +98,7 @@ public function getRequirements(): array
*/
public function getPhpIniPath()
{
return get_cfg_var('cfg_file_path');
return $this->phpIniPath;
}

/**
Expand Down
24 changes: 24 additions & 0 deletions requirement-checker/tests/CheckerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,30 @@ public function provideRequirements(): iterable



EOF
];
})();

yield 'no requirement + no ini path; verbosity=debug' => (static function () use ($phpVersion) {
return [
new RequirementCollection(false),
IO::VERBOSITY_DEBUG,
true,
<<<EOF

Box Requirements Checker
========================

> Using PHP {$phpVersion}
> PHP is not using any php.ini file.

> No requirements found.


[OK] Your system is ready to run the application.



EOF
];
})();
Expand Down