Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,20 +43,21 @@
}
},
"require": {
"php": "~8.2.0 || ~8.3.0",
"php": "~8.2.0 || ~8.3.0 || ~8.4.0",
"ext-sockets": "*",
"clue/socket-raw": "^v1.6.0",
"dotkernel/dot-cache": "^4.3",
"dotkernel/dot-cli": "^3.9",
"dotkernel/dot-data-fixtures": "^1.4.0",
"dotkernel/dot-dependency-injection": "^1.2",
"dotkernel/dot-log": "4.0.4",
"dotkernel/dot-errorhandler": "4.2.1",
"dotkernel/dot-mail": "^5.3.0",
"dotkernel/dot-twigrenderer": "3.6.0",
"laminas/laminas-authentication": "2.18.0",
"laminas/laminas-component-installer": "^3.5",
"laminas/laminas-config-aggregator": "^1.18",
"mezzio/mezzio": "^3.20",
"mezzio/mezzio-authentication-oauth2": "^2.11",
"mezzio/mezzio-twigrenderer": "^2.17.0",
"netglue/laminas-messenger": "^2.3.0",
"ramsey/uuid": "^4.5.0",
"ramsey/uuid-doctrine": "^2.1.0",
Expand Down
10 changes: 1 addition & 9 deletions config/autoload/templates.global.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@

declare(strict_types=1);

use Dot\Twig\Extension\DateExtension;
use Dot\Twig\Extension\TranslationExtension;
use Laminas\ServiceManager\Factory\InvokableFactory;
use Mezzio\Template\TemplateRendererInterface;
use Mezzio\Twig\TwigEnvironmentFactory;
use Mezzio\Twig\TwigRendererFactory;
Expand All @@ -13,10 +10,8 @@
return [
'dependencies' => [
'factories' => [
DateExtension::class => InvokableFactory::class,
Environment::class => TwigEnvironmentFactory::class,
TemplateRendererInterface::class => TwigRendererFactory::class,
TranslationExtension::class => InvokableFactory::class,
],
],
'debug' => false,
Expand All @@ -29,10 +24,7 @@
'auto_reload' => true,
'autoescape' => 'html',
'cache_dir' => 'data/cache/twig',
'extensions' => [
DateExtension::class,
TranslationExtension::class,
],
'extensions' => [],
'globals' => [
'appName' => $app['name'] ?? '',
],
Expand Down
6 changes: 3 additions & 3 deletions config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@
Queue\Swoole\ConfigProvider::class,

// Dotkernel packages
Dot\Log\ConfigProvider::class,
Dot\Cache\ConfigProvider::class,
Dot\Cli\ConfigProvider::class,
Dot\DataFixtures\ConfigProvider::class,
Dot\DependencyInjection\ConfigProvider::class,
Dot\ErrorHandler\ConfigProvider::class,
Dot\Log\ConfigProvider::class,
Dot\Mail\ConfigProvider::class,
Dot\Twig\ConfigProvider::class,
Dot\Cache\ConfigProvider::class,

// Core modules
Core\Admin\ConfigProvider::class,
Expand Down
8 changes: 1 addition & 7 deletions src/App/Message/MessageHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,22 +46,16 @@ public function __invoke(Message $message): void
try {
$this->perform();
} catch (Exception $exception) {
$this->logger->err("message: " . $exception->getMessage());
$this->logger->error("message: " . $exception->getMessage());
}
}
}

/**
* @throws MailException
*/
public function perform(): void
{
$this->sendWelcomeMail();
}

