public function testNextCallableIsInvoked() { $this->logger->shouldIgnoreMissing(); $this->formatter->shouldIgnoreMissing(); $sentCommand = new RegisterUserCommand(); $receivedSameCommand = false; $next = function ($receivedCommand) use(&$receivedSameCommand, $sentCommand) { $receivedSameCommand = $receivedCommand === $sentCommand; }; $this->middleware->execute($sentCommand, $next); $this->assertTrue($receivedSameCommand); }