refactor: unified kernal logic clean up

Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
2026-07-27 08:54:37 -04:00
parent 65c1b5fb75
commit eb99eb5a2e
10 changed files with 197 additions and 130 deletions
@@ -7,6 +7,8 @@ namespace KTXT\Unit\Runtime;
use KTXC\Application\Execution\ExecutionContext;
use KTXC\Application\Execution\ExecutionDescriptor;
use KTXC\Application\Execution\ExecutionOutcome;
use KTXC\Application\Execution\ExecutionRunner;
use KTXC\Application\Execution\ExecutionRunnerInterface;
use KTXC\Application\Execution\ExecutionScope;
use KTXC\Application\Execution\TerminationReport;
use KTXC\Context\IdentityContext;
@@ -110,6 +112,11 @@ final class ConsoleKernel implements KernelInterface
{
}
public function executionRunner(): ExecutionRunnerInterface
{
return new ExecutionRunner($this);
}
public function beginExecution(ExecutionDescriptor $descriptor): ExecutionScope
{
return new ExecutionScope(
+10 -3
View File
@@ -7,6 +7,8 @@ namespace KTXT\Unit\Runtime;
use KTXC\Application\Execution\ExecutionContext;
use KTXC\Application\Execution\ExecutionDescriptor;
use KTXC\Application\Execution\ExecutionOutcome;
use KTXC\Application\Execution\ExecutionRunner;
use KTXC\Application\Execution\ExecutionRunnerInterface;
use KTXC\Application\Execution\ExecutionScope;
use KTXC\Application\Execution\TerminationReport;
use KTXC\Context\IdentityContext;
@@ -68,7 +70,7 @@ final class HttpRuntimeTest extends TestCase
public function succeeds(): void
{
$kernel = $this->kernel(new ResponseMiddleware(new Response('ok', 200)));
$response = (new HttpRuntime($kernel, false))->handle(Request::create('/'));
$response = (new HttpRuntime($kernel, false))->run(Request::create('/'), send: false);
self::assertSame(200, $response->getStatusCode());
self::assertSame('ok', $response->getContent());
@@ -84,7 +86,7 @@ final class HttpRuntimeTest extends TestCase
$previousLog = ini_get('error_log');
ini_set('error_log', '/dev/null');
try {
$response = (new HttpRuntime($kernel, false))->handle(Request::create('/'));
$response = (new HttpRuntime($kernel, false))->run(Request::create('/'), send: false);
} finally {
ini_set('error_log', (string) $previousLog);
}
@@ -104,7 +106,7 @@ final class HttpRuntimeTest extends TestCase
failures: [new \RuntimeException('Deferred listener failed.')],
);
$response = (new HttpRuntime($kernel, false))->handle(Request::create('/'));
$response = (new HttpRuntime($kernel, false))->run(Request::create('/'), send: false);
self::assertSame(202, $response->getStatusCode());
self::assertSame('accepted', $response->getContent());
@@ -144,6 +146,11 @@ final class RuntimeKernel implements KernelInterface
{
}
public function executionRunner(): ExecutionRunnerInterface
{
return new ExecutionRunner($this);
}
public function beginExecution(ExecutionDescriptor $descriptor): ExecutionScope
{
$this->active = true;