Fix foreign key error reported by the findById DAO test.
authorAnthony Nemirovsky <anemirovsky@giantrabbit.com>
Thu, 4 Dec 2014 21:36:25 +0000 (13:36 -0800)
committerAnthony Nemirovsky <anemirovsky@giantrabbit.com>
Thu, 4 Dec 2014 21:45:23 +0000 (13:45 -0800)
commit5767aa07ef2b358c2570c6cdf1cdea2f34191308
treef833d630d18ad8d327d16b7c88e44e95e57bcee5
parent95ca1e4e775ce88e3f371abe8390a3526ba537e7
Fix foreign key error reported by the findById DAO test.

The root cause of the error was a problem with the CiviUnitTestCase
setUpBeforeClass and tearDown methods. The setUpBeforeClass method imports an
sql file that creates two domains and two contacts to associate with those
domains. The tearDown was set to truncate the civicrm_contact table and this
would happen after every test function run. So, if a test function that was
not the first test function in the class created a contact that it then
wanted to delete, the foreign key error would be thrown. Rather than doing
a workaround, I decided to fix the underlying issue and add back the two
domain contacts after the db tables are truncated.

This broke some tests that were depending on using contact ID 1 for the
contact record that was created, so I went ahead and fixed those, too.
tests/phpunit/CRM/Member/Form/MembershipTest.php
tests/phpunit/CiviTest/CiviUnitTestCase.php
tests/phpunit/api/v3/MailingContactTest.php
tests/phpunit/api/v3/dataset/mailing_bounced.xml
tests/phpunit/api/v3/dataset/mailing_delivered.xml