Added a new test case to reproduce an issue while replacing a pkg multiple times.

The test case currently fails; will be fixed shortly in an upcoming commit.