Ported some new tests from 2.12.x branch to ensure compatibility in 3.0.