Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
8cae021
Add missing tests for StreamDoctrineDbalStore
DanielBadura Jul 17, 2026
45f6882
Add missing test for invalid stream name exception
DanielBadura Jul 17, 2026
3f92477
Add missing Attribute tests
DanielBadura Jul 17, 2026
0edee9f
Add missing command bus tests
DanielBadura Jul 17, 2026
6b082c0
Add missing command tests
DanielBadura Jul 17, 2026
12051a8
Fix missing call to parent construct
DanielBadura Jul 17, 2026
6db87e0
Add missing cipher key store unit test
DanielBadura Jul 17, 2026
2c55e9d
Add missing Message context unit tests
DanielBadura Jul 17, 2026
5e32412
Add more metadata unit tests
DanielBadura Jul 17, 2026
aa75b6e
Bump patchlevel/hydrator to latest v1 version
DanielBadura Jul 17, 2026
b880eef
Remove symlink test
DanielBadura Jul 17, 2026
d434eda
Add Projection unit tests
DanielBadura Jul 17, 2026
fbc728a
Add more QueryBus unit tests
DanielBadura Jul 17, 2026
3659c1b
Add more Repository unit tests
DanielBadura Jul 17, 2026
1fbd572
Add DoctrineHelper unit tests
DanielBadura Jul 17, 2026
a66fb44
Fix a bug in the event tag extractor: numbers will be autocast to int…
DanielBadura Jul 17, 2026
871870a
Add more cases for snapshot store
DanielBadura Jul 17, 2026
c9fd06b
Add more Store unit tests, VO, exceptions etc
DanielBadura Jul 17, 2026
be378ba
Add alot of subscription unit tests: most vo, exceptions etc
DanielBadura Jul 17, 2026
748c7ff
Increase MSI to 90%
DanielBadura Jul 17, 2026
423ff37
Fix cs
DanielBadura Jul 17, 2026
77cb43a
Add missing connection test
DanielBadura Jul 18, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"php": "~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0",
"doctrine/dbal": "^4.4.0",
"doctrine/migrations": "^3.3.2",
"patchlevel/hydrator": "^1.8.0",
"patchlevel/hydrator": "^1.24.0",
"patchlevel/worker": "^1.4.0",
"psr/cache": "^2.0.0 || ^3.0.0",
"psr/clock": "^1.0",
Expand Down
2 changes: 1 addition & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions infection.json.dist
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"mutators": {
"@default": true
},
"minMsi": 69,
"minCoveredMsi": 86,
"minMsi": 90,
"minCoveredMsi": 90,
"testFrameworkOptions": "--testsuite=unit"
}
86 changes: 37 additions & 49 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -306,54 +306,6 @@ parameters:
count: 1
path: tests/Benchmark/BasicImplementation/Projection/ProfileProjector.php

-
message: '#^Call to an undefined method Patchlevel\\EventSourcing\\Subscription\\Engine\\SubscriptionEngine\:\:boot\(\)\.$#'
identifier: method.notFound
count: 1
path: tests/Benchmark/NoopSubscriptionEngineBench.php

-
message: '#^Call to an undefined method Patchlevel\\EventSourcing\\Subscription\\Engine\\SubscriptionEngine\:\:remove\(\)\.$#'
identifier: method.notFound
count: 1
path: tests/Benchmark/NoopSubscriptionEngineBench.php

-
message: '#^Call to an undefined method Patchlevel\\EventSourcing\\Subscription\\Engine\\SubscriptionEngine\:\:setup\(\)\.$#'
identifier: method.notFound
count: 1
path: tests/Benchmark/NoopSubscriptionEngineBench.php

-
message: '#^Instantiated class Patchlevel\\EventSourcing\\Store\\DoctrineDbalStore not found\.$#'
identifier: class.notFound
count: 1
path: tests/Benchmark/NoopSubscriptionEngineBench.php

