$response = $middleware->handle($request, function () {});
You're giving the middleware an empty closure as the $next method. Since it doesnt return anything, the reponse of your tested middleware (return $next($request); ) will also return NULL;
For testing middleware, you can either test the route itself and check the response, or you can test the middleware class itself (without testing to see if the middleware is actually used on a route)
You're now going for the second way.
If you want to only unit test this middleware, you could do something like this:
$request = Request::create(config('app.url') . '500', 'GET');
$middleware = new OnlyAdminIp();
$response = $middleware->handle($request, function () { return true; });
$this->assertEquals($response, true);
If the middleware does not abort, it will return the output of the $next function you're passing.
So by passing it a function that simply returns true, we can check if the middleware aborted or not.
If you also want to check if the middleware is in use on a route, you should simply do a get() request to the actual route and check for exceptions being thrown.
try {
$response = $this->get(config('app.url') . '500');
} catch (HttpException $e) {
$this->assertEquals($e->getStatusCode(), 500);
}