currentUser = $GLOBALS['current_user']; $this->defaultExportCharset = $this->currentUser->getPreference(self::DEFAULT_EXPORT_CHARSET_PREF_NAME); $this->opportunity = SugarTestOpportunityUtilities::createOpportunity(); } /** * Ensure that exported data starts with BOM * * @group 55520 */ public function testExportStringIncludesBOM() { $this->currentUser->setPreference(self::DEFAULT_EXPORT_CHARSET_PREF_NAME, self::UTF8_CHARSET); $export = export('Opportunities', $this->opportunity->id); $this->assertStringStartsWith(self::BOM, $export); } /** * Ensure that exported data does not start with BOM if the export character set is other than utf-8 * * @group 55520 */ public function testExportStringNotIncludesBOM() { $this->currentUser->setPreference(self::DEFAULT_EXPORT_CHARSET_PREF_NAME, self::NON_UTF8_CHARSET); $export = export('Opportunities', $this->opportunity->id); $this->assertStringStartsNotWith(self::BOM, $export); } protected function tearDown() { $this->currentUser->setPreference(self::DEFAULT_EXPORT_CHARSET_PREF_NAME, $this->defaultExportCharset); SugarTestHelper::tearDown(); SugarTestOpportunityUtilities::removeAllCreatedOpportunities(); } }