-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
introduced event sourced aggregates & entities
- Loading branch information
Showing
135 changed files
with
2,204 additions
and
1,886 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: "composer" | ||
directory: "/" | ||
schedule: | ||
interval: "daily" |
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 |
---|---|---|
|
@@ -9,8 +9,13 @@ jobs: | |
uses: actions/checkout@v2 | ||
- name: Docker pull | ||
run: docker-compose pull php | ||
- name: Docker caching | ||
uses: satackey/[email protected] | ||
continue-on-error: true | ||
- name: Start PHP container | ||
run: docker-compose up --detach --build --no-deps php | ||
- name: Run composer validate | ||
run: docker-compose run --rm --no-deps php composer validate --strict --no-interaction --ansi | ||
run: docker-compose exec -T php composer validate --strict --no-interaction --ansi | ||
run-php-cs-fixer: | ||
name: php-cs-fixer | ||
runs-on: ubuntu-latest | ||
|
@@ -19,16 +24,21 @@ jobs: | |
uses: actions/checkout@v2 | ||
- name: Docker pull | ||
run: docker-compose pull php | ||
- name: Docker caching | ||
uses: satackey/[email protected] | ||
continue-on-error: true | ||
- name: Composer caching | ||
uses: actions/cache@v2 | ||
with: | ||
path: ./build/.composer | ||
key: ${{ runner.os }}-composer-v1-${{ hashFiles('composer.json') }} | ||
restore-keys: ${{ runner.os }}-composer-v1- | ||
- name: Start PHP container | ||
run: docker-compose up --detach --build --no-deps php | ||
- name: Install dependencies | ||
run: docker-compose run --rm --no-deps php composer --no-scripts install --no-interaction --ansi | ||
run: docker-compose exec -T php composer --no-scripts install --no-interaction --ansi | ||
- name: Run php-cs-fixer | ||
run: docker-compose run --rm --no-deps php bin/php-cs-fixer fix --diff --dry-run --ansi --config=.php-cs-fixer.dist.php | ||
run: docker-compose exec -T php bin/php-cs-fixer fix --diff --dry-run --ansi --config=.php-cs-fixer.dist.php | ||
run-phpunit: | ||
name: phpunit | ||
runs-on: ubuntu-latest | ||
|
@@ -37,22 +47,32 @@ jobs: | |
uses: actions/checkout@v2 | ||
- name: Docker pull | ||
run: docker-compose pull | ||
- name: Docker caching | ||
uses: satackey/[email protected] | ||
continue-on-error: true | ||
- name: Composer caching | ||
uses: actions/cache@v2 | ||
with: | ||
path: ./build/.composer | ||
key: ${{ runner.os }}-composer-v1-${{ hashFiles('composer.json') }} | ||
restore-keys: ${{ runner.os }}-composer-v1- | ||
- name: Start containers | ||
run: docker-compose up --detach --build | ||
- name: Install dependencies | ||
run: docker-compose run --rm php composer install --no-scripts --no-interaction --ansi | ||
run: docker-compose exec -T php composer install --no-scripts --no-interaction --ansi | ||
- name: Run phpunit | ||
run: docker-compose run --rm php xphp bin/phpunit --color=always --configuration=phpunit.xml.dist | ||
- name: Upload coverage report to codecov.io | ||
uses: codecov/codecov-action@v1 | ||
run: docker-compose exec -T php xphp -dxdebug.mode=coverage bin/phpunit --color=always --configuration=phpunit.xml.dist | ||
- name: Upload coverage report to Codecov.io | ||
uses: codecov/codecov-action@v2 | ||
with: | ||
files: ./build/.phpunit/clover.xml | ||
fail_ci_if_error: true | ||
verbose: true | ||
# - name: Upload coverage report to GitHub.com | ||
# uses: actions/upload-artifact@v2 | ||
# with: | ||
# name: Code Coverage Report | ||
# path: build/.phpunit/code-coverage/* | ||
run-rector: | ||
name: rector | ||
runs-on: ubuntu-latest | ||
|
@@ -61,16 +81,21 @@ jobs: | |
uses: actions/checkout@v2 | ||
- name: Docker pull | ||
run: docker-compose pull php | ||
- name: Docker caching | ||
uses: satackey/[email protected] | ||
continue-on-error: true | ||
- name: Composer caching | ||
uses: actions/cache@v2 | ||
with: | ||
path: ./build/.composer | ||
key: ${{ runner.os }}-composer-v1-${{ hashFiles('composer.json') }} | ||
restore-keys: ${{ runner.os }}-composer-v1- | ||
- name: Start PHP container | ||
run: docker-compose up --detach --build --no-deps php | ||
- name: Install dependencies | ||
run: docker-compose run --rm --no-deps php composer install --no-interaction --ansi | ||
run: docker-compose exec -T php composer install --no-interaction --ansi | ||
- name: Run rector | ||
run: docker-compose run --rm --no-deps php bin/rector --no-progress-bar --dry-run --ansi | ||
run: docker-compose exec -T php bin/rector --no-progress-bar --dry-run --ansi | ||
run-deptrac: | ||
name: deptrac | ||
runs-on: ubuntu-latest | ||
|
@@ -79,13 +104,18 @@ jobs: | |
uses: actions/checkout@v2 | ||
- name: Docker pull | ||
run: docker-compose pull php | ||
- name: Docker caching | ||
uses: satackey/[email protected] | ||
continue-on-error: true | ||
- name: Composer caching | ||
uses: actions/cache@v2 | ||
with: | ||
path: ./build/.composer | ||
key: ${{ runner.os }}-composer-v1-${{ hashFiles('composer.json') }} | ||
restore-keys: ${{ runner.os }}-composer-v1- | ||
- name: Start PHP container | ||
run: docker-compose up --detach --build --no-deps php | ||
- name: Install dependencies | ||
run: docker-compose run --rm --no-deps php composer install --no-scripts --no-interaction --ansi | ||
run: docker-compose exec -T php composer install --no-scripts --no-interaction --ansi | ||
- name: Run deptrac | ||
run: docker-compose run --rm --no-deps php bin/deptrac --no-progress --no-interaction --cache-file=./build/.deptrac/.deptrac.cache --ansi | ||
run: docker-compose exec -T php bin/deptrac --no-progress --no-interaction --cache-file=./build/.deptrac/.deptrac.cache --ansi |
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 |
---|---|---|
@@ -1,9 +1,25 @@ | ||
Streak | ||
------ | ||
![Streak](docs/images/logo.png) | ||
|
||
------------------------------- | ||
|
||
[![CI](https://github.com/streakphp/streak/actions/workflows/ci.yaml/badge.svg)](https://github.com/streakphp/streak/actions/workflows/ci.yaml) | ||
[![codecov](https://codecov.io/gh/streakphp/streak/branch/master/graph/badge.svg)](https://codecov.io/gh/streakphp/streak) | ||
|
||
Running test | ||
------------ | ||
Running checks & tests locally | ||
------------------------------ | ||
|
||
`docker-compose up --detach --build` | ||
|
||
`docker-compose exec -T php composer validate --strict --no-interaction --ansi` | ||
|
||
`docker-compose exec -T php composer install --no-scripts --no-interaction --ansi` | ||
|
||
`docker-compose exec -T php xphp -dxdebug.mode=coverage bin/phpunit --color=always --configuration=phpunit.xml.dist` | ||
|
||
`docker-compose run -T php bin/phpunit` | ||
|
||
`docker-compose exec -T php bin/rector --dry-run --ansi` | ||
|
||
`docker-compose exec -T php bin/deptrac --no-interaction --cache-file=./build/.deptrac/.deptrac.cache --ansi` | ||
|
||
`docker-compose run --rm php bin/phpunit` | ||
`docker-compose exec -T php bin/php-cs-fixer fix --diff --dry-run --ansi --config=.php-cs-fixer.dist.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
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
|
@@ -13,11 +13,11 @@ | |
|
||
namespace Streak\Application\Sensor; | ||
|
||
use Streak\Domain\Event\Producer; | ||
use Streak\Domain; | ||
|
||
/** | ||
* @author Alan Gabriel Bem <[email protected]> | ||
*/ | ||
interface Id extends Producer\Id | ||
interface Id extends Domain\Id | ||
{ | ||
} |
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 |
---|---|---|
|
@@ -14,7 +14,6 @@ | |
namespace Streak\Application\Sensor; | ||
|
||
use Streak\Application\Sensor; | ||
use Streak\Domain; | ||
|
||
/** | ||
* @author Alan Gabriel Bem <[email protected]> | ||
|
@@ -28,21 +27,11 @@ public function __construct(Sensor\Id $id) | |
$this->identifyBy($id); | ||
} | ||
|
||
public function sensorId(): Sensor\Id | ||
public function id(): Sensor\Id | ||
{ | ||
return $this->id; | ||
} | ||
|
||
public function producerId(): Domain\Id | ||
{ | ||
return $this->sensorId(); | ||
} | ||
|
||
public function id(): Domain\Id | ||
{ | ||
return $this->sensorId(); | ||
} | ||
|
||
protected function identifyBy(Sensor\Id $id): void | ||
{ | ||
$this->id = $id; | ||
|
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 |
---|---|---|
|
@@ -13,8 +13,8 @@ | |
|
||
namespace Streak\Application\Sensor; | ||
|
||
use Streak\Application\Sensor; | ||
use Streak\Domain\Event; | ||
use Streak\Domain\Id; | ||
|
||
/** | ||
* @author Alan Gabriel Bem <[email protected]> | ||
|
@@ -27,7 +27,7 @@ trait Processing | |
private $events = []; | ||
private $last; | ||
|
||
abstract public function producerId(): Id; | ||
abstract public function id(): Sensor\Id; | ||
|
||
final public function last(): ?Event\Envelope | ||
{ | ||
|
@@ -140,7 +140,7 @@ final public function process(...$messages): void | |
} | ||
|
||
if (false === $routed) { | ||
throw new \InvalidArgumentException(); | ||
throw new \InvalidArgumentException('No method found to process message.'); | ||
} | ||
} | ||
} catch (\Throwable $e) { | ||
|
@@ -156,6 +156,6 @@ final public function process(...$messages): void | |
|
||
private function addEvent(Event $event): void | ||
{ | ||
$this->pending[] = Event\Envelope::new($event, $this->producerId()); | ||
$this->pending[] = Event\Envelope::new($event, $this->id()); | ||
} | ||
} |
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 |
---|---|---|
|
@@ -19,12 +19,14 @@ | |
|
||
/** | ||
* @author Alan Gabriel Bem <[email protected]> | ||
* | ||
* @see \Streak\Domain\Aggregate\ComparisonTest | ||
*/ | ||
trait Comparison | ||
{ | ||
use Entity\Comparison; | ||
|
||
abstract public function aggregateId(): Aggregate\Id; | ||
abstract public function id(): Aggregate\Id; | ||
|
||
final public function equals(object $aggregate): bool | ||
{ | ||
|
@@ -36,7 +38,7 @@ final public function equals(object $aggregate): bool | |
return false; | ||
} | ||
|
||
if (!$this->aggregateId()->equals($aggregate->aggregateId())) { | ||
if (!$this->id()->equals($aggregate->id())) { | ||
return false; | ||
} | ||
|
||
|
Oops, something went wrong.