forked from EventSaucePHP/MessageRepositoryForIlluminate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
IlluminateMessageRepositoryTestCase.php
49 lines (41 loc) · 1.35 KB
/
IlluminateMessageRepositoryTestCase.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
48
49
<?php
namespace EventSauce\MessageRepository\IlluminateMessageRepository;
use EventSauce\EventSourcing\AggregateRootId;
use EventSauce\MessageRepository\TestTooling\MessageRepositoryTestCase;
use Illuminate\Database\Capsule\Manager;
use Illuminate\Database\Connection;
use Ramsey\Uuid\Uuid;
/**
* @group illuminate
*/
abstract class IlluminateMessageRepositoryTestCase extends MessageRepositoryTestCase
{
protected Connection $connection;
protected function setUp(): void
{
parent::setUp();
$manager = new Manager;
$manager->addConnection(
[
'driver' => 'mysql',
'host' => getenv('EVENTSAUCE_TESTING_MYSQL_HOST') ?: '127.0.0.1',
'port' => getenv('EVENTSAUCE_TESTING_MYSQL_PORT') ?: '3306',
'database' => 'outbox_messages',
'username' => 'username',
'password' => 'password',
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
]
);
$this->connection = $manager->getConnection();
$this->connection->table($this->tableName)->truncate();
}
protected function aggregateRootId(): AggregateRootId
{
return DummyAggregateRootId::generate();
}
protected function eventId(): string
{
return Uuid::uuid4()->toString();
}
}