From 3c14d09eddce83766db93e46b5b28043a849d3cb Mon Sep 17 00:00:00 2001 From: Daniel Badura Date: Thu, 8 Feb 2024 11:55:36 +0100 Subject: [PATCH] SA fixes --- src/EventBus/Message.php | 1 - src/Store/DoctrineHelper.php | 1 - tests/Unit/Aggregate/AggregateRootTest.php | 11 ++++++----- .../Middleware/ExcludeArchivedEventMiddlewareTest.php | 1 + 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/EventBus/Message.php b/src/EventBus/Message.php index e9899d68a..14e640162 100644 --- a/src/EventBus/Message.php +++ b/src/EventBus/Message.php @@ -20,7 +20,6 @@ * archived?: bool, * ... * } - * * @phpstan-type Headers = array{ * aggregateName?: string, * aggregateId?: string, diff --git a/src/Store/DoctrineHelper.php b/src/Store/DoctrineHelper.php index 42f682851..8c18ddef2 100644 --- a/src/Store/DoctrineHelper.php +++ b/src/Store/DoctrineHelper.php @@ -9,7 +9,6 @@ use Doctrine\DBAL\Types\Type; use Doctrine\DBAL\Types\Types; -use function dd; use function is_array; use function is_bool; use function is_int; diff --git a/tests/Unit/Aggregate/AggregateRootTest.php b/tests/Unit/Aggregate/AggregateRootTest.php index 9c3911d82..62f78db70 100644 --- a/tests/Unit/Aggregate/AggregateRootTest.php +++ b/tests/Unit/Aggregate/AggregateRootTest.php @@ -196,18 +196,19 @@ public function testInvalidAggregateId(): void public function testUpdateMetadataFactory(): void { $newFactory = new class implements AggregateRootMetadataFactory { - public int $calledTimes = 0; + public bool $called = false; + public function metadata(string $aggregate): AggregateRootMetadata { - $this->calledTimes++; + $this->called = true; - return new AggregateRootMetadata($aggregate, 'name', 'id' , [], [], false, null); + return new AggregateRootMetadata($aggregate, 'name', 'id', [], [], false, null); } }; Profile::setMetadataFactory($newFactory); - self::assertSame(0, $newFactory->calledTimes); + self::assertFalse($newFactory->called); Profile::getMetadata(); - self::assertSame(1, $newFactory->calledTimes); + self::assertTrue($newFactory->called); } } diff --git a/tests/Unit/Pipeline/Middleware/ExcludeArchivedEventMiddlewareTest.php b/tests/Unit/Pipeline/Middleware/ExcludeArchivedEventMiddlewareTest.php index fda1a35f0..5c3d82928 100644 --- a/tests/Unit/Pipeline/Middleware/ExcludeArchivedEventMiddlewareTest.php +++ b/tests/Unit/Pipeline/Middleware/ExcludeArchivedEventMiddlewareTest.php @@ -45,6 +45,7 @@ public function testIncludeEvent(): void self::assertSame([$message], $result); } + public function testHeaderNotSet(): void { $middleware = new ExcludeArchivedEventMiddleware();