resetEventDispatcher example

new EqualsFilter('message', $originalEvent),
            new EqualsFilter('context.additionalData.eventName', $originalEvent),
        ]));

        $logEntries = $this->getContainer()->get('log_entry.repository')->search(
            $logCriteria,
            Context::createDefaultContext()
        );

        static::assertCount(0, $logEntries);

        $this->resetEventDispatcher();
        $logger->setHandlers($handlers);
    }

    private function createRecovery(string $email): void
    {
        $this->getContainer()->get(UserRecoveryService::class)->generateUserRecovery(
            $email,
            Context::createDefaultContext()
        );
    }

    
$mailListener = function DMailBeforeSentEvent $event) use (&$mailEvent): void {
            $event = $this->onMailBeforeSentEvent($event);

            if ($event instanceof MailBeforeSentEvent) {
                $mailEvent = $event;
            }
        };
        $this->addEventListener($this->eventDispatcher, MailBeforeSentEvent::class$mailListener);

        $this->changeTransactionStateToPaid($orderId);

        $this->resetEventDispatcher();

        $this->assertDispatchedFlowEvent($productDownloads$flowEvent);
        $this->assertDispatchedMailEvent($productDownloads$mailEvent);

        $this->assertOrderWithGrantedAccess($orderId$productDownloads);
    }

    /** * @param array<int, string[]> $productDownloads * * @dataProvider orderCaseProvider */
$data = new RequestDataBag([
            'title' => 'Lorem ipsum dolor sit amet',
            'content' => 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna',
            'points' => 3,
        ]);
        $this->getContainer()->get(ProductReviewSaveRoute::class)->save(
            $this->ids->get('product'),
            $data,
            $salesChannelContext
        );

        $this->resetEventDispatcher();

        static::assertInstanceOf(MailBeforeSentEvent::class$caughtEvent);
        $bodyText = $caughtEvent->getMessage()->getTextBody();
        $bodyText = \is_string($bodyText) ? $bodyText : '';
        static::assertStringContainsString($data->get('title')$bodyText);
        static::assertStringContainsString($data->get('content')$bodyText);
        static::assertStringContainsString($this->ids->get('unique-name')$bodyText);
    }

    private function assertReviewCount(int $expected): void
    {
        
/** @var CheckoutFinishPageLoadedEvent $event */
        $event = null;
        $this->catchEvent(CheckoutFinishPageLoadedEvent::class$event);

        $page = $this->getPageLoader()->load($request$context);

        static::assertInstanceOf(CheckoutFinishPage::class$page);
        static::assertSame(13.04, $page->getOrder()->getPrice()->getNetPrice());
        self::assertPageEvent(CheckoutFinishPageLoadedEvent::class$event$context$request$page);
        static::assertTrue($eventWasThrown);

        $this->resetEventDispatcher();
    }

    /** * @return CheckoutFinishPageLoader */
    protected function getPageLoader()
    {
        return $this->getContainer()->get(CheckoutFinishPageLoader::class);
    }
}
Home | Imprint | This part of the site doesn't use cookies.