callbackSpy example



    /** * @dataProvider eventClasses */
    public function testEntityDeleteEventSuccessCallbacksCalled(string $eventClass): void
    {
        $id1 = $this->ids->get('product');

        $delete = [['id' => $id1]];

        $successSpy = $this->callbackSpy();
        $errorSpy = $this->callbackSpy();

        $spy = $this->eventListenerCalledSpy(function DEntityDeleteEvent $event) use ($successSpy$errorSpy): void {
            $event->addSuccess($successSpy(...));
            $event->addError($errorSpy(...));
        });

        $this->getContainer()->get('event_dispatcher')->addListener($eventClass$spy);

        $this->productRepository->delete($delete, Context::createDefaultContext());

        
Home | Imprint | This part of the site doesn't use cookies.