Accounts = SugarTestAccountUtilities::createAccount(); $this->Contacts = SugarTestContactUtilities::createContact(); $this->Leads = SugarTestLeadUtilities::createLead(); } public function tearDown() { SugarTestHelper::tearDown(); SugarTestAccountUtilities::removeAllCreatedAccounts(); SugarTestContactUtilities::removeAllCreatedContacts(); SugarTestLeadUtilities::removeAllCreatedLeads(); } /** * Check if non-primary mails are being exported properly * as semi-colon separated values * * @dataProvider providerEmailExport */ public function testEmailExport($module, $mails) { // Add non-primary mails foreach ($mails as $mail) { $this->$module->emailAddress->addAddress($mail); } $this->$module->emailAddress->save($this->$module->id, $this->$module->module_dir); // Export the record $content = export($module, $this->$module->id, false, false); // Because we can't guess the order of the exported non-primary emails, check for separator if there are 2 or more if (count($mails) > 1) { $this->assertContains(";", $content, "Non-primary mail not exported properly."); } // Check if the mails got exported properly foreach ($mails as $mail) { $this->assertContains($mail, $content, "Non-primary mail not exported properly: $mail."); } } /** * Module to be exported * Mails to be added as non-primary */ public function providerEmailExport() { return array( array("Accounts", array("test1@mailmail.mail", "test2@mailmail.mail")), array("Leads", array("test3@mailmail.mail", "test4@mailmail.mail")), array("Contacts", array("test5@mailmail.mail")), ); } }