0
0
mirror of https://github.com/salesagility/SuiteCRM.git synced 2024-12-23 04:48:03 +00:00
salesagility_SuiteCRM/tests/unit/phpunit/includes/Localization/LocalizationTest.php
Dillon-Brown 26aab7535d Move test namespaces into autoload-dev
Signed-off-by: Dillon-Brown <dillon.brown@salesagility.com>
2021-09-08 16:49:16 +01:00

26 lines
868 B
PHP

<?php
use SuiteCRM\Test\SuitePHPUnitFrameworkTestCase;
require_once __DIR__ . '/../../../../../include/Localization/Localization.php';
/**
* Class LocalizationTest
*/
class LocalizationTest extends SuitePHPUnitFrameworkTestCase
{
public function testaddBOM(): void
{
$local = new Localization();
$utf8 = 'foo';
self::assertEquals("\xef\xbb\xbf" . 'foo', $local->addBOM($utf8, 'UTF-8'));
$utf16le = $local->translateCharset($utf8, 'UTF-8', 'UTF-16LE');
self::assertEquals("\xFF\xFE" . $utf16le, $local->addBOM($utf16le, 'UTF-16LE'));
$utf16be = $local->translateCharset($utf8, 'UTF-16LE', 'UTF-16BE');
self::assertEquals("\xFE\xFF" . $utf16be, $local->addBOM($utf16be, 'UTF-16BE'));
$this->expectException(UnexpectedValueException::class);
$local->addBOM('foobar', 'ASCII');
}
}