1
0
mirror of https://github.com/php/phd.git synced 2026-03-24 07:02:07 +01:00
Files
archived-phd/tests/options/default_handler_007.phpt
haszi e6e6847d7b Refactor Options Parser and default Options Handler (#110)
* Refactor Options Parser and default Options Handler

Refactor default Options Handler to accept dependencies through its constructor.
Refactor default Options Handler to return an array of options instead of directly setting options in Config and declare array return types.
Refactor method in Options Parser to return an array of options and declare its return type as array.
Inject all necessary dependencies in render.php.
Refactor two methods in default Options Handler by using match expressions.

* Minor refactor of files used in tests

Inlcude Config with require_once instead of require in Autloader.
Define __INSTALLDIR__ only if it is not defined yet in render.php.
Include Autoloader and functions.php with require_once instead of require.
Remove unnecessary __PHPDIR__ constant, correct path for __INSTALLDIR__ and use that constant in setup.php.

* Remove var_dump from Options Parser

* Fix inconsistent option flags in default Option Handler

* Add default Options Handler tests

---------

Co-authored-by: haszi <haszika80@gmail.com>
2024-03-17 18:29:43 +00:00

23 lines
543 B
PHP

--TEST--
Default options handler 007 - Save config (short option) and quit (short option)
--ARGS--
--docbook tests/options/default_handler_007.phpt -S -Q
--SKIPIF--
<?php
if (file_exists(__DIR__ . "/../../phd.config.php")) {
die("Skipped: existing phd.config.php file will overwrite command line options.");
}
?>
--FILE--
<?php
namespace phpdotnet\phd;
require_once __DIR__ . "/../../render.php";
?>
--CLEAN--
<?php
unlink(__DIR__ . "/../../phd.config.php");
?>
--EXPECTF--
%s[%d:%d:%d - Heads up ]%s Writing the config file