Skip to content
This repository has been archived by the owner on Sep 20, 2019. It is now read-only.

Replay events with no-interaction flag #197

Closed
michael-schaefer-eu opened this issue Sep 12, 2019 · 0 comments · Fixed by #198
Closed

Replay events with no-interaction flag #197

michael-schaefer-eu opened this issue Sep 12, 2019 · 0 comments · Fixed by #198

Comments

@michael-schaefer-eu
Copy link
Contributor

What happens

Running the replay command with no-interaction option -n will not replay any Events:

$ php artisan event-projector:replay -n
No events replayed!

What should happen

Since there is no -y or --force option, the above command should replay the Events.

$ php artisan event-projector:replay -n
Replaying 1 events...
 1/1 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%

All done!

Why

Using this command in automated integration tests (i.e. with CI Pipelines) with seeded Events is not possible, since it will fail to replay the Events.

What to change

In /src/Console/ReplayCommand.php line 51

48    public function selectProjectors(array $projectorClassNames): ?Collection
49    {
50        if (count($projectorClassNames ?? []) === 0) {
51            if (! $confirmed = $this->confirm('Are you sure you want to replay events to all projectors?', true)) {
52                return null;
53            }
54
55           return $this->projectionist->getProjectors();
56        }

Set the confirm($question, $default=false) default to true.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant