Skip to content

Commit d8aaccf

Browse files
committed
fixed missing ext-redis
Signed-off-by: bota <[email protected]>
1 parent 59a7f4e commit d8aaccf

File tree

14 files changed

+116
-78
lines changed

14 files changed

+116
-78
lines changed

.laminas-ci.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
{
22
"additional_composer_arguments": [
3-
"--no-scripts",
4-
"--no-plugins"
3+
"--no-scripts"
4+
],
5+
"extensions": [
6+
"redis"
57
],
68
"ignore_php_platform_requirements": {
79
}
8-
}
10+
}

.laminas-ci/pre-run.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#!/bin/bash
1+
JOB=$3
2+
PHP_VERSION=$(echo "${JOB}" | jq -r '.php')
23

3-
# Due to the fact that we are disabling plugins when installing/updating/downgrading composer dependencies
4-
# we have to manually enable the coding standard here.
5-
composer enable-codestandard
4+
apt update
5+
apt install -y "php${PHP_VERSION}-swoole"

config/autoload/mail.global.php

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
return [
6+
/**
7+
* Dotkernel mail module configuration
8+
* Note that many of these options can be set programmatically too, when sending mail messages actually that is
9+
* what you'll usually do, these configs provide just defaults and options that remain the same for all mails
10+
*/
11+
'dot_mail' => [
12+
//the key is the mail service name, this is the default one, which does not extend any configuration
13+
'default' => [
14+
//message configuration
15+
'message_options' => [
16+
//from email address of the email
17+
'from' => '',
18+
//from name to be displayed instead of from address
19+
'from_name' => '',
20+
//reply-to email address of the email
21+
'reply_to' => '',
22+
//replyTo name to be displayed instead of the address
23+
'reply_to_name' => '',
24+
//destination email address as string or a list of email addresses
25+
'to' => [],
26+
//copy destination addresses
27+
'cc' => [],
28+
//hidden copy destination addresses
29+
'bcc' => [],
30+
//email subject
31+
'subject' => '',
32+
//body options - content can be plain text, HTML
33+
'body' => [
34+
'content' => '',
35+
'charset' => 'utf-8',
36+
],
37+
//attachments config
38+
'attachments' => [
39+
'files' => [],
40+
'dir' => [
41+
'iterate' => false,
42+
'path' => 'data/mail/attachments',
43+
'recursive' => false,
44+
],
45+
],
46+
],
47+
/**
48+
* the mail transport to use can be any class implementing
49+
* Symfony\Component\Mailer\Transport\TransportInterface
50+
*
51+
* for standard mail transports, you can use these aliases:
52+
* - sendmail => Symfony\Component\Mailer\Transport\SendmailTransport
53+
* - esmtp => Symfony\Component\Mailer\Transport\Smtp\EsmtpTransport
54+
*
55+
* defaults to sendmail
56+
**/
57+
'transport' => 'sendmail',
58+
//options that will be used only if esmtp adapter is used
59+
'smtp_options' => [
60+
//hostname or IP address of the mail server
61+
'host' => '',
62+
//port of the mail server - 587 or 465 for secure connections
63+
'port' => 587,
64+
'connection_config' => [
65+
//the smtp authentication identity
66+
'username' => '',
67+
//the smtp authentication credential
68+
'password' => '',
69+
/**
70+
* tls will run by default on this component, use:
71+
*
72+
* null - to avoid interfering with automatic encryption
73+
* false - to disable automatic encryption
74+
*
75+
* It's not recommended to disable TLS while connecting to an SMTP server over the Internet
76+
**/
77+
'tls' => null,
78+
],
79+
],
80+
],
81+
// option to log the SENT emails
82+
'log' => [
83+
'sent' => getcwd() . '/log/mail/sent.log',
84+
],
85+
],
86+
];

src/App/ConfigProvider.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
use Netglue\PsrContainer\Messenger\Container\Middleware\MessageHandlerMiddlewareStaticFactory;
1111
use Netglue\PsrContainer\Messenger\Container\Middleware\MessageSenderMiddlewareStaticFactory;
1212
use Netglue\PsrContainer\Messenger\HandlerLocator\OneToManyFqcnContainerHandlerLocator;
13-
use Queue\App\Message\ExampleMessage;
14-
use Queue\App\Message\ExampleMessageHandler;
13+
use Queue\App\Message\Message;
14+
use Queue\App\Message\MessageHandler;
1515
use Symfony\Component\Messenger\MessageBusInterface;
1616

1717
class ConfigProvider
@@ -37,7 +37,7 @@ private function getDependencies(): array
3737
"message_bus_stamp_middleware" => [BusNameStampMiddlewareStaticFactory::class, "message_bus"],
3838
"message_bus_sender_middleware" => [MessageSenderMiddlewareStaticFactory::class, "message_bus"],
3939
"message_bus_handler_middleware" => [MessageHandlerMiddlewareStaticFactory::class, "message_bus"],
40-
ExampleMessageHandler::class => AttributedServiceFactory::class,
40+
MessageHandler::class => AttributedServiceFactory::class,
4141
],
4242
"aliases" => [
4343
MessageBusInterface::class => "message_bus",
@@ -81,7 +81,7 @@ private function busConfig(): array
8181
*/
8282
'handler_locator' => OneToManyFqcnContainerHandlerLocator::class,
8383
'handlers' => [
84-
ExampleMessage::class => [ExampleMessageHandler::class],
84+
Message::class => [MessageHandler::class],
8585
],
8686

8787
/**
@@ -97,7 +97,7 @@ private function busConfig(): array
9797
* Route specific messages to specific transports by using the message name as the key.
9898
*/
9999
'routes' => [
100-
ExampleMessage::class => ["redis_transport"],
100+
Message::class => ["redis_transport"],
101101
],
102102
],
103103
];
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
namespace Queue\App\Message;
66

