-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
DoctrineOutboxRepositoryTest.php
47 lines (39 loc) · 1.38 KB
/
DoctrineOutboxRepositoryTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
namespace EventSauce\MessageOutbox\DoctrineV2Outbox;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Driver\ResultStatement;
use Doctrine\DBAL\DriverManager;
use EventSauce\EventSourcing\Serialization\ConstructingMessageSerializer;
use EventSauce\MessageOutbox\TestTooling\OutboxRepositoryTestCase;
use function interface_exists;
/**
* @group doctrine2
*/
class DoctrineOutboxRepositoryTest extends OutboxRepositoryTestCase
{
private Connection $connection;
protected function setUp(): void
{
if ( ! interface_exists(ResultStatement::class)) {
$this->markTestSkipped('No doctrine v2 installed');
}
parent::setUp();
$this->connection = DriverManager::getConnection(
[
'dbname' => 'outbox_messages',
'user' => 'username',
'password' => 'password',
'host' => getenv('EVENTSAUCE_TESTING_MYSQL_HOST') ?: '127.0.0.1',
'port' => getenv('EVENTSAUCE_TESTING_MYSQL_PORT') ?: '3306',
'driver' => 'pdo_mysql',
]
);
$this->connection->executeQuery('TRUNCATE TABLE outbox_messages');
}
protected function outboxMessageRepository(): DoctrineOutboxRepository
{
return new DoctrineOutboxRepository(
$this->connection, 'outbox_messages', new ConstructingMessageSerializer(),
);
}
}