#61: Event dispatcher is breaking Pretty formatter#62
#61: Event dispatcher is breaking Pretty formatter#62marcelovani wants to merge 6 commits intoelvetemedve:masterfrom
Conversation
3bf921c to
e48b7c8
Compare
|
I debugged the listeners for service id I am stuck. If I change the id to @elvetemedve Do you have any suggestions to fix this? |
|
Without looking into it deeper, I believe the problem is that you have two instances of the If you give it the same service ID, it will overwrite the other, loosing the default listeners of Behat. So I would remove the 2nd instance from |
|
I am really struggling to find a solution. Ideally we should not have to dispatch an event, because Behat already dispatches |
|
How would Alternatively you could try to pass the screenshot file information via one of the Behat events. Though I don't see any of these classes allowing extra info added. So it needs more investigation. |
|
Your are right, I just copy and pasted without reading the event name. |
|
Description updated with new approach, please review. The nice thing is that it makes Cucumber extension configurable and no longer needs a hard dependency. |
| * Used to statically store the list of files uploaded. | ||
| */ | ||
| private $eventDispatcher; | ||
| private static $imageUrls; |
There was a problem hiding this comment.
Why is it static? This service will be kept in the service container all the time, so this instance will be available during test execution.
There was a problem hiding this comment.
There was a problem hiding this comment.
Me neither, but using static in an OOP language is a code smell.
Maybe you just need to subscribe to a different event and/or switch before/after.
Unfortunately I can't give you a better idea without digging down in the Behat source code.
| $this->config = $config; | ||
| $this->eventDispatcher = $eventDispatcher; | ||
| $this->output = $output; | ||
| $this->config = $config; |
There was a problem hiding this comment.
Indention is 4 spaces on this project.
There was a problem hiding this comment.
Sorry, PHP storm changes that automatically. Fixed manually.
There was a problem hiding this comment.
I should have added an EditorConfig file to the project to avoid such difficulties. :(


##What this PR does