Files
lean-console/src/Controller/Testing.php
T
mcndave 58c61a8f01 - UI Revamp
- Some i18n added/fixed
- WIP on a new testing mechanism
2026-11-25 19:18:36 +00:00

31 lines
956 B
PHP

<?php
namespace Lean\Console\Controller;
use DI\Attribute\Inject;
use Psr\Http\Message\{ ResponseInterface, ServerRequestInterface };
use Notes\Route\Attribute\Method\Route;
use Lean\Console\{ Lib, Form };
class Testing extends Console {
use Lib\ConsoleControllerTrait;
#[Inject]
protected Lib\Testing\TestFetcher $testFetcher;
#[Route(route: "/testing/tests", name: "lean.console:testing.tests", method: [ 'GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'OPTION', 'HEAD' ])]
public function tests(ServerRequestInterface $request, array $arguments) : ResponseInterface
{
$context = new Form\Testing\TestContext($request, "tests.run");
$this->form(new Form\Testing\Test($this->container, $this->testFetcher), $context);
if ($context->formExecuted) {
return $context->formExecutionStatus;
}
return $this->renderView("lean-console/page/testing/tests", get_defined_vars());
}
}