-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Updates PHP version, refactor models, add event emission and ot…
…her adjustments.
- Loading branch information
1 parent
9d3f63f
commit 8b65e00
Showing
33 changed files
with
258 additions
and
128 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
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
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,42 @@ | ||
<?php | ||
|
||
namespace CheapDelivery\Application\Domain\Models\Commons; | ||
|
||
use InvalidArgumentException; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
class UuidTest extends TestCase | ||
{ | ||
public function testInvalidUuid(): void | ||
{ | ||
/** @Given a value that is not a valid UUID */ | ||
$value = 'not-a-valid-uuid'; | ||
|
||
/** @Then an exception indicating invalid UUID should be thrown */ | ||
$template = 'Invalid UUID <%s>.'; | ||
$this->expectException(InvalidArgumentException::class); | ||
$this->expectExceptionMessage(sprintf($template, $value)); | ||
|
||
/** @When I try to construct a UUID with this value */ | ||
new Uuid(value: $value); | ||
} | ||
|
||
/** | ||
* @param string $value | ||
* @return void | ||
* @dataProvider uuidProvider | ||
*/ | ||
public function testIsUuidValid(string $value): void | ||
{ | ||
self::assertTrue(Uuid::isUuid(value: $value)); | ||
} | ||
|
||
public static function uuidProvider(): array | ||
{ | ||
return [ | ||
[Uuid::generateV4()->toString()], | ||
['550e8400-e29b-41d4-a716-446655440000'], | ||
['00000000-1111-2222-3333-444444444444'] | ||
]; | ||
} | ||
} |
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
24 changes: 24 additions & 0 deletions
24
tests/Unit/Driven/Dispatch/OutboxEvent/EventRecordFactoryTest.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,24 @@ | ||
<?php | ||
|
||
namespace CheapDelivery\Driven\Dispatch\OutboxEvent; | ||
|
||
use CheapDelivery\Driven\Dispatch\OutboxEvent\Mocks\RejectedDispatch; | ||
use LogicException; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
class EventRecordFactoryTest extends TestCase | ||
{ | ||
public function testExceptionWhenUnsupportedEventType(): void | ||
{ | ||
/** @Given I have an unmapped event */ | ||
$event = new RejectedDispatch(); | ||
|
||
/** @Then an exception indicating unsupported event type should be thrown */ | ||
$template = 'Event <%s> is not supported. Unable to create an EventRecord.'; | ||
$this->expectException(LogicException::class); | ||
$this->expectExceptionMessage(sprintf($template, $event::class)); | ||
|
||
/** @When I try to build an event record with this event */ | ||
EventRecordFactory::from(event: $event); | ||
} | ||
} |
Oops, something went wrong.