Add test for issue 5217 (closes #5217)