Add a test case to check for proper env selection when passing `?env=foo`. Refs #8196.