5xx response cache test.

PHPUnit test ensuring that 5xx responses are served from a stale cache
if available. A bit of test refactoring to let the 4xx and 5xx tests use
the same loop.