refactor(kernel): unify HTTP and CLI application lifecycle

Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
2026-07-27 00:48:11 -04:00
parent 98826143a8
commit 65c1b5fb75
67 changed files with 2737 additions and 1070 deletions
@@ -7,23 +7,38 @@ namespace KTXT\Unit\Console\Tenant;
use KTXC\Console\Tenant\TenantCreateCommand;
use KTXC\Models\Tenant\TenantObject;
use KTXC\Service\TenantService;
use KTXC\Stores\UserAccountsStore;
use KTXC\Stores\UserRolesStore;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\Attributes\AllowMockObjectsWithoutExpectations;
use PHPUnit\Framework\TestCase;
use Psr\Log\NullLogger;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Tester\CommandTester;
#[AllowMockObjectsWithoutExpectations]
class TenantCreateCommandTest extends TestCase
{
private TenantService&MockObject $tenantService;
private UserRolesStore $rolesStore;
private UserAccountsStore $userStore;
private CommandTester $tester;
private ?TenantObject $deposited = null;
protected function setUp(): void
{
$this->tenantService = $this->createMock(TenantService::class);
$this->rolesStore = $this->createStub(UserRolesStore::class);
$this->rolesStore->method('createRole')->willReturn(['rid' => 'admin']);
$this->userStore = $this->createStub(UserAccountsStore::class);
$this->userStore->method('createUser')->willReturn(['uid' => 'admin']);
$this->tester = new CommandTester(
new TenantCreateCommand($this->tenantService, new NullLogger())
new TenantCreateCommand(
$this->tenantService,
$this->rolesStore,
$this->userStore,
new NullLogger(),
)
);
}
@@ -8,19 +8,18 @@ use KTXC\Console\Tenant\TenantListCommand;
use KTXC\Models\Tenant\DomainCollection;
use KTXC\Models\Tenant\TenantObject;
use KTXC\Service\TenantService;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Tester\CommandTester;
class TenantListCommandTest extends TestCase
{
private TenantService&MockObject $tenantService;
private TenantService $tenantService;
private CommandTester $tester;
protected function setUp(): void
{
$this->tenantService = $this->createMock(TenantService::class);
$this->tenantService = $this->createStub(TenantService::class);
$this->tester = new CommandTester(
new TenantListCommand($this->tenantService)
);