refactor(kernel): unify HTTP and CLI application lifecycle
Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
@@ -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(),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user