test different versions of doctrine

The build matrix system enables us to test with the versions we would
like to support.
conditionnaly mock methods

These methods / classes do not exist on all versions of doctrine.
This change makes the test suite green again for 2.2 and 2.3, while
keeping the exact same tests for 2.4.