wip: guest account registration (self-service and booking create flow)
This commit is contained in:
1 parent
e4430ac5c5
commit
d74888f64b
43 files changed
+2736
-144
No files matched your search
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Tests\Command;
|
||||
|
||||
use App\Command\CleanupGuestInviteAccountsCommand;
|
||||
use App\Repository\UserRepository;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Component\Console\Tester\CommandTester;
|
||||
|
||||
class CleanupGuestInviteAccountsCommandTest extends TestCase
|
||||
{
|
||||
public function testCommandReportsWhenNothingWasDeleted(): void
|
||||
{
|
||||
$repository = $this->createMock(UserRepository::class);
|
||||
$repository
|
||||
->expects(self::once())
|
||||
->method('deleteExpiredDormantGuestInvites')
|
||||
->with(self::isInstanceOf(\DateTimeImmutable::class))
|
||||
->willReturn(0);
|
||||
|
||||
$logger = $this->createMock(LoggerInterface::class);
|
||||
$logger->expects(self::never())->method('info');
|
||||
|
||||
$tester = new CommandTester(new CleanupGuestInviteAccountsCommand($repository, $logger));
|
||||
$exitCode = $tester->execute([]);
|
||||
|
||||
self::assertSame(0, $exitCode);
|
||||
self::assertStringContainsString('No expired dormant guest accounts found.', $tester->getDisplay());
|
||||
}
|
||||
|
||||
public function testCommandLogsAndReportsDeletionCount(): void
|
||||
{
|
||||
$repository = $this->createMock(UserRepository::class);
|
||||
$repository
|
||||
->expects(self::once())
|
||||
->method('deleteExpiredDormantGuestInvites')
|
||||
->with(self::isInstanceOf(\DateTimeImmutable::class))
|
||||
->willReturn(3);
|
||||
|
||||
$logger = $this->createMock(LoggerInterface::class);
|
||||
$logger
|
||||
->expects(self::once())
|
||||
->method('info')
|
||||
->with(
|
||||
'Deleted expired dormant guest accounts',
|
||||
self::callback(static fn (array $context): bool => 3 === $context['count'])
|
||||
);
|
||||
|
||||
$tester = new CommandTester(new CleanupGuestInviteAccountsCommand($repository, $logger));
|
||||
$exitCode = $tester->execute([]);
|
||||
|
||||
self::assertSame(0, $exitCode);
|
||||
self::assertStringContainsString('Deleted 3 expired dormant guest account(s).', $tester->getDisplay());
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user