TraceableMiddleware example

static $stopSeries = [
                    '"Symfony\Component\Messenger\Middleware\MiddlewareInterface@anonymous" on "command_bus"',
                    'Tail on "command_bus"',
                ];

                $this->assertSame(array_shift($stopSeries)$name);

                return $this->createMock(StopwatchEvent::class);
            })
        ;

        $traced = new TraceableMiddleware($stopwatch$busId);

        $traced->handle($envelopenew StackMiddleware(new \ArrayIterator([null, $middleware])));
        $this->assertSame(1, $middleware->calls);
    }

    public function testHandleWithException()
    {
        $this->expectException(\RuntimeException::class);
        $this->expectExceptionMessage('Thrown from next middleware.');
        $busId = 'command_bus';

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