-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8d167b9
commit 014310c
Showing
8 changed files
with
132 additions
and
94 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Phauthentic\EventSourcing\Test\Aggregate; | ||
|
||
use Phauthentic\EventSourcing\Aggregate\AbstractEventSourcedAggregate; | ||
use Phauthentic\EventSourcing\Aggregate\Attribute\DomainEvents; | ||
|
||
/** | ||
* | ||
*/ | ||
class ConcreteAggregate extends AbstractEventSourcedAggregate | ||
{ | ||
#[DomainEvents] | ||
protected array $aggregateEvents = []; | ||
|
||
public string $testProperty = ''; | ||
|
||
public function __construct() | ||
{ | ||
$this->aggregateId = 'test-id'; | ||
} | ||
|
||
protected function whenTestEvent(TestEvent $event): void | ||
{ | ||
$this->testProperty = $event->getText(); | ||
} | ||
|
||
public function whenIdentityProvidingTestEvent(IdentityProvidingTestEvent $event) | ||
{ | ||
$this->testProperty = $event->getText(); | ||
} | ||
|
||
public function doSomething(string $data): void | ||
{ | ||
$this->recordThat(new TestEvent($data)); | ||
} | ||
|
||
public function getAggregateEvents(): array | ||
{ | ||
return $this->aggregateEvents; | ||
} | ||
|
||
public function getAggregateVersion(): int | ||
{ | ||
return $this->aggregateVersion; | ||
} | ||
} |
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,20 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Phauthentic\EventSourcing\Test\Aggregate\DomainEvent; | ||
|
||
use Phauthentic\EventSourcing\DomainEvent\AbstractDomainEvent; | ||
|
||
/** | ||
* A concrete implementation of AbstractDomainEvent for testing | ||
*/ | ||
class ConcreteDomainEvent extends AbstractDomainEvent | ||
{ | ||
public function __construct(string $aggregateId, int $aggregateVersion, string $domainEventType) | ||
{ | ||
$this->aggregateId = $aggregateId; | ||
$this->aggregateVersion = $aggregateVersion; | ||
$this->domainEventType = $domainEventType; | ||
} | ||
} |
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,27 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Phauthentic\EventSourcing\Test\Aggregate; | ||
|
||
use Phauthentic\EventSourcing\DomainEvent\AggregateIdentityProvidingEventInterface; | ||
|
||
/** | ||
* | ||
*/ | ||
class IdentityProvidingTestEvent extends TestEvent implements AggregateIdentityProvidingEventInterface | ||
{ | ||
public string $aggregateId = ''; | ||
|
||
public int $aggregateVersion = 1; | ||
|
||
public function getAggregateId(): string | ||
{ | ||
return $this->aggregateId; | ||
} | ||
|
||
public function getAggregateVersion(): int | ||
{ | ||
return $this->aggregateVersion; | ||
} | ||
} |
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 Phauthentic\EventSourcing\Test\Aggregate; | ||
|
||
/** | ||
* | ||
*/ | ||
class TestEvent | ||
{ | ||
public function __construct(private readonly string $text = '') | ||
{ | ||
} | ||
|
||
public function getText() | ||
{ | ||
return $this->text; | ||
} | ||
} |
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,9 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Phauthentic\EventSourcing\Test\Aggregate; | ||
|
||
class TestEvent2 extends TestEvent | ||
{ | ||
} |