[PHP-647] Test that queries are not sent to recovering secondaries

Helper functions were ported from the Python driver's ha_tools.py module.