-
message: '#^Parameter \#1 \$schemaConfigurator of class Patchlevel\\EventSourcing\\Schema\\ChainDoctrineSchemaConfigurator constructor expects iterable\<Patchlevel\\EventSourcing\\Schema\\DoctrineSchemaConfigurator\>, array\<int, \(Patchlevel\\EventSourcing\\Store\\DoctrineDbalStore&Patchlevel\\EventSourcing\\Store\\Store\)\|Patchlevel\\EventSourcing\\Subscription\\Store\\DoctrineSubscriptionStore\> given\.$#'
identifier: argument.type
count: 1
path: tests/Benchmark/NoopSubscriptionEngineBench.php

-
message: '#^Property Patchlevel\\EventSourcing\\Tests\\Benchmark\\NoopSubscriptionEngineBench\:\:\$id \(Patchlevel\\EventSourcing\\Aggregate\\AggregateRootId\) does not accept Patchlevel\\EventSourcing\\Tests\\Benchmark\\BasicImplementation\\ProfileId\.$#'
identifier: assign.propertyType
count: 1
path: tests/Benchmark/NoopSubscriptionEngineBench.php

-
message: '#^Property Patchlevel\\EventSourcing\\Tests\\Benchmark\\NoopSubscriptionEngineBench\:\:\$id has unknown class Patchlevel\\EventSourcing\\Aggregate\\AggregateRootId as its type\.$#'
identifier: class.notFound
count: 1
path: tests/Benchmark/NoopSubscriptionEngineBench.php

-
message: '#^Property Patchlevel\\EventSourcing\\Tests\\Benchmark\\NoopSubscriptionEngineBench\:\:\$store \(Patchlevel\\EventSourcing\\Store\\Store\) does not accept Patchlevel\\EventSourcing\\Store\\DoctrineDbalStore\.$#'
identifier: assign.propertyType
count: 1
path: tests/Benchmark/NoopSubscriptionEngineBench.php

-
message: '#^Call to static method PHPUnit\\Framework\\Assert\:\:assertInstanceOf\(\) with ''Patchlevel\\\\EventSourcing\\\\Tests\\\\Integration\\\\BankAccountSplitStream\\\\BankAccount'' and Patchlevel\\EventSourcing\\Tests\\Integration\\BankAccountSplitStream\\BankAccount will always evaluate to true\.$#'
identifier: staticMethod.alreadyNarrowedType
Expand Down Expand Up @@ -522,6 +474,18 @@ parameters:
count: 1
path: tests/Unit/Fixture/ProfileInvalid.php

-
message: '#^Property Patchlevel\\EventSourcing\\Tests\\Unit\\Fixture\\BrokenAutoInitializableProfile\:\:\$id is unused\.$#'
identifier: property.unused
count: 1
path: tests/Unit/Fixture/BrokenAutoInitializableProfile.php

-
message: '#^Property Patchlevel\\EventSourcing\\Tests\\Unit\\Fixture\\ProfileWithAggregateStream\:\:\$id is unused\.$#'
identifier: property.unused
count: 1
path: tests/Unit/Fixture/ProfileWithAggregateStream.php

-
message: '#^Property Patchlevel\\EventSourcing\\Tests\\Unit\\Fixture\\ProfileWithBrokenApplyBothUsage\:\:\$id is unused\.$#'
identifier: property.unused
Expand Down Expand Up @@ -552,12 +516,30 @@ parameters:
count: 1
path: tests/Unit/Fixture/ProfileWithBrokenApplyNoType.php

-
message: '#^Property Patchlevel\\EventSourcing\\Tests\\Unit\\Fixture\\ProfileWithBrokenApplyStringType\:\:\$id is unused\.$#'
identifier: property.unused
count: 1
path: tests/Unit/Fixture/ProfileWithBrokenApplyStringType.php

-
message: '#^Property Patchlevel\\EventSourcing\\Tests\\Unit\\Fixture\\ProfileWithBrokenApplyUnionIntersection\:\:\$id is unused\.$#'
identifier: property.unused
count: 1
path: tests/Unit/Fixture/ProfileWithBrokenApplyUnionIntersection.php

-
message: '#^Property Patchlevel\\EventSourcing\\Tests\\Unit\\Fixture\\ProfileWithBrokenId\:\:\$id is never read, only written\.$#'
identifier: property.onlyWritten
count: 1
path: tests/Unit/Fixture/ProfileWithBrokenId.php

