Add CLI option to register subscribers - #2
Conversation
| } | ||
|
|
||
| foreach ($arguments['subscribers'] as $subscriber) { | ||
| // TODO - how to register new subscribers? |
There was a problem hiding this comment.
This will be done via our Events\Facade.
Right now, you could query the Facade for the Dispatcher (Events\Facade::dispatcher()) and call register() to add subscribers.
This is work in progress and the Facade will soon provide a direct API without leaking the Dispatcher.
|
Thanks for the work already. While I'm not yet sure what your goal is, I'm not convinced this is going the right way: A Subscriber is code that needs to be loaded and run. A Subscriber by itself is just a receiver of events. Why would you need a CLI option for that? We need a technical API to have "things" register subscribers but that step is a prerequisite to actually do something with the event and I don't see how this would be a CLI option? |
880566d to
d1c7d35
Compare
29c6d6c to
cb8c558
Compare
41b2928 to
0af80ac
Compare
111ee05 to
03bd5c4
Compare
This is WIP, do not merge.
I was looking into #1 and I would personally like and need a way to add subscribers through CLI options. So I drafted this PR using sebastianbergmann#4136 as a base. While doing this I noticed two different things:
Dispatchersingleton to register new subscribers in any wayTestRunner: it could happen too late for a number of events that are fired beforeSo... How do you want to proceed? What steps can I take?
[EDIT] /cc @sebastianbergmann, this is my initial feedback on this implementation