Add tests for RT #7585 and RT #122109