Fixes #7397; Adds 4 supporting unit tests.