Skip to content

Commit

Permalink
Merge branch '5.0' into 5.1
Browse files Browse the repository at this point in the history
* 5.0:
  Parse and render anonymous classes correctly on php 8
  Enable APCu for the php 8 build.
  [Process] Fix failing test on php 8.
  [HttpKernel] fix test
  Make PHP 8 green on Travis
  Revert "[Cache] allow DBAL v3"
  [PropertyAccessor] Added missing property path on php 8.
  Don't execute tests with DBAL 2.x on php 8.
  • Loading branch information
nicolas-grekas committed May 24, 2020
2 parents d8ce5b1 + 7db34c5 commit 4e66884
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions Tests/Middleware/TraceableMiddlewareTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,16 @@ public function testHandle()
$busId = 'command_bus';
$envelope = new Envelope(new DummyMessage('Hello'));

$middleware = $this->getMockBuilder(MiddlewareInterface::class)->getMock();
$middleware->expects($this->once())
->method('handle')
->with($envelope, $this->anything())
->willReturnCallback(function ($envelope, StackInterface $stack) {
$middleware = new class() implements MiddlewareInterface {
public $calls = 0;

public function handle(Envelope $envelope, StackInterface $stack): Envelope
{
++$this->calls;

return $stack->next()->handle($envelope, $stack);
})
;
}
};

$stopwatch = $this->createMock(Stopwatch::class);
$stopwatch->expects($this->once())->method('isStarted')->willReturn(true);
Expand All @@ -51,14 +53,15 @@ public function testHandle()
$stopwatch->expects($this->exactly(2))
->method('stop')
->withConsecutive(
[$this->matches('"%sMiddlewareInterface%s" on "command_bus"')],
['"Symfony\Component\Messenger\Middleware\MiddlewareInterface@anonymous" on "command_bus"'],
['Tail on "command_bus"']
)
;

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

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

public function testHandleWithException()
Expand Down

0 comments on commit 4e66884

Please sign in to comment.