A test double for the clock, and one for randomness

Two things make a test unrepeatable, and both are usually called directly from the code under test: the current time and a random number. Neither can be asserted against while the code owns them.

interface Clock { /** @return DateTimeImmutable */ public function now(); }
interface Randomness { /** @return int */ public function between($min, $max); }

// in the test
$clock = new FrozenClock(new DateTimeImmutable('2016-06-30 23:59:59'));
$this->assertTrue((new Voucher($clock))->isValid());

Month-end, leap day, the hour a clock goes back — all become ordinary test cases rather than something to wait for. The rule that makes it work is that nothing below the entry point may call time() or rand() directly, and one stray call reintroduces the problem in the path least likely to be tested. A linter rule banning the functions outside the two adapters is worth the noise.