Bump doctrine to 2.4, add tests for repository factory