Fix obscure dedupe scenario where 'bad' location data can overwrite good data
authoreileen <emcnaughton@wikimedia.org>
Wed, 29 Jul 2020 12:20:43 +0000 (00:20 +1200)
committereileen <emcnaughton@wikimedia.org>
Sun, 2 Aug 2020 06:38:03 +0000 (18:38 +1200)
commitffcc831f04c0a3e5c4bd83a1024c57e3f58b0b83
tree565ac20c523b546b0833c4756b3178a73a083aaa
parenteae974dd25fb9a50729ee41cf909bf8b03066141
Fix obscure dedupe scenario where 'bad' location data can overwrite good data

Our api permits the creation of addresses with no actual address-related data. I'm not sure this is a good
thing but one way or another some addresses got into our database with no useful information and I'm not convinced we
are alone.

When merging it's possible for a null address record to be treated as 'not a conflict' with an address record
with the same location but actual data, and for the null record to be retained. This fixes it such that in that
scenario the retained record is the one with data.

This is pretty obscure and an argument could be made for not fixing it. On the other hand this extends tests on the code
(in addition to the fairly extensive set in testBatchMergesAddresses) and I also did a few tangental cleanups
CRM/Dedupe/Merger.php
tests/phpunit/api/v3/ContactTest.php