veda-consulting-company / uk.co.vedaconsulting.mailchimp

Other
22 stars 43 forks source link

Don't fail on inability to delete test groups #249

Closed xurizaemon closed 7 years ago

xurizaemon commented 7 years ago

I was running into this when running tests -

phpunit --group SmartGroup -vvv --debug sites/default/files/civicrm/ext/uk.co.vedaconsulting.mailchimp/tests/integration/MailchimpApiIntegrationTest.php
PHPUnit 4.3.5 by Sebastian Bergmann.
Starting test 'MailchimpApiIntegrationTest::testSmartGroupSync'.
.
CiviCRM_API3_Exception: Could not delete group 277 in civicrm_api3() (line 45 of ~Sites/civicrm.dev/sites/all/modules/civicrm/api/api.php).

The corresponding group was definitely being created during the tests, but was not present to be deleted when tearDownCiviCrmFixtures was called. Adding code to get the group first before deletion should avoid this exception being triggered.

If I had to guess, I'd speculate that perhaps the group is being removed earlier in 4.7 as part of some earlier contact cleanup - for example, if the group was "owned" by one of the test contacts, and a delete for the group is triggered on contact delete.

deepak-srivastava commented 7 years ago

Thanks. Closing. Think there is similar error in mock test, but integration seems to pass now.