Add testQueryBeforeAfterUpdateForSubobjectToLooseReference

Test is in response to https://github.com/SemanticMediaWiki/SemanticMediaWiki/pull/378#discussion_r14574081
That looks bad with the multiple return arguments. It might indeed not be easy, or not be possible, to split this up nicely. I can't tell without trying to do so. If you gave it a try and concluded this is the most pragmatic solution, then I'm fine with that.