/** * Tests the mapping of CiviCRM group memberships to an array of Mailchimp * interest Ids => Bool. * * @depends testGetMCInterestGroupings * @group interests */ public function testGetComparableInterestsFromMailchimp() { $sync = new CRM_Mailchimp_Sync(static::$test_list_id); $cases = [[(object) ['interestId1' => TRUE, 'interestId2' => TRUE], ['interestId1' => TRUE, 'interestId2' => TRUE]], [(object) ['interestId1' => FALSE, 'interestId2' => TRUE], ['interestId1' => FALSE, 'interestId2' => TRUE]], [(object) ['interestId1' => TRUE], ['interestId1' => TRUE, 'interestId2' => FALSE]], [(object) ['interestId1' => TRUE, 'foo' => TRUE], ['interestId1' => TRUE, 'interestId2' => FALSE]]]; foreach ($cases as $i => $_) { list($input, $expected) = $_; $ints = $sync->getComparableInterestsFromMailchimp($input, 'push'); $this->assertEquals($expected, $ints, "mapping failed for test '{$i}'"); } // We didn't change the fixture. static::$fixture_should_be_reset = FALSE; }