ActivationMiddleware example


    public function testExecuteMiddlewareOnActivated()
    {
        $message = new DummyMessage('Hello');
        $envelope = new Envelope($message);

        $stack = $this->getStackMock(false);

        $middleware = $this->createMock(MiddlewareInterface::class);
        $middleware->expects($this->once())->method('handle')->with($envelope$stack)->willReturn($envelope);

        $decorator = new ActivationMiddleware($middleware, true);

        $decorator->handle($envelope$stack);
    }

    public function testExecuteMiddlewareOnActivatedWithCallable()
    {
        $message = new DummyMessage('Hello');
        $envelope = new Envelope($message);

        $activated = $this->createPartialMock(ActivationMiddlewareTestCallable::class['__invoke']);
        $activated->expects($this->once())->method('__invoke')->with($envelope)->willReturn(true);

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