-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBinaryUuidTestTrait.php
More file actions
36 lines (28 loc) · 1.08 KB
/
BinaryUuidTestTrait.php
File metadata and controls
36 lines (28 loc) · 1.08 KB
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
<?php
declare(strict_types=1);
namespace EventSauce\MessageRepository\TestTooling;
trait BinaryUuidTestTrait
{
/**
* @test
*/
public function it_uses_correct_parameter_types_for_binary_fields(): void
{
if (version_compare(PHP_VERSION, '8.4', '<')) {
self::markTestSkipped('PHP version needs to be >=8.4 to have PDO use binary hints');
}
$repository = $this->messageRepository();
$message = $this->createMessage('payload');
$repository->persist($message);
$this->assertWarnings('persist()');
$repository->retrieveAll($message->aggregateRootId());
$this->assertWarnings('retrieveAll()');
$repository->retrieveAllAfterVersion($message->aggregateRootId(), 1);
$this->assertWarnings('retrieveAllAfterVersion()');
}
private function assertWarnings(string $scenario): void
{
$warnings = $this->connection->executeQuery('SHOW WARNINGS')->fetchAllAssociative();
self::assertSame([], $warnings, 'Binary uuids were not properly passed during ' . $scenario);
}
}