FIX: Enable $forceWrite argument of DataObject#write()

$forceWrite was being ignored because it was tested in a part of the
code that is reachable if and only if there are changes to the object.
This patch adds an additional test to correct that logic error.

Also, refrain from needlessly checking for changes when $forceWrite is
true.

Fixes #1687