test: move HasReason so it can be reused
Summary:
Move the class `HasReason` from `miner_tests.cpp` to `setup_common.h` so that it can be reused by other tests.
Partial backport (2/4) of core PR19485:
https://github.com/bitcoin/bitcoin/pull/19845/commits/fe42411b4b07b99c591855f5f00ad45dfeec8e30
Depends on D9186.
Test Plan:
ninja check-bitcoin-miner_tests
Reviewers: #bitcoin_abc, majcosta
Reviewed By: #bitcoin_abc, majcosta
Differential Revision: https://reviews.bitcoinabc.org/D9187