Passed
Push — main ( f72faa...047ba3 )
by Jeroen
07:10 queued 05:07
created

itShouldCreateDefaultEventStoreTableSchema()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 10
nc 1
nop 0
dl 0
loc 13
rs 9.9332
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Gember\RdbmsEventStoreDoctrineDbal\Test\Saga\TableSchema;
6
7
use Gember\RdbmsEventStoreDoctrineDbal\Saga\TableSchema\SagaTableSchemaFactory;
0 ignored issues
show
Bug introduced by
The type Gember\RdbmsEventStoreDo...\SagaTableSchemaFactory 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\TestCase;
9
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...
10
11
/**
12
 * @internal
13
 */
14
final class SagaTableSchemaFactoryTest extends TestCase
15
{
16
    #[Test]
17
    public function itShouldCreateDefaultEventStoreTableSchema(): void
18
    {
19
        $schema = SagaTableSchemaFactory::createDefaultSagaStore();
20
21
        self::assertSame('saga_store', $schema->tableName);
22
        self::assertSame('saga_id', $schema->sagaIdFieldName);
23
        self::assertSame('saga_name', $schema->sagaNameFieldName);
24
        self::assertSame('payload', $schema->payloadFieldName);
25
        self::assertSame('created_at', $schema->createdAtFieldName);
26
        self::assertSame('Y-m-d H:i:s.u', $schema->createdAtFieldFormat);
27
        self::assertSame('updated_at', $schema->updatedAtFieldName);
28
        self::assertSame('Y-m-d H:i:s.u', $schema->updatedAtFieldFormat);
29
    }
30
31
    #[Test]
32
    public function itShouldCreateCustomEventStoreTableSchema(): void
33
    {
34
        $schema = SagaTableSchemaFactory::createDefaultSagaStore(
35
            'custom_saga_store',
36
            'custom_saga_id',
37
            'custom_saga_name',
38
            'custom_payload',
39
            'custom_created_at',
40
            'custom_created_at_format',
41
            'custom_updated_at',
42
            'custom_updated_at_format',
43
        );
44
45
        self::assertSame('custom_saga_store', $schema->tableName);
46
        self::assertSame('custom_saga_id', $schema->sagaIdFieldName);
47
        self::assertSame('custom_saga_name', $schema->sagaNameFieldName);
48
        self::assertSame('custom_payload', $schema->payloadFieldName);
49
        self::assertSame('custom_created_at', $schema->createdAtFieldName);
50
        self::assertSame('custom_created_at_format', $schema->createdAtFieldFormat);
51
        self::assertSame('custom_updated_at', $schema->updatedAtFieldName);
52
        self::assertSame('custom_updated_at_format', $schema->updatedAtFieldFormat);
53
    }
54
}
55