This PR targets having an example of continuous integration with Ecotone and Symfony (Still looking for a professional smooth workflow :) ). So it ships:
- One cli command per domain command
Integration tests
for each
Github workflow
to run it "as a developer would"
I post it here in a wip state because I'm stuck: When I run my tests, events are correctly triggered but not async projections.
This is not due to Phpunit itself but only to the APP_ENV
as this issue occurs when I run a command on an event sourced aggregate only: https://github.com/jclaveau/php-ddd-cqrs-event-sourcing-symfony-ecotone/blob/testing_commands/src/UI/Cli/Ticket/PrepareTicketCliCommand.php
APP_ENV=test console app:prepare-ticket lala lolo
Event sourced Ticket prepare command generates a stream but, contrary to dev env, no asynchronous projection is added to the projections table (It's created but remains empty):
ecotone=# SELECT * FROM projections;
no | name | position | state | status | locked_until
----+-----------------------+------------------------------------+-------+--------+--------------
1 | last_prepared_tickets | {"App\\Domain\\Ticket\\Ticket": 1} | [] | idle |
2 | unassigned_tickets | {"App\\Domain\\Ticket\\Ticket": 1} | [] | idle |
(2 rows)
ecotone=# \c ecotone_test
You are now connected to database "ecotone_test" as user "ecotone".
ecotone_test=# SELECT * FROM projections;
no | name | position | state | status | locked_until
----+------+----------+-------+--------+--------------
(0 rows)
I wondered if it was due to the fact there is no container running projections in test env but when I try
APP_ENV=test /data/app/bin/console ecotone:es:reset-projection last_prepared_tickets
I get
In ProjectionNotFound.php line 20:
A projection with name "last_prepared_tickets" could not be found.
Digging in the docs I tried some options without success: https://github.com/jclaveau/php-ddd-cqrs-event-sourcing-symfony-ecotone/blob/testing_commands/src/Infrastructure/EcotoneConfiguration.php
I'm not enough aware of Ecotone to know if this is a usage issue or a bug so let me know if a should open a bug on Ecotone's repo.
Thanks in advance!