/**
* @throws MailException
*/
public function sendWelcomeMail(): bool
{
$user = $this->userRepository->find($this->args['userUuid']);
Expand Down
15 changes: 0 additions & 15 deletions src/Core/src/App/src/InputFilter/AbstractInputFilter.php

This file was deleted.

14 changes: 7 additions & 7 deletions src/Core/src/App/src/Service/MailService.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use Core\App\Message;
use Core\User\Entity\User;
use Dot\DependencyInjection\Attribute\Inject;
use Dot\Log\LoggerInterface;
use Dot\Log\Logger;
use Dot\Mail\Exception\MailException;
use Symfony\Component\Mailer\Exception\TransportExceptionInterface;

Expand All @@ -25,7 +25,7 @@ class MailService
)]
public function __construct(
protected \Dot\Mail\Service\MailService $mailService,
protected LoggerInterface $logger,
protected Logger $logger,
private readonly array $config,
) {
}
Expand All @@ -46,7 +46,7 @@ public function sendActivationMail(User $user, string $body): bool
try {
return $this->mailService->send()->isValid();
} catch (MailException | TransportExceptionInterface $exception) {
$this->logger->err($exception->getMessage());
$this->logger->error($exception->getMessage());
throw new MailException(sprintf(Message::MAIL_NOT_SENT_TO, $user->getEmail()));
}
}
Expand All @@ -65,7 +65,7 @@ public function sendResetPasswordRequestedMail(User $user, string $body): bool
try {
return $this->mailService->send()->isValid();
} catch (MailException | TransportExceptionInterface $exception) {
$this->logger->err($exception->getMessage());
$this->logger->error($exception->getMessage());
throw new MailException(sprintf(Message::MAIL_NOT_SENT_TO, $user->getEmail()));
}
}
Expand All @@ -84,7 +84,7 @@ public function sendResetPasswordCompletedMail(User $user, string $body): bool
try {
return $this->mailService->send()->isValid();
} catch (MailException | TransportExceptionInterface $exception) {
$this->logger->err($exception->getMessage());
$this->logger->error($exception->getMessage());
throw new MailException(sprintf(Message::MAIL_NOT_SENT_TO, $user->getEmail()));
}
}
Expand All @@ -103,7 +103,7 @@ public function sendRecoverIdentityMail(User $user, string $body): bool
try {
return $this->mailService->send()->isValid();
} catch (MailException | TransportExceptionInterface $exception) {
$this->logger->err($exception->getMessage());
$this->logger->error($exception->getMessage());
throw new MailException(sprintf(Message::MAIL_NOT_SENT_TO, $user->getEmail()));
}
}
Expand All @@ -120,7 +120,7 @@ public function sendWelcomeMail(User $user, string $body): bool
try {
return $this->mailService->send()->isValid();
} catch (MailException | TransportExceptionInterface $exception) {
$this->logger->err($exception->getMessage());
$this->logger->error($exception->getMessage());
throw new MailException(sprintf(Message::MAIL_NOT_SENT_TO, $user->getEmail()));
}
}
Expand Down
4 changes: 2 additions & 2 deletions test/App/Message/ExampleMessageHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ public function setUp(): void
$this->logger = new Logger([
'writers' => [
'FileWriter' => [
'name' => 'null',
'priority' => Logger::ALERT,
'name' => 'null',
'level' => Logger::ALERT,
],
],
]);
Expand Down
37 changes: 24 additions & 13 deletions test/Swoole/Delegators/TCPServerDelegatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@

namespace QueueTest\Swoole\Delegators;

use Dot\Log\LoggerInterface;
use Dot\Log\Logger;
use PHPUnit\Framework\Attributes\RunInSeparateProcess;
use PHPUnit\Framework\MockObject\Exception;
use PHPUnit\Framework\TestCase;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\ContainerInterface;
use Queue\Swoole\Delegators\TCPServerDelegator;
use Swoole\Server;
Expand All @@ -16,22 +17,40 @@

class TCPServerDelegatorTest extends TestCase
{
protected Logger $logger;

/**
* @throws ContainerExceptionInterface
*/
public function setUp(): void
{
parent::setUp();

$this->logger = new Logger([
'writers' => [
'FileWriter' => [
'name' => 'null',
'level' => Logger::ALERT,
],
],
]);
}

/**
* @throws Exception
*/
#[RunInSeparateProcess]
public function testInvokeRegistersAllCallbacks(): void
{
$logger = $this->createMock(LoggerInterface::class);
$bus = $this->createMock(MessageBusInterface::class);
$bus = $this->createMock(MessageBusInterface::class);

$server = new DummySwooleServer();
$callback = fn (): Server => $server;

$container = $this->createMock(ContainerInterface::class);
$container->method('get')->willReturnMap([
[MessageBusInterface::class, $bus],
['dot-log.queue-log', $logger],
['dot-log.queue-log', $this->logger],
]);

$delegator = new TCPServerDelegator();
Expand Down Expand Up @@ -61,21 +80,13 @@ public function testReceiveCallbackDispatchesMessagesAndLogs(): void
return new Envelope($message);
});

$logger = $this->createMock(LoggerInterface::class);
$logger->expects($this->once())
->method('notice')
->with(
$this->equalTo("Request received on receive"),
$this->arrayHasKey('fd')
);

$server = new DummySwooleServer();
$callback = fn (): Server => $server;

$container = $this->createMock(ContainerInterface::class);
$container->method('get')->willReturnMap([
[MessageBusInterface::class, $bus],
['dot-log.queue-log', $logger],
['dot-log.queue-log', $this->logger],
]);

$delegator = new TCPServerDelegator();
Expand Down
Loading