Fix clashing use of the $i variable in tests.