-
message: '#^Property Patchlevel\\EventSourcing\\Tests\\Unit\\Fixture\\ProfileWithDuplicateApply\:\:\$id is unused\.$#'
identifier: property.unused
count: 1
path: tests/Unit/Fixture/ProfileWithDuplicateApply.php

-
message: '#^Property Patchlevel\\EventSourcing\\Tests\\Unit\\Fixture\\ProfileWithEmptyApply\:\:\$id is unused\.$#'
identifier: property.unused
Expand All @@ -582,14 +564,20 @@ parameters:
count: 1
path: tests/Unit/Fixture/ProfileWithSuppressAll.php

-
message: '#^Property Patchlevel\\EventSourcing\\Tests\\Unit\\Fixture\\ProfileWithoutAggregateAttribute\:\:\$id is unused\.$#'
identifier: property.unused
count: 1
path: tests/Unit/Fixture/ProfileWithoutAggregateAttribute.php

-
message: '#^Parameter \#2 \$callable of class Patchlevel\\EventSourcing\\Message\\Translator\\ReplaceEventTranslator constructor expects callable\(Patchlevel\\EventSourcing\\Tests\\Unit\\Fixture\\MessagePublished\)\: object, Closure\(Patchlevel\\EventSourcing\\Tests\\Unit\\Fixture\\ProfileCreated\)\: Patchlevel\\EventSourcing\\Tests\\Unit\\Fixture\\ProfileVisited given\.$#'
identifier: argument.type
count: 1
path: tests/Unit/Message/Translator/ReplaceEventTranslatorTest.php

-
message: '#^Method class@anonymous/tests/Unit/Metadata/Subscriber/AttributeSubscriberMetadataFactoryTest\.php\:278\:\:profileVisited\(\) has parameter \$message with no type specified\.$#'
message: '#^Method class@anonymous/tests/Unit/Metadata/Subscriber/AttributeSubscriberMetadataFactoryTest\.php\:284\:\:profileVisited\(\) has parameter \$message with no type specified\.$#'
identifier: missingType.parameter
count: 1
path: tests/Unit/Metadata/Subscriber/AttributeSubscriberMetadataFactoryTest.php
Expand Down
2 changes: 2 additions & 0 deletions src/Console/Command/SubscriptionRemoveCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ final class SubscriptionRemoveCommand extends SubscriptionCommand
{
protected function configure(): void
{
parent::configure();

$this
->addOption('force', 'f', InputOption::VALUE_NONE, 'Set this parameter to execute this action without prompting');
}
Expand Down
4 changes: 3 additions & 1 deletion src/Serializer/AttributeEventTagExtractor.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@
use Stringable;

use function array_keys;
use function array_map;
use function hash;
use function is_int;
use function is_string;
use function strval;

/** @experimental */
final class AttributeEventTagExtractor implements EventTagExtractor
Expand Down Expand Up @@ -63,6 +65,6 @@ public function extract(object $event): array
$tags[$value] = true;
}

return array_keys($tags);
return array_map(strval(...), array_keys($tags));
}
}
24 changes: 24 additions & 0 deletions tests/Unit/Aggregate/InvalidAggregateStreamNameTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

declare(strict_types=1);

namespace Patchlevel\EventSourcing\Tests\Unit\Aggregate;

use Patchlevel\EventSourcing\Aggregate\InvalidAggregateStreamName;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\TestCase;

#[CoversClass(InvalidAggregateStreamName::class)]
final class InvalidAggregateStreamNameTest extends TestCase
{
public function testCreate(): void
{
$exception = new InvalidAggregateStreamName('foo');

self::assertSame(
'Invalid aggregate stream name "foo". Expected format is "[aggregateName]-[aggregateId]".',
$exception->getMessage(),
);
self::assertSame(0, $exception->getCode());
}
}
28 changes: 28 additions & 0 deletions tests/Unit/Attribute/AnswerTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

declare(strict_types=1);

namespace Patchlevel\EventSourcing\Tests\Unit\Attribute;

use Patchlevel\EventSourcing\Attribute\Answer;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\TestCase;
use stdClass;