7-
class ExampleMessage
7+
class Message
88
{
99
public function __construct(
1010
private array $payload,
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
use function json_decode;
1717

18-
class ExampleMessageHandler
18+
class MessageHandler
1919
{
2020
protected array $args = [];
2121

@@ -35,7 +35,7 @@ public function __construct(
3535
) {
3636
}
3737

38-
public function __invoke(ExampleMessage $message): void
38+
public function __invoke(Message $message): void
3939
{
4040
$payload = json_decode($message->getPayload()['foo'], true);
4141

src/Swoole/Delegators/TCPServerDelegator.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
namespace Queue\Swoole\Delegators;
66

77
use Psr\Container\ContainerInterface;
8-
use Queue\App\Message\ExampleMessage;
8+
use Queue\App\Message\Message;
99
use Swoole\Server as TCPSwooleServer;
1010
use Symfony\Component\Messenger\MessageBusInterface;
1111
use Symfony\Component\Messenger\Stamp\DelayStamp;
@@ -28,8 +28,8 @@ public function __invoke(ContainerInterface $container, string $serviceName, cal
2828

2929
// Register the function for the event `receive`
3030
$server->on('receive', function ($server, $fd, $fromId, $data) use ($logger, $bus) {
31-
$bus->dispatch(new ExampleMessage(["foo" => $data]));
32-
$bus->dispatch(new ExampleMessage(["foo" => "with 5 seconds delay"]), [
31+
$bus->dispatch(new Message(["foo" => $data]));
32+
$bus->dispatch(new Message(["foo" => "with 5 seconds delay"]), [
3333
new DelayStamp(5000),
3434
]);
3535

test/App/Message/ExampleMessageHandlerTest.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
use Mezzio\Template\TemplateRendererInterface;
1414
use PHPUnit\Framework\MockObject\MockObject;
1515
use PHPUnit\Framework\TestCase;
16-
use Queue\App\Message\ExampleMessage;
17-
use Queue\App\Message\ExampleMessageHandler;
16+
use Queue\App\Message\Message;
17+
use Queue\App\Message\MessageHandler;
1818
use Symfony\Component\Mailer\Exception\TransportExceptionInterface;
1919

2020
use function json_encode;
@@ -26,7 +26,7 @@ class ExampleMessageHandlerTest extends TestCase
2626
protected UserRepository|MockObject $userRepository;
2727
protected Logger $logger;
2828
protected array $config;
29-
private ExampleMessageHandler $handler;
29+
private MessageHandler $handler;
3030

3131
/**
3232
* @throws Exception|\PHPUnit\Framework\MockObject\Exception
@@ -60,7 +60,7 @@ public function setUp(): void
6060
],
6161
];
6262

63-
$this->handler = new ExampleMessageHandler(
63+
$this->handler = new MessageHandler(
6464
$this->mailService,
6565
$this->renderer,
6666
$this->userRepository,
@@ -76,12 +76,12 @@ public function testInvokeHandlesExceptionThrownByPerform(): void
7676
{
7777
$uuid = '1234';
7878

79-
$message = $this->createMock(ExampleMessage::class);
79+
$message = $this->createMock(Message::class);
8080
$message->method('getPayload')->willReturn([
8181
'foo' => json_encode(['userUuid' => $uuid]),
8282
]);
8383

84-
$handlerMock = $this->getMockBuilder(ExampleMessageHandler::class)
84+
$handlerMock = $this->getMockBuilder(MessageHandler::class)
8585
->setConstructorArgs([
8686
$this->mailService,
8787
$this->renderer,
@@ -109,7 +109,7 @@ public function testInvokeWithValidPayload(): void
109109
$email = '[email protected]';
110110
$name = 'dotkernel';
111111

112-
$message = $this->createMock(ExampleMessage::class);
112+
$message = $this->createMock(Message::class);
113113
$message->method('getPayload')->willReturn([
114114
'foo' => json_encode(['userUuid' => $uuid]),
115115
]);
@@ -187,7 +187,7 @@ public function testSendWelcomeMailHandlesMailException(): void
187187
*/
188188
public function testInvokeWithInvalidJsonSkipsPerform(): void
189189
{
190-
$message = $this->createMock(ExampleMessage::class);
190+
$message = $this->createMock(Message::class);
191191
$message->method('getPayload')->willReturn([
192192
'foo' => '{"userUuid":',
193193
]);

test/App/Message/ExampleMessageTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
namespace QueueTest\App\Message;
66

77
use PHPUnit\Framework\TestCase;
8-
use Queue\App\Message\ExampleMessage;
8+
use Queue\App\Message\Message;
99

1010
class ExampleMessageTest extends TestCase
1111
{
1212
public function testMessageAccessors(): void
1313
{
14-
$admin = new ExampleMessage(["payload" => "test message payload"]);
14+
$admin = new Message(["payload" => "test message payload"]);
1515
$this->assertSame(["payload" => "test message payload"], $admin->getPayload());
1616
}
1717
}

test/Swoole/Command/Factory/StopCommandFactoryTest.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,6 @@ class StopCommandFactoryTest extends TestCase
1818
*/
1919
public function testFactoryReturnsStopCommandInstance(): void
2020
{
21-
if (! \extension_loaded('swoole')) {
22-
$this->markTestSkipped('Swoole extension not loaded.');
23-
}
24-
2521
$pidManager = $this->createMock(PidManager::class);
2622

2723
$container = $this->createMock(ContainerInterface::class);

0 commit comments

Comments
 (0)