-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #559 from patchlevel/add-dbal-tests
Add more DoctrineDbalStore tests
- Loading branch information
Showing
14 changed files
with
978 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Patchlevel\EventSourcing\Tests\Unit\Fixture\Header; | ||
|
||
use Patchlevel\EventSourcing\Attribute\Header; | ||
|
||
/** @psalm-immutable */ | ||
#[Header('baz')] | ||
final class BazHeader | ||
{ | ||
public function __construct( | ||
public readonly string $data, | ||
) { | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Patchlevel\EventSourcing\Tests\Unit\Fixture\Header; | ||
|
||
use Patchlevel\EventSourcing\Attribute\Header; | ||
|
||
/** @psalm-immutable */ | ||
#[Header('foo')] | ||
final class FooHeader | ||
{ | ||
public function __construct( | ||
public readonly string $data, | ||
) { | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Patchlevel\EventSourcing\Tests\Unit\Fixture; | ||
|
||
use Patchlevel\EventSourcing\Attribute\Event; | ||
use Patchlevel\EventSourcing\Serializer\Normalizer\IdNormalizer; | ||
|
||
#[Event('profile_email_changed')] | ||
final class ProfileEmailChanged | ||
{ | ||
public function __construct( | ||
#[IdNormalizer] | ||
public ProfileId $profileId, | ||
#[EmailNormalizer] | ||
public Email $email, | ||
) { | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -161,4 +161,29 @@ public function testClose(): void | |
$stream->close(); | ||
$stream->index(); | ||
} | ||
|
||
public function testPositionEmpty(): void | ||
{ | ||
$stream = new ArrayStream([]); | ||
$position = $stream->position(); | ||
|
||
self::assertNull($position); | ||
} | ||
|
||
public function testPosition(): void | ||
{ | ||
$message = Message::create( | ||
new ProfileCreated( | ||
ProfileId::fromString('foo'), | ||
Email::fromString('[email protected]'), | ||
), | ||
); | ||
|
||
$messages = [$message]; | ||
|
||
$stream = new ArrayStream($messages); | ||
$position = $stream->position(); | ||
|
||
self::assertSame(0, $position); | ||
} | ||
} |
Oops, something went wrong.