From abab9b6c952fec279a2739bc2cee0efd8d850b63 Mon Sep 17 00:00:00 2001 From: Daniel Ronkainen Date: Sun, 15 Feb 2026 20:51:59 +0100 Subject: [PATCH 01/10] feat: add config param to props --- src/Config/ConfigProps.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Config/ConfigProps.php b/src/Config/ConfigProps.php index b6c5e10..d43042d 100644 --- a/src/Config/ConfigProps.php +++ b/src/Config/ConfigProps.php @@ -33,6 +33,7 @@ class ConfigProps extends AbstractConfigProps public ?bool $smartSearch = null; public ?bool $failFast = null; public ?string $helpController = null; + public ?array $configuration = null; /** * Hydrate the properties/object with expected data, and handle unexpected data @@ -93,6 +94,9 @@ protected function propsHydration(string|bool $key, mixed $value): void case 'failFast': $this->failFast = $this->dataToBool($value); break; + case 'configuration': + $this->configuration = (array)$value; + break; } } From f56745e3ecd98e47a9a5f8fc3e096f04351ff989 Mon Sep 17 00:00:00 2001 From: Daniel Ronkainen Date: Sun, 15 Feb 2026 20:53:16 +0100 Subject: [PATCH 02/10] feat: add the ability to change or configure middleware --- src/Console/Application.php | 41 ++++++++++++++++++++++++++++++------- 1 file changed, 34 insertions(+), 7 deletions(-) diff --git a/src/Console/Application.php b/src/Console/Application.php index 032ce34..e9a96a3 100644 --- a/src/Console/Application.php +++ b/src/Console/Application.php @@ -16,6 +16,14 @@ final class Application { + private array $middlewares = [ + AddCommandMiddleware::class, + ConfigPropsMiddleware::class, + CheckAllowedProps::class, + LocalMiddleware::class, + CliInitMiddleware::class + ]; + public function __construct() { // Default config @@ -29,6 +37,31 @@ public function __construct() EmitronKernel::setRouterFilePath(__DIR__ . "/ConsoleRouter.php"); } + /** + * Clear the default middlewares, be careful with this + * + * @return $this + */ + public function clearDefaultMiddleware(): self + { + $inst = clone $this; + $inst->middlewares = []; + return $inst; + } + + /** + * Add custom middlewares, follow PSR convention + * + * @param array $middleware + * @return $this + */ + public function withMiddleware(array $middleware): self + { + $inst = clone $this; + $inst->middlewares = array_merge($inst->middlewares, $middleware); + return $inst; + } + /** * Change router file * @@ -84,13 +117,7 @@ public function boot(array $parts): Kernel { $env = new Environment(); $request = new ServerRequest(new Uri($env->getUriParts($parts)), $env); - $kernel = new Kernel(new Container(), [ - AddCommandMiddleware::class, - ConfigPropsMiddleware::class, - CheckAllowedProps::class, - LocalMiddleware::class, - CliInitMiddleware::class - ]); + $kernel = new Kernel(new Container(), $this->middlewares); $kernel->run($request); return $kernel; } From 383d1b6633f26a92164d9098064d7c5b4eaca539 Mon Sep 17 00:00:00 2001 From: Daniel Ronkainen Date: Mon, 16 Feb 2026 21:02:06 +0100 Subject: [PATCH 03/10] refactor: improve data type checks and skeleton instance handling --- composer.json | 9 ++++++++ src/Config/ConfigProps.php | 1 - src/Console/Application.php | 18 ++++++++++++++++ src/Console/Controllers/DefaultController.php | 4 ++-- .../Middlewares/ConfigPropsMiddleware.php | 13 ++++++------ src/Console/Middlewares/LocalMiddleware.php | 8 +++++-- src/Console/Services/AbstractMainService.php | 4 ++-- src/Support/Helpers.php | 21 +++++++++++++++++++ 8 files changed, 65 insertions(+), 13 deletions(-) diff --git a/composer.json b/composer.json index 7553e02..56071a4 100644 --- a/composer.json +++ b/composer.json @@ -33,6 +33,15 @@ "maplephp/container": "^2.0", "maplephp/cache": "^2.0" }, + "repositories": [ + { + "type": "path", + "url": "../libraries/Emitron", + "options": { + "symlink": true + } + } + ], "autoload": { "files": [ "src/Setup/assert-polyfill.php", diff --git a/src/Config/ConfigProps.php b/src/Config/ConfigProps.php index d43042d..846e110 100644 --- a/src/Config/ConfigProps.php +++ b/src/Config/ConfigProps.php @@ -19,7 +19,6 @@ */ class ConfigProps extends AbstractConfigProps { - public ?string $path = null; public ?string $discoverPattern = null; public ?string $exclude = null; public ?string $show = null; diff --git a/src/Console/Application.php b/src/Console/Application.php index e9a96a3..a8badcb 100644 --- a/src/Console/Application.php +++ b/src/Console/Application.php @@ -49,6 +49,24 @@ public function clearDefaultMiddleware(): self return $inst; } + /** + * Clear the default middlewares, be careful with this + * + * @return $this + */ + public function unsetMiddleware(string $class): self + { + + $inst = clone $this; + foreach($inst->middlewares as $key => $middleware) { + if($middleware === $class) { + unset($inst->middlewares[$key]); + break; + } + } + return $inst; + } + /** * Add custom middlewares, follow PSR convention * diff --git a/src/Console/Controllers/DefaultController.php b/src/Console/Controllers/DefaultController.php index 496411b..47a6e0c 100644 --- a/src/Console/Controllers/DefaultController.php +++ b/src/Console/Controllers/DefaultController.php @@ -2,6 +2,7 @@ namespace MaplePHP\Unitary\Console\Controllers; +use MaplePHP\Emitron\Contracts\ConfigPropsInterface; use Psr\Container\ContainerExceptionInterface; use Psr\Container\ContainerInterface; use Psr\Container\NotFoundExceptionInterface; @@ -10,7 +11,6 @@ use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; use MaplePHP\Prompts\Command; -use MaplePHP\Unitary\Config\ConfigProps; use MaplePHP\Validate\Validator; abstract class DefaultController @@ -20,7 +20,7 @@ abstract class DefaultController protected Command $command; protected DispatchConfigInterface $configs; protected array $args; - protected ?ConfigProps $props = null; + protected ?ConfigPropsInterface $props = null; protected string|bool $path; /** diff --git a/src/Console/Middlewares/ConfigPropsMiddleware.php b/src/Console/Middlewares/ConfigPropsMiddleware.php index bb9eb14..45e14bb 100644 --- a/src/Console/Middlewares/ConfigPropsMiddleware.php +++ b/src/Console/Middlewares/ConfigPropsMiddleware.php @@ -2,6 +2,8 @@ namespace MaplePHP\Unitary\Console\Middlewares; +use MaplePHP\Emitron\Contracts\ConfigPropsInterface; +use MaplePHP\Unitary\Support\Helpers; use Psr\Container\ContainerExceptionInterface; use Psr\Container\ContainerInterface; use Psr\Container\NotFoundExceptionInterface; @@ -15,7 +17,7 @@ class ConfigPropsMiddleware implements MiddlewareInterface { - protected ?ConfigProps $props = null; + protected ?ConfigPropsInterface $props = null; private ContainerInterface $container; /** @@ -56,7 +58,7 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface * @throws ContainerExceptionInterface * @throws NotFoundExceptionInterface */ - private function getInitProps(): ConfigProps + private function getInitProps(): ConfigPropsInterface { if ($this->props === null) { $args = $this->container->get("args"); @@ -65,14 +67,13 @@ private function getInitProps(): ConfigProps try { $props = array_merge($configs->getProps()->toArray(), $args); - $this->props = new ConfigProps($props); - + $this->props = Helpers::getConfigPropInst($props); if ($this->props->hasMissingProps() !== [] && isset($args['verbose'])) { $command->error('The properties (' . - implode(", ", $this->props->hasMissingProps()) . ') is not exist in config props'); + implode(", ", $this->props->hasMissingProps()) . ') is not exist in ' . get_class($this->props)); $command->message( "One or more arguments you passed are not recognized as valid options.\n" . - "Check your command syntax or configuration." + "Check your command parameter syntax for spellings or configuration." ); } diff --git a/src/Console/Middlewares/LocalMiddleware.php b/src/Console/Middlewares/LocalMiddleware.php index 7909030..1be2c3e 100644 --- a/src/Console/Middlewares/LocalMiddleware.php +++ b/src/Console/Middlewares/LocalMiddleware.php @@ -39,8 +39,12 @@ public function __construct(ContainerInterface $container) public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface { $props = $this->container->get("props"); - Clock::setDefaultLocale($props->locale); - Clock::setDefaultTimezone($props->timezone); + if($props->locale !== null) { + Clock::setDefaultLocale($props->locale); + } + if($props->timezone !== null) { + Clock::setDefaultTimezone($props->timezone); + } return $handler->handle($request); } } diff --git a/src/Console/Services/AbstractMainService.php b/src/Console/Services/AbstractMainService.php index f8ade42..94cfb0b 100644 --- a/src/Console/Services/AbstractMainService.php +++ b/src/Console/Services/AbstractMainService.php @@ -2,6 +2,7 @@ namespace MaplePHP\Unitary\Console\Services; +use MaplePHP\Emitron\Contracts\ConfigPropsInterface; use Psr\Container\ContainerExceptionInterface; use Psr\Container\ContainerInterface; use Psr\Container\NotFoundExceptionInterface; @@ -10,7 +11,6 @@ use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; use MaplePHP\Prompts\Command; -use MaplePHP\Unitary\Config\ConfigProps; abstract class AbstractMainService { @@ -20,7 +20,7 @@ abstract class AbstractMainService protected Command $command; protected DispatchConfigInterface $configs; protected ServerRequestInterface|RequestInterface $request; - protected ?ConfigProps $props = null; + protected ?ConfigPropsInterface $props = null; /** * @throws NotFoundExceptionInterface diff --git a/src/Support/Helpers.php b/src/Support/Helpers.php index 862a7df..92e8cd1 100644 --- a/src/Support/Helpers.php +++ b/src/Support/Helpers.php @@ -14,6 +14,7 @@ use ErrorException; use Exception; +use MaplePHP\Emitron\Contracts\ConfigPropsInterface; use MaplePHP\Blunder\ExceptionItem; use MaplePHP\Blunder\Handlers\CliHandler; use MaplePHP\DTO\Format\Str; @@ -21,6 +22,26 @@ final class Helpers { + + /** + * Get expected instance of Config Props + * + * @param array $props + * @return ConfigPropsInterface + */ + public static function getConfigPropInst(array $props): ConfigPropsInterface + { + $override = '\\Configs\\ConfigProps'; + $default = \MaplePHP\Unitary\Config\ConfigProps::class; + $name = class_exists($override) ? $override : $default; + if (!is_subclass_of($name, ConfigPropsInterface::class)) { + $name = $default; + } + return new $name($props); + } + + + /** * Convert bytes to megabytes and return as a string with fixed precision. * From 5b6e5932b8b6846d1e63151edd2084b516716fc2 Mon Sep 17 00:00:00 2001 From: Daniel Ronkainen Date: Mon, 16 Feb 2026 21:16:05 +0100 Subject: [PATCH 04/10] refactor: move config props factory to emitron --- .../Middlewares/ConfigPropsMiddleware.php | 4 ++-- src/Support/Helpers.php | 21 ------------------- 2 files changed, 2 insertions(+), 23 deletions(-) diff --git a/src/Console/Middlewares/ConfigPropsMiddleware.php b/src/Console/Middlewares/ConfigPropsMiddleware.php index 45e14bb..dec90ec 100644 --- a/src/Console/Middlewares/ConfigPropsMiddleware.php +++ b/src/Console/Middlewares/ConfigPropsMiddleware.php @@ -2,8 +2,8 @@ namespace MaplePHP\Unitary\Console\Middlewares; +use MaplePHP\Emitron\Configs\ConfigPropsFactory; use MaplePHP\Emitron\Contracts\ConfigPropsInterface; -use MaplePHP\Unitary\Support\Helpers; use Psr\Container\ContainerExceptionInterface; use Psr\Container\ContainerInterface; use Psr\Container\NotFoundExceptionInterface; @@ -67,7 +67,7 @@ private function getInitProps(): ConfigPropsInterface try { $props = array_merge($configs->getProps()->toArray(), $args); - $this->props = Helpers::getConfigPropInst($props); + $this->props = ConfigPropsFactory::create($props); if ($this->props->hasMissingProps() !== [] && isset($args['verbose'])) { $command->error('The properties (' . implode(", ", $this->props->hasMissingProps()) . ') is not exist in ' . get_class($this->props)); diff --git a/src/Support/Helpers.php b/src/Support/Helpers.php index 92e8cd1..0a17b57 100644 --- a/src/Support/Helpers.php +++ b/src/Support/Helpers.php @@ -21,27 +21,6 @@ final class Helpers { - - - /** - * Get expected instance of Config Props - * - * @param array $props - * @return ConfigPropsInterface - */ - public static function getConfigPropInst(array $props): ConfigPropsInterface - { - $override = '\\Configs\\ConfigProps'; - $default = \MaplePHP\Unitary\Config\ConfigProps::class; - $name = class_exists($override) ? $override : $default; - if (!is_subclass_of($name, ConfigPropsInterface::class)) { - $name = $default; - } - return new $name($props); - } - - - /** * Convert bytes to megabytes and return as a string with fixed precision. * From 22e6d5b94bd1924d2d8769b4c6922b093acdba07 Mon Sep 17 00:00:00 2001 From: Daniel Ronkainen Date: Sat, 21 Feb 2026 11:47:50 +0100 Subject: [PATCH 05/10] feat: add a closure chain of expect method --- bin/unitary | 2 +- composer.json | 22 ++++++++++++++++++---- src/Expect.php | 6 ++++++ src/Support/Helpers.php | 1 - src/TestCase.php | 20 +++++++++++++++++--- src/TestItem.php | 3 ++- tests/unitary-mock.php | 7 +++---- 7 files changed, 47 insertions(+), 14 deletions(-) diff --git a/bin/unitary b/bin/unitary index 236af2d..6e2491f 100755 --- a/bin/unitary +++ b/bin/unitary @@ -28,4 +28,4 @@ $app = (new Application()) ->boot([ "argv" => $argv, "dir" => getcwd() - ]); + ]); \ No newline at end of file diff --git a/composer.json b/composer.json index 56071a4..945a8b4 100644 --- a/composer.json +++ b/composer.json @@ -24,9 +24,9 @@ "require": { "php": ">=8.0", "composer/semver": "^3.4", - "maplephp/blunder": "^1.3", + "maplephp/blunder": "*", "maplephp/dto": "^3.1", - "maplephp/emitron": "^1.0", + "maplephp/emitron": "*", "maplephp/http": "^2.0", "maplephp/validate": "^2.0", "maplephp/prompts": "^1.2", @@ -36,7 +36,21 @@ "repositories": [ { "type": "path", - "url": "../libraries/Emitron", + "url": "../Emitron", + "options": { + "symlink": true + } + }, + { + "type": "path", + "url": "../Blunder", + "options": { + "symlink": true + } + }, + { + "type": "path", + "url": "../Validate", "options": { "symlink": true } @@ -54,5 +68,5 @@ "bin": [ "bin/unitary" ], - "minimum-stability": "stable" + "minimum-stability": "dev" } diff --git a/src/Expect.php b/src/Expect.php index 860320c..7af64fc 100644 --- a/src/Expect.php +++ b/src/Expect.php @@ -37,6 +37,12 @@ public static function value(mixed $value): self return new self($value); } + + public function expect(mixed $value): self + { + return $this->setValue($value); + } + /** * We need to pass a test case to Exception to create one loop * diff --git a/src/Support/Helpers.php b/src/Support/Helpers.php index 0a17b57..62a909b 100644 --- a/src/Support/Helpers.php +++ b/src/Support/Helpers.php @@ -14,7 +14,6 @@ use ErrorException; use Exception; -use MaplePHP\Emitron\Contracts\ConfigPropsInterface; use MaplePHP\Blunder\ExceptionItem; use MaplePHP\Blunder\Handlers\CliHandler; use MaplePHP\DTO\Format\Str; diff --git a/src/TestCase.php b/src/TestCase.php index dc0e49f..357d6b6 100755 --- a/src/TestCase.php +++ b/src/TestCase.php @@ -355,12 +355,26 @@ public function validate(mixed $expect, Closure $validation): TestUnit * * @param mixed $value * @return Expect + * @throws ErrorException */ public function expect(mixed $value): Expect { - $this->value = $value; - $this->expect = new Expect($value); - $this->expect->setTestCase($this, debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 2)[0] ?? []); + + if(is_callable($value)) { + $validation = $value; + $expectInst = null; + $this->testUnit = $this->expectAndValidate(null, function (mixed $value, Expect $inst) use ($validation, &$expectInst) { + $expectInst = $inst; + return $validation($inst, new Traverse($value)); + }, $this->error); + + $this->expect = $expectInst; + $this->testUnit->setTestValue($this->expect->getValue()); + } else { + $this->value = $value; + $this->expect = new Expect($value); + $this->expect->setTestCase($this, debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 2)[0] ?? []); + } return $this->expect; } diff --git a/src/TestItem.php b/src/TestItem.php index fc1ae16..5ba2dd6 100755 --- a/src/TestItem.php +++ b/src/TestItem.php @@ -208,7 +208,8 @@ public function getStringifyArgs(): string { if ($this->hasArgs) { $args = array_map(fn ($value) => Helpers::stringifyArgs($value), $this->args); - return "(" . implode(", ", $args) . ")"; + $args = preg_replace('/\R+/', '', implode(", ", $args)); + return "(" . $args . ")"; } return ""; } diff --git a/tests/unitary-mock.php b/tests/unitary-mock.php index 59bd54d..efd79d4 100755 --- a/tests/unitary-mock.php +++ b/tests/unitary-mock.php @@ -90,7 +90,7 @@ $method->method("addFromEmail") ->withArguments("john.doe@gmail.com", "John Doe") ->withArgumentsForCalls(["john.doe@gmail.com", "John Doe"], ["jane.doe@gmail.com", "Jane Doe"]) - ->willThrowOnce(new InvalidArgumentException("Lowrem ipsum")) + ->willThrowOnce(new InvalidArgumentException("Lorem ipsum")) ->called(2); $method->method("addBCC") @@ -105,11 +105,10 @@ ->called(0); }); - $case->validate(fn() => $mail->addFromEmail("john.doe@gmail.com", "John Doe"), function(Expect $inst) { - $inst->isThrowable(InvalidArgumentException::class); + $case->expect(function(Expect $inst) use($mail) { + $inst->expect(fn() => $mail->addFromEmail("john.doe@gmail.com", "John Doe"))->isThrowable(InvalidArgumentException::class); }); - $mail->addFromEmail("jane.doe@gmail.com", "Jane Doe"); $case->error("Test all exception validations") From fc8fbf699bbed8a153c180a36121500ddb586337 Mon Sep 17 00:00:00 2001 From: Daniel Ronkainen Date: Sat, 21 Feb 2026 12:10:41 +0100 Subject: [PATCH 06/10] chore: revert composer.json file from dev stuff --- composer.json | 29 +++-------------------------- 1 file changed, 3 insertions(+), 26 deletions(-) diff --git a/composer.json b/composer.json index 945a8b4..7553e02 100644 --- a/composer.json +++ b/composer.json @@ -24,38 +24,15 @@ "require": { "php": ">=8.0", "composer/semver": "^3.4", - "maplephp/blunder": "*", + "maplephp/blunder": "^1.3", "maplephp/dto": "^3.1", - "maplephp/emitron": "*", + "maplephp/emitron": "^1.0", "maplephp/http": "^2.0", "maplephp/validate": "^2.0", "maplephp/prompts": "^1.2", "maplephp/container": "^2.0", "maplephp/cache": "^2.0" }, - "repositories": [ - { - "type": "path", - "url": "../Emitron", - "options": { - "symlink": true - } - }, - { - "type": "path", - "url": "../Blunder", - "options": { - "symlink": true - } - }, - { - "type": "path", - "url": "../Validate", - "options": { - "symlink": true - } - } - ], "autoload": { "files": [ "src/Setup/assert-polyfill.php", @@ -68,5 +45,5 @@ "bin": [ "bin/unitary" ], - "minimum-stability": "dev" + "minimum-stability": "stable" } From a8cacf68526b85355ac8adca3f225145d213d6f9 Mon Sep 17 00:00:00 2001 From: Daniel Ronkainen Date: Fri, 6 Mar 2026 15:57:21 +0100 Subject: [PATCH 07/10] Make verbose missing test message more clear and user-friendly --- src/Discovery/TestDiscovery.php | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/Discovery/TestDiscovery.php b/src/Discovery/TestDiscovery.php index 9243a32..d115000 100755 --- a/src/Discovery/TestDiscovery.php +++ b/src/Discovery/TestDiscovery.php @@ -202,14 +202,11 @@ private function executeUnitFile(string $file): void $ok = self::$unitary->execute(); if (!$ok && $verbose) { - trigger_error( - "\n\nCould not find any tests inside the test file:\n$file\n\nPossible causes:\n" . - " • There are no test in test group/case.\n" . - " • Unitary could not locate the Unit instance.\n" . - " • You did not use the `group()` function.\n" . - " • You created a new Unit in the test file but did not return it at the end.\n\n", - E_USER_WARNING - ); + throw new BlunderSoftException("Could not find any tests inside the test file: $file\n\nPossible causes:\n" . + " • There are no test in test group/case.\n" . + " • Unitary could not locate the Unit instance.\n" . + " • You did not use the `group()` function.\n" . + " • You created a new Unit in the test file but did not return it at the end.\n\n", 0, 0, $file); } } From 2e993f8d2e129f4fbe73f25ad495cf2e28221d9c Mon Sep 17 00:00:00 2001 From: Daniel Ronkainen Date: Fri, 6 Mar 2026 19:17:30 +0100 Subject: [PATCH 08/10] fix: config prop inheritance --- composer.json | 8 +++++++- src/Console/Kernel.php | 3 ++- src/Console/Middlewares/ConfigPropsMiddleware.php | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index 7553e02..c9903d9 100644 --- a/composer.json +++ b/composer.json @@ -33,6 +33,11 @@ "maplephp/container": "^2.0", "maplephp/cache": "^2.0" }, + "extra": { + "branch-alias": { + "dev-main": "2.x-dev" + } + }, "autoload": { "files": [ "src/Setup/assert-polyfill.php", @@ -45,5 +50,6 @@ "bin": [ "bin/unitary" ], - "minimum-stability": "stable" + "minimum-stability": "dev", + "prefer-stable": true } diff --git a/src/Console/Kernel.php b/src/Console/Kernel.php index ea8b36a..e7845d9 100644 --- a/src/Console/Kernel.php +++ b/src/Console/Kernel.php @@ -17,6 +17,7 @@ use Exception; use MaplePHP\Emitron\Contracts\DispatchConfigInterface; use MaplePHP\Emitron\DispatchConfig; +use MaplePHP\Unitary\Config\ConfigProps; use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Message\StreamInterface; use MaplePHP\Unitary\Support\Router; @@ -72,7 +73,7 @@ public function run(ServerRequestInterface $request, ?StreamInterface $stream = */ private function configuration(ServerRequestInterface $request): DispatchConfigInterface { - $config = new DispatchConfig(EmitronKernel::getConfigFilePath()); + $config = new DispatchConfig(EmitronKernel::getConfigFilePath(), ConfigProps::class); return $config ->setRouter(function ($routerFile) use ($request) { $router = new Router($request->getCliKeyword(), $request->getCliArgs()); diff --git a/src/Console/Middlewares/ConfigPropsMiddleware.php b/src/Console/Middlewares/ConfigPropsMiddleware.php index dec90ec..ff319c2 100644 --- a/src/Console/Middlewares/ConfigPropsMiddleware.php +++ b/src/Console/Middlewares/ConfigPropsMiddleware.php @@ -67,7 +67,7 @@ private function getInitProps(): ConfigPropsInterface try { $props = array_merge($configs->getProps()->toArray(), $args); - $this->props = ConfigPropsFactory::create($props); + $this->props = ConfigPropsFactory::create($props, $configs->getConfigPropsClass()); if ($this->props->hasMissingProps() !== [] && isset($args['verbose'])) { $command->error('The properties (' . implode(", ", $this->props->hasMissingProps()) . ') is not exist in ' . get_class($this->props)); From b3386d2e81a98a133c0f887fec1cec38ae120431 Mon Sep 17 00:00:00 2001 From: Daniel Ronkainen Date: Mon, 9 Mar 2026 22:01:56 +0100 Subject: [PATCH 09/10] fix: add path to to config props --- src/Config/ConfigProps.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Config/ConfigProps.php b/src/Config/ConfigProps.php index 846e110..780bd3c 100644 --- a/src/Config/ConfigProps.php +++ b/src/Config/ConfigProps.php @@ -25,6 +25,7 @@ class ConfigProps extends AbstractConfigProps public ?string $timezone = null; public ?string $locale = null; public ?string $type = null; + public ?string $path = null; public ?int $exitCode = null; public ?bool $verbose = null; public ?bool $alwaysShowFiles = null; From 86e3a22aecdb2f4e818efb7fbb530d65a3ae444b Mon Sep 17 00:00:00 2001 From: Daniel Ronkainen Date: Mon, 9 Mar 2026 22:03:04 +0100 Subject: [PATCH 10/10] build: add unitary test to actions --- .github/workflows/php.yml | 34 ++++++++++++++++++++++++++++++++++ composer.json | 14 +++++++++----- 2 files changed, 43 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/php.yml diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml new file mode 100644 index 0000000..dfc486e --- /dev/null +++ b/.github/workflows/php.yml @@ -0,0 +1,34 @@ +name: PHP Unitary + +on: + push: + branches: ["main"] + pull_request: + branches: ["main"] + workflow_dispatch: + +permissions: + contents: read + +jobs: + build: + runs-on: ubuntu-latest + env: + COMPOSER_ROOT_VERSION: 2.x-dev + + steps: + - uses: actions/checkout@v4 + + - name: Cache Composer packages + uses: actions/cache@v3 + with: + path: vendor + key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-php- + + - name: Install dependencies + run: composer install --prefer-dist --no-progress + + - name: Run test suite + run: php bin/unitary \ No newline at end of file diff --git a/composer.json b/composer.json index c9903d9..78b84a1 100644 --- a/composer.json +++ b/composer.json @@ -21,6 +21,9 @@ "homepage": "https://maplephp.github.io/Unitary/" } ], + "scripts": { + "test": "php bin/unitary" + }, "require": { "php": ">=8.0", "composer/semver": "^3.4", @@ -33,11 +36,6 @@ "maplephp/container": "^2.0", "maplephp/cache": "^2.0" }, - "extra": { - "branch-alias": { - "dev-main": "2.x-dev" - } - }, "autoload": { "files": [ "src/Setup/assert-polyfill.php", @@ -50,6 +48,12 @@ "bin": [ "bin/unitary" ], + "extra": { + "branch-alias": { + "dev-main": "2.x-dev", + "dev-develop": "2.x-dev" + } + }, "minimum-stability": "dev", "prefer-stable": true }