-
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
NamedEvents names should be unique (#158)
- Loading branch information
1 parent
32e8816
commit fe48575
Showing
5 changed files
with
63 additions
and
0 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
File renamed without changes.
12 changes: 12 additions & 0 deletions
12
packages/PdoEventSourcing/tests/Fixture/UniqueEventNames/EventWithDuplicatedName.php
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,12 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Test\Ecotone\EventSourcing\Fixture\UniqueEventNames; | ||
|
||
use Ecotone\Modelling\Attribute\NamedEvent; | ||
|
||
#[NamedEvent('event')] | ||
final class EventWithDuplicatedName | ||
{ | ||
} |
12 changes: 12 additions & 0 deletions
12
packages/PdoEventSourcing/tests/Fixture/UniqueEventNames/EventWithUniqueName.php
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,12 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Test\Ecotone\EventSourcing\Fixture\UniqueEventNames; | ||
|
||
use Ecotone\Modelling\Attribute\NamedEvent; | ||
|
||
#[NamedEvent('event')] | ||
final class EventWithUniqueName | ||
{ | ||
} |
35 changes: 35 additions & 0 deletions
35
packages/PdoEventSourcing/tests/Integration/UniqueNamedEventsTest.php
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,35 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Test\Ecotone\EventSourcing\Integration; | ||
|
||
use Ecotone\Lite\EcotoneLite; | ||
use Ecotone\Lite\Test\Configuration\InMemoryRepositoryBuilder; | ||
use Ecotone\Messaging\Config\ModulePackageList; | ||
use Ecotone\Messaging\Config\ServiceConfiguration; | ||
use PHPUnit\Framework\TestCase; | ||
use Test\Ecotone\EventSourcing\Fixture\Ticket\Ticket; | ||
|
||
final class UniqueNamedEventsTest extends TestCase | ||
{ | ||
public function test_event_names_should_be_unique(): void | ||
{ | ||
$this->expectExceptionObject(new \RuntimeException('Named Events should have unique names. However, `event` is used more than once.')); | ||
|
||
EcotoneLite::bootstrapForTesting( | ||
[Ticket::class], | ||
configuration: ServiceConfiguration::createWithDefaults() | ||
->withSkippedModulePackageNames(ModulePackageList::allPackagesExcept([ModulePackageList::EVENT_SOURCING_PACKAGE])) | ||
->withExtensionObjects([ | ||
InMemoryRepositoryBuilder::createForAllEventSourcedAggregates(), | ||
]) | ||
->withNamespaces([ | ||
'Test\Ecotone\EventSourcing\Fixture\UniqueEventNames', | ||
]), | ||
pathToRootCatalog: __DIR__ . '/../../', | ||
) | ||
->getFlowTestSupport() | ||
; | ||
} | ||
} |