Added test case to demonstrate issue #2316

Sorry it took me a while to get back to this. This test fails for me with
```TypeError: Cannot call method 'replace' of undefined```
`this.User.hasMany(this.User, { as: 'users', through: 'projectUsers'});` should be `this.User.hasMany(this.Project, { as: 'users', through: 'projectUsers'});`

It still fails after that change though, funny enough it works if you do Project.hasMany, User.hasMany, Project.hasMany, User.hasMany in that order.