An example of using EventSourcing pattern in a real project. Implementation of this pattern may contains some flaws.
This is an example of the online shop.
- User registers himself in the shop
- Email is send to to the user's email
- User accepts the invitation
- User's account is activated
- User logs in
- User finds a product 'Milk'
- User adds 2 pieces of milk to the basket
- User finds a product 'Bread'
- User adds 1 piece of bread to the basket
- User finds a product 'Butter'
- User adds 3 pieces of butter to the basket
- User changes the quantity of the butter for 1
- User removes bread from the basket
- User logs out
- User logs in
- User tries to find a non-existent product called 'Cookies'
- User creates the Order
- Basket is closed
- Send email with the order
- Command can cause the series of command executes. E.g. CloseOrderCommand calls CloseBasketCommand and SendEmailCommand.
- We want to know what products users searched for and found none.
- DI Container
- DBAL
- DDD
To run unit tests run command:
php vendor/phpunit/phpunit/phpunit --configuration tests/unit-tests/configuration.xml
To run behat tests execute command:
vendor/bin/behat --config tests/behat/behat.yml
To run integration tests run command:
php vendor/phpunit/phpunit/phpunit --configuration tests/integration-tests/configuration.xml
Run command in console:
php -S localhost:8000
Open the browser and type:
http://localhost:8000/example.php