Unit test for foreign id

this reproduces bug #37 in a simple test