Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] Add FakeEventDispatcher inspired by Laravel #524

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

simonschaufi
Copy link
Contributor

@simonschaufi simonschaufi commented Dec 1, 2023

See https://laravel.com/docs/10.x/events#testing for inspiration source and https://github.com/laravel/framework/blob/10.x/src/Illuminate/Support/Testing/Fakes/EventFake.php for the original source code.

How to use:

use TYPO3\CMS\Core\EventDispatcher\ListenerProvider;

$fakeEventDispatcher = new FakeEventDispatcher(new ListenerProvider($this->getContainer()));

// $this->subject is an Extbase Controller
$this->subject->injectEventDispatcher($fakeEventDispatcher);

// run code which should dispatch an event (dispatch controller)

$fakeEventDispatcher->assertDispatched(MyEvent::class);

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

Successfully merging this pull request may close these issues.

None yet

1 participant