#[CoversClass(Answer::class)]
final class AnswerTest extends TestCase
{
public function testInstantiate(): void
{
$attribute = new Answer(stdClass::class);

self::assertSame(stdClass::class, $attribute->queryClass);
}

public function testInstantiateWithDefaults(): void
{
$attribute = new Answer();

self::assertNull($attribute->queryClass);
}
}
27 changes: 27 additions & 0 deletions tests/Unit/Attribute/BatchFlushTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

declare(strict_types=1);

namespace Patchlevel\EventSourcing\Tests\Unit\Attribute;

use Patchlevel\EventSourcing\Attribute\BatchFlush;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\TestCase;

#[CoversClass(BatchFlush::class)]
final class BatchFlushTest extends TestCase
{
public function testInstantiate(): void
{
$attribute = new BatchFlush(100);

self::assertSame(100, $attribute->afterMessages);
}

public function testInstantiateWithDefaults(): void
{
$attribute = new BatchFlush();

self::assertNull($attribute->afterMessages);
}
}
28 changes: 28 additions & 0 deletions tests/Unit/Attribute/HandleTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

declare(strict_types=1);

namespace Patchlevel\EventSourcing\Tests\Unit\Attribute;

use Patchlevel\EventSourcing\Attribute\Handle;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\TestCase;
use stdClass;

#[CoversClass(Handle::class)]
final class HandleTest extends TestCase
{
public function testInstantiate(): void
{
$attribute = new Handle(stdClass::class);

self::assertSame(stdClass::class, $attribute->commandClass);
}

public function testInstantiateWithDefaults(): void
{
$attribute = new Handle();

self::assertNull($attribute->commandClass);
}
}
20 changes: 20 additions & 0 deletions tests/Unit/Attribute/InjectTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

declare(strict_types=1);

namespace Patchlevel\EventSourcing\Tests\Unit\Attribute;

use Patchlevel\EventSourcing\Attribute\Inject;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\TestCase;

#[CoversClass(Inject::class)]
final class InjectTest extends TestCase
{
public function testInstantiate(): void
{
$attribute = new Inject('foo');

self::assertSame('foo', $attribute->service);
}
}
32 changes: 32 additions & 0 deletions tests/Unit/Attribute/ProcessorTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

declare(strict_types=1);

namespace Patchlevel\EventSourcing\Tests\Unit\Attribute;

use Patchlevel\EventSourcing\Attribute\Processor;
use Patchlevel\EventSourcing\Subscription\RunMode;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\TestCase;

#[CoversClass(Processor::class)]
final class ProcessorTest extends TestCase
{
public function testInstantiate(): void
{
$attribute = new Processor('foo', 'bar', RunMode::FromBeginning);

self::assertSame('foo', $attribute->id);
self::assertSame('bar', $attribute->group);
self::assertSame(RunMode::FromBeginning, $attribute->runMode);
}

public function testInstantiateWithDefaults(): void
{
$attribute = new Processor('foo');

self::assertSame('foo', $attribute->id);
self::assertSame('processor', $attribute->group);
self::assertSame(RunMode::FromNow, $attribute->runMode);
}
}
32 changes: 32 additions & 0 deletions tests/Unit/Attribute/ProjectorTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

declare(strict_types=1);

namespace Patchlevel\EventSourcing\Tests\Unit\Attribute;

use Patchlevel\EventSourcing\Attribute\Projector;
use Patchlevel\EventSourcing\Subscription\RunMode;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\TestCase;

#[CoversClass(Projector::class)]
final class ProjectorTest extends TestCase
{
public function testInstantiate(): void
{
$attribute = new Projector('foo', 'bar', RunMode::Once);

self::assertSame('foo', $attribute->id);
self::assertSame('bar', $attribute->group);
self::assertSame(RunMode::Once, $attribute->runMode);
}

public function testInstantiateWithDefaults(): void
{
$attribute = new Projector('foo');

self::assertSame('foo', $attribute->id);
self::assertSame('projector', $attribute->group);
self::assertSame(RunMode::FromBeginning, $attribute->runMode);
}
}
Loading
Loading