itShouldCreateCustomEventStoreRelationTableSchema()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 8
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 12
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Gember\RdbmsEventStoreDoctrineDbal\Test\TableSchema;
6
7
use Gember\RdbmsEventStoreDoctrineDbal\TableSchema\TableSchemaFactory;
0 ignored issues
show
Bug introduced by
The type Gember\RdbmsEventStoreDo...hema\TableSchemaFactory was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
8
use PHPUnit\Framework\Attributes\Test;
0 ignored issues
show
Bug introduced by
The type PHPUnit\Framework\Attributes\Test was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
9
use PHPUnit\Framework\TestCase;
10
11
/**
12
 * @internal
13
 */
14
final class TableSchemaFactoryTest extends TestCase
15
{
16
    #[Test]
17
    public function itShouldCreateDefaultEventStoreTableSchema(): void
18
    {
19
        $schema = TableSchemaFactory::createDefaultEventStore();
20
21
        self::assertSame('event_store', $schema->tableName);
22
        self::assertSame('id', $schema->eventIdFieldName);
23
        self::assertSame('event_name', $schema->eventNameFieldName);
24
        self::assertSame('payload', $schema->payloadFieldName);
25
        self::assertSame('metadata', $schema->metadataFieldName);
26
        self::assertSame('applied_at', $schema->appliedAtFieldName);
27
        self::assertSame('Y-m-d H:i:s.u', $schema->appliedAtFieldFormat);
28
    }
29
30
    #[Test]
31
    public function itShouldCreateCustomEventStoreTableSchema(): void
32
    {
33
        $schema = TableSchemaFactory::createDefaultEventStore(
34
            'custom_event_store',
35
            'custom_event_id',
36
            'custom_event_name',
37
            'custom_payload',
38
            'custom_metadata',
39
            'custom_applied_at',
40
            'custom_applied_at_format',
41
        );
42
43
        self::assertSame('custom_event_store', $schema->tableName);
44
        self::assertSame('custom_event_id', $schema->eventIdFieldName);
45
        self::assertSame('custom_event_name', $schema->eventNameFieldName);
46
        self::assertSame('custom_payload', $schema->payloadFieldName);
47
        self::assertSame('custom_metadata', $schema->metadataFieldName);
48
        self::assertSame('custom_applied_at', $schema->appliedAtFieldName);
49
        self::assertSame('custom_applied_at_format', $schema->appliedAtFieldFormat);
50
    }
51
52
    #[Test]
53
    public function itShouldCreateDefaultEventStoreRelationTableSchema(): void
54
    {
55
        $schema = TableSchemaFactory::createDefaultEventStoreRelation();
56
57
        self::assertSame('event_store_relation', $schema->tableName);
58
        self::assertSame('event_id', $schema->eventIdFieldName);
59
        self::assertSame('domain_id', $schema->domainIdFieldName);
60
    }
61
62
    #[Test]
63
    public function itShouldCreateCustomEventStoreRelationTableSchema(): void
64
    {
65
        $schema = TableSchemaFactory::createDefaultEventStoreRelation(
66
            'custom_event_store_relation',
67
            'custom_event_id',
68
            'custom_domain_id',
69
        );
70
71
        self::assertSame('custom_event_store_relation', $schema->tableName);
72
        self::assertSame('custom_event_id', $schema->eventIdFieldName);
73
        self::assertSame('custom_domain_id', $schema->domainIdFieldName);
74
    }
75
}
76