Avoid `call_user_func()` whenever possible
This commit is contained in:
parent
04d6182a81
commit
f917b3b1f4
|
@ -323,9 +323,9 @@ class TextDataTest extends \PHPUnit_Framework_TestCase
|
||||||
public function testTEXT()
|
public function testTEXT()
|
||||||
{
|
{
|
||||||
// Enforce decimal and thousands separator values to UK/US, and currency code to USD
|
// Enforce decimal and thousands separator values to UK/US, and currency code to USD
|
||||||
call_user_func([StringHelper::class, 'setDecimalSeparator'], '.');
|
StringHelper::setDecimalSeparator('.');
|
||||||
call_user_func([StringHelper::class, 'setThousandsSeparator'], ',');
|
StringHelper::setThousandsSeparator(',');
|
||||||
call_user_func([StringHelper::class, 'setCurrencyCode'], '$');
|
StringHelper::setCurrencyCode('$');
|
||||||
|
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
|
@ -343,9 +343,9 @@ class TextDataTest extends \PHPUnit_Framework_TestCase
|
||||||
*/
|
*/
|
||||||
public function testVALUE()
|
public function testVALUE()
|
||||||
{
|
{
|
||||||
call_user_func([StringHelper::class, 'setDecimalSeparator'], '.');
|
StringHelper::setDecimalSeparator('.');
|
||||||
call_user_func([StringHelper::class, 'setThousandsSeparator'], ' ');
|
StringHelper::setThousandsSeparator(' ');
|
||||||
call_user_func([StringHelper::class, 'setCurrencyCode'], '$');
|
StringHelper::setCurrencyCode('$');
|
||||||
|
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
|
|
|
@ -16,7 +16,7 @@ class DataTypeTest extends \PHPUnit_Framework_TestCase
|
||||||
|
|
||||||
public function testGetErrorCodes()
|
public function testGetErrorCodes()
|
||||||
{
|
{
|
||||||
$result = call_user_func([DataType::class, 'getErrorCodes']);
|
$result = DataType::getErrorCodes();
|
||||||
$this->assertInternalType('array', $result);
|
$this->assertInternalType('array', $result);
|
||||||
$this->assertGreaterThan(0, count($result));
|
$this->assertGreaterThan(0, count($result));
|
||||||
$this->assertArrayHasKey('#NULL!', $result);
|
$this->assertArrayHasKey('#NULL!', $result);
|
||||||
|
|
|
@ -81,7 +81,7 @@ class DefaultValueBinderTest extends \PHPUnit_Framework_TestCase
|
||||||
$objRichText->createText('Hello World');
|
$objRichText->createText('Hello World');
|
||||||
|
|
||||||
$expectedResult = DataType::TYPE_INLINE;
|
$expectedResult = DataType::TYPE_INLINE;
|
||||||
$result = call_user_func([DefaultValueBinder::class, 'dataTypeForValue'], $objRichText);
|
$result = DefaultValueBinder::dataTypeForValue($objRichText);
|
||||||
$this->assertEquals($expectedResult, $result);
|
$this->assertEquals($expectedResult, $result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@ class CellTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$cellAddress = 'ABCD';
|
$cellAddress = 'ABCD';
|
||||||
try {
|
try {
|
||||||
call_user_func([Cell::class, 'columnIndexFromString'], $cellAddress);
|
Cell::columnIndexFromString($cellAddress);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$this->assertInstanceOf(Exception::class, $e);
|
$this->assertInstanceOf(Exception::class, $e);
|
||||||
$this->assertEquals($e->getMessage(), 'Column string index can not be longer than 3 characters');
|
$this->assertEquals($e->getMessage(), 'Column string index can not be longer than 3 characters');
|
||||||
|
@ -41,7 +41,7 @@ class CellTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$cellAddress = '';
|
$cellAddress = '';
|
||||||
try {
|
try {
|
||||||
call_user_func([Cell::class, 'columnIndexFromString'], $cellAddress);
|
Cell::columnIndexFromString($cellAddress);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$this->assertInstanceOf(Exception::class, $e);
|
$this->assertInstanceOf(Exception::class, $e);
|
||||||
$this->assertEquals($e->getMessage(), 'Column string index can not be empty');
|
$this->assertEquals($e->getMessage(), 'Column string index can not be empty');
|
||||||
|
@ -87,7 +87,7 @@ class CellTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$cellAddress = 'A1:AI2012';
|
$cellAddress = 'A1:AI2012';
|
||||||
try {
|
try {
|
||||||
call_user_func([Cell::class, 'coordinateFromString'], $cellAddress);
|
Cell::coordinateFromString($cellAddress);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$this->assertInstanceOf(Exception::class, $e);
|
$this->assertInstanceOf(Exception::class, $e);
|
||||||
$this->assertEquals($e->getMessage(), 'Cell coordinate string can not be a range of cells');
|
$this->assertEquals($e->getMessage(), 'Cell coordinate string can not be a range of cells');
|
||||||
|
@ -101,7 +101,7 @@ class CellTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$cellAddress = '';
|
$cellAddress = '';
|
||||||
try {
|
try {
|
||||||
call_user_func([Cell::class, 'coordinateFromString'], $cellAddress);
|
Cell::coordinateFromString($cellAddress);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$this->assertInstanceOf(Exception::class, $e);
|
$this->assertInstanceOf(Exception::class, $e);
|
||||||
$this->assertEquals($e->getMessage(), 'Cell coordinate can not be zero-length string');
|
$this->assertEquals($e->getMessage(), 'Cell coordinate can not be zero-length string');
|
||||||
|
@ -115,7 +115,7 @@ class CellTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$cellAddress = 'AI';
|
$cellAddress = 'AI';
|
||||||
try {
|
try {
|
||||||
call_user_func([Cell::class, 'coordinateFromString'], $cellAddress);
|
Cell::coordinateFromString($cellAddress);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$this->assertInstanceOf(Exception::class, $e);
|
$this->assertInstanceOf(Exception::class, $e);
|
||||||
$this->assertEquals($e->getMessage(), 'Invalid cell coordinate ' . $cellAddress);
|
$this->assertEquals($e->getMessage(), 'Invalid cell coordinate ' . $cellAddress);
|
||||||
|
@ -145,7 +145,7 @@ class CellTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$cellAddress = 'A1:AI2012';
|
$cellAddress = 'A1:AI2012';
|
||||||
try {
|
try {
|
||||||
call_user_func([Cell::class, 'absoluteCoordinate'], $cellAddress);
|
Cell::absoluteCoordinate($cellAddress);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$this->assertInstanceOf(Exception::class, $e);
|
$this->assertInstanceOf(Exception::class, $e);
|
||||||
$this->assertEquals($e->getMessage(), 'Cell coordinate string can not be a range of cells');
|
$this->assertEquals($e->getMessage(), 'Cell coordinate string can not be a range of cells');
|
||||||
|
@ -175,7 +175,7 @@ class CellTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$cellAddress = 'A1:AI2012';
|
$cellAddress = 'A1:AI2012';
|
||||||
try {
|
try {
|
||||||
call_user_func([Cell::class, 'absoluteReference'], $cellAddress);
|
Cell::absoluteReference($cellAddress);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$this->assertInstanceOf(Exception::class, $e);
|
$this->assertInstanceOf(Exception::class, $e);
|
||||||
$this->assertEquals($e->getMessage(), 'Cell coordinate string can not be a range of cells');
|
$this->assertEquals($e->getMessage(), 'Cell coordinate string can not be a range of cells');
|
||||||
|
@ -227,7 +227,7 @@ class CellTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$cellRange = '';
|
$cellRange = '';
|
||||||
try {
|
try {
|
||||||
call_user_func([Cell::class, 'buildRange'], $cellRange);
|
Cell::buildRange($cellRange);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$this->assertInstanceOf(Exception::class, $e);
|
$this->assertInstanceOf(Exception::class, $e);
|
||||||
$this->assertEquals($e->getMessage(), 'Range does not contain any information');
|
$this->assertEquals($e->getMessage(), 'Range does not contain any information');
|
||||||
|
|
|
@ -12,7 +12,7 @@ class SettingsTest extends \PHPUnit_Framework_TestCase
|
||||||
*/
|
*/
|
||||||
public function testGetXMLSettings()
|
public function testGetXMLSettings()
|
||||||
{
|
{
|
||||||
$result = call_user_func([\PhpSpreadsheet\Settings::class, 'getLibXmlLoaderOptions']);
|
$result = \PhpSpreadsheet\Settings::getLibXmlLoaderOptions();
|
||||||
$this->assertTrue((bool) ((LIBXML_DTDLOAD | LIBXML_DTDATTR) & $result));
|
$this->assertTrue((bool) ((LIBXML_DTDLOAD | LIBXML_DTDATTR) & $result));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ class SettingsTest extends \PHPUnit_Framework_TestCase
|
||||||
public function testSetXMLSettings()
|
public function testSetXMLSettings()
|
||||||
{
|
{
|
||||||
call_user_func_array([\PhpSpreadsheet\Settings::class, 'setLibXmlLoaderOptions'], [LIBXML_DTDLOAD | LIBXML_DTDATTR | LIBXML_DTDVALID]);
|
call_user_func_array([\PhpSpreadsheet\Settings::class, 'setLibXmlLoaderOptions'], [LIBXML_DTDLOAD | LIBXML_DTDATTR | LIBXML_DTDVALID]);
|
||||||
$result = call_user_func([\PhpSpreadsheet\Settings::class, 'getLibXmlLoaderOptions']);
|
$result = \PhpSpreadsheet\Settings::getLibXmlLoaderOptions();
|
||||||
$this->assertTrue((bool) ((LIBXML_DTDLOAD | LIBXML_DTDATTR | LIBXML_DTDVALID) & $result));
|
$this->assertTrue((bool) ((LIBXML_DTDLOAD | LIBXML_DTDATTR | LIBXML_DTDVALID) & $result));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@ class CodePageTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$invalidCodePage = 12345;
|
$invalidCodePage = 12345;
|
||||||
try {
|
try {
|
||||||
call_user_func([CodePage::class, 'numberToName'], $invalidCodePage);
|
CodePage::numberToName($invalidCodePage);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$this->assertEquals($e->getMessage(), 'Unknown codepage: 12345');
|
$this->assertEquals($e->getMessage(), 'Unknown codepage: 12345');
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ class CodePageTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$unsupportedCodePage = 720;
|
$unsupportedCodePage = 720;
|
||||||
try {
|
try {
|
||||||
call_user_func([CodePage::class, 'numberToName'], $unsupportedCodePage);
|
CodePage::numberToName($unsupportedCodePage);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$this->assertEquals($e->getMessage(), 'Code page 720 not supported.');
|
$this->assertEquals($e->getMessage(), 'Code page 720 not supported.');
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ class DateTest extends \PHPUnit_Framework_TestCase
|
||||||
];
|
];
|
||||||
|
|
||||||
foreach ($calendarValues as $calendarValue) {
|
foreach ($calendarValues as $calendarValue) {
|
||||||
$result = call_user_func([Date::class, 'setExcelCalendar'], $calendarValue);
|
$result = Date::setExcelCalendar($calendarValue);
|
||||||
$this->assertTrue($result);
|
$this->assertTrue($result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ class DateTest extends \PHPUnit_Framework_TestCase
|
||||||
public function testSetExcelCalendarWithInvalidValue()
|
public function testSetExcelCalendarWithInvalidValue()
|
||||||
{
|
{
|
||||||
$unsupportedCalendar = '2012';
|
$unsupportedCalendar = '2012';
|
||||||
$result = call_user_func([Date::class, 'setExcelCalendar'], $unsupportedCalendar);
|
$result = Date::setExcelCalendar($unsupportedCalendar);
|
||||||
$this->assertFalse($result);
|
$this->assertFalse($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,10 +31,7 @@ class DateTest extends \PHPUnit_Framework_TestCase
|
||||||
*/
|
*/
|
||||||
public function testDateTimeExcelToTimestamp1900()
|
public function testDateTimeExcelToTimestamp1900()
|
||||||
{
|
{
|
||||||
call_user_func(
|
Date::setExcelCalendar(Date::CALENDAR_WINDOWS_1900);
|
||||||
[Date::class, 'setExcelCalendar'],
|
|
||||||
Date::CALENDAR_WINDOWS_1900
|
|
||||||
);
|
|
||||||
|
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
|
@ -52,10 +49,7 @@ class DateTest extends \PHPUnit_Framework_TestCase
|
||||||
*/
|
*/
|
||||||
public function testDateTimeTimestampToExcel1900()
|
public function testDateTimeTimestampToExcel1900()
|
||||||
{
|
{
|
||||||
call_user_func(
|
Date::setExcelCalendar(Date::CALENDAR_WINDOWS_1900);
|
||||||
[Date::class, 'setExcelCalendar'],
|
|
||||||
Date::CALENDAR_WINDOWS_1900
|
|
||||||
);
|
|
||||||
|
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
|
@ -73,10 +67,7 @@ class DateTest extends \PHPUnit_Framework_TestCase
|
||||||
*/
|
*/
|
||||||
public function testDateTimeDateTimeToExcel()
|
public function testDateTimeDateTimeToExcel()
|
||||||
{
|
{
|
||||||
call_user_func(
|
Date::setExcelCalendar(Date::CALENDAR_WINDOWS_1900);
|
||||||
[Date::class, 'setExcelCalendar'],
|
|
||||||
Date::CALENDAR_WINDOWS_1900
|
|
||||||
);
|
|
||||||
|
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
|
@ -94,10 +85,7 @@ class DateTest extends \PHPUnit_Framework_TestCase
|
||||||
*/
|
*/
|
||||||
public function testDateTimeFormattedPHPToExcel1900()
|
public function testDateTimeFormattedPHPToExcel1900()
|
||||||
{
|
{
|
||||||
call_user_func(
|
Date::setExcelCalendar(Date::CALENDAR_WINDOWS_1900);
|
||||||
[Date::class, 'setExcelCalendar'],
|
|
||||||
Date::CALENDAR_WINDOWS_1900
|
|
||||||
);
|
|
||||||
|
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
|
@ -115,10 +103,7 @@ class DateTest extends \PHPUnit_Framework_TestCase
|
||||||
*/
|
*/
|
||||||
public function testDateTimeExcelToTimestamp1904()
|
public function testDateTimeExcelToTimestamp1904()
|
||||||
{
|
{
|
||||||
call_user_func(
|
Date::setExcelCalendar(Date::CALENDAR_MAC_1904);
|
||||||
[Date::class, 'setExcelCalendar'],
|
|
||||||
Date::CALENDAR_MAC_1904
|
|
||||||
);
|
|
||||||
|
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
|
@ -136,10 +121,7 @@ class DateTest extends \PHPUnit_Framework_TestCase
|
||||||
*/
|
*/
|
||||||
public function testDateTimeTimestampToExcel1904()
|
public function testDateTimeTimestampToExcel1904()
|
||||||
{
|
{
|
||||||
call_user_func(
|
Date::setExcelCalendar(Date::CALENDAR_MAC_1904);
|
||||||
[Date::class, 'setExcelCalendar'],
|
|
||||||
Date::CALENDAR_MAC_1904
|
|
||||||
);
|
|
||||||
|
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
|
@ -173,10 +155,7 @@ class DateTest extends \PHPUnit_Framework_TestCase
|
||||||
*/
|
*/
|
||||||
public function testDateTimeExcelToTimestamp1900Timezone()
|
public function testDateTimeExcelToTimestamp1900Timezone()
|
||||||
{
|
{
|
||||||
call_user_func(
|
Date::setExcelCalendar(Date::CALENDAR_WINDOWS_1900);
|
||||||
[Date::class, 'setExcelCalendar'],
|
|
||||||
Date::CALENDAR_WINDOWS_1900
|
|
||||||
);
|
|
||||||
|
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$expectedResult = array_pop($args);
|
$expectedResult = array_pop($args);
|
||||||
|
|
|
@ -10,7 +10,7 @@ class FileTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$expectedResult = false;
|
$expectedResult = false;
|
||||||
|
|
||||||
$result = call_user_func([File::class, 'getUseUploadTempDirectory']);
|
$result = File::getUseUploadTempDirectory();
|
||||||
$this->assertEquals($expectedResult, $result);
|
$this->assertEquals($expectedResult, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,9 +22,9 @@ class FileTest extends \PHPUnit_Framework_TestCase
|
||||||
];
|
];
|
||||||
|
|
||||||
foreach ($useUploadTempDirectoryValues as $useUploadTempDirectoryValue) {
|
foreach ($useUploadTempDirectoryValues as $useUploadTempDirectoryValue) {
|
||||||
call_user_func([File::class, 'setUseUploadTempDirectory'], $useUploadTempDirectoryValue);
|
File::setUseUploadTempDirectory($useUploadTempDirectoryValue);
|
||||||
|
|
||||||
$result = call_user_func([File::class, 'getUseUploadTempDirectory']);
|
$result = File::getUseUploadTempDirectory();
|
||||||
$this->assertEquals($useUploadTempDirectoryValue, $result);
|
$this->assertEquals($useUploadTempDirectoryValue, $result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ class FontTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$expectedResult = Font::AUTOSIZE_METHOD_APPROX;
|
$expectedResult = Font::AUTOSIZE_METHOD_APPROX;
|
||||||
|
|
||||||
$result = call_user_func([Font::class, 'getAutoSizeMethod']);
|
$result = Font::getAutoSizeMethod();
|
||||||
$this->assertEquals($expectedResult, $result);
|
$this->assertEquals($expectedResult, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ class FontTest extends \PHPUnit_Framework_TestCase
|
||||||
];
|
];
|
||||||
|
|
||||||
foreach ($autosizeMethodValues as $autosizeMethodValue) {
|
foreach ($autosizeMethodValues as $autosizeMethodValue) {
|
||||||
$result = call_user_func([Font::class, 'setAutoSizeMethod'], $autosizeMethodValue);
|
$result = Font::setAutoSizeMethod($autosizeMethodValue);
|
||||||
$this->assertTrue($result);
|
$this->assertTrue($result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@ class FontTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$unsupportedAutosizeMethod = 'guess';
|
$unsupportedAutosizeMethod = 'guess';
|
||||||
|
|
||||||
$result = call_user_func([Font::class, 'setAutoSizeMethod'], $unsupportedAutosizeMethod);
|
$result = Font::setAutoSizeMethod($unsupportedAutosizeMethod);
|
||||||
$this->assertFalse($result);
|
$this->assertFalse($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,18 +11,18 @@ class StringTest extends \PHPUnit_Framework_TestCase
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
// Reset Currency Code
|
// Reset Currency Code
|
||||||
call_user_func([StringHelper::class, 'setCurrencyCode'], null);
|
StringHelper::setCurrencyCode(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetIsMbStringEnabled()
|
public function testGetIsMbStringEnabled()
|
||||||
{
|
{
|
||||||
$result = call_user_func([StringHelper::class, 'getIsMbstringEnabled']);
|
$result = StringHelper::getIsMbstringEnabled();
|
||||||
$this->assertTrue($result);
|
$this->assertTrue($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetIsIconvEnabled()
|
public function testGetIsIconvEnabled()
|
||||||
{
|
{
|
||||||
$result = call_user_func([StringHelper::class, 'getIsIconvEnabled']);
|
$result = StringHelper::getIsIconvEnabled();
|
||||||
$this->assertTrue($result);
|
$this->assertTrue($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,16 +31,16 @@ class StringTest extends \PHPUnit_Framework_TestCase
|
||||||
$localeconv = localeconv();
|
$localeconv = localeconv();
|
||||||
|
|
||||||
$expectedResult = (!empty($localeconv['decimal_point'])) ? $localeconv['decimal_point'] : ',';
|
$expectedResult = (!empty($localeconv['decimal_point'])) ? $localeconv['decimal_point'] : ',';
|
||||||
$result = call_user_func([StringHelper::class, 'getDecimalSeparator']);
|
$result = StringHelper::getDecimalSeparator();
|
||||||
$this->assertEquals($expectedResult, $result);
|
$this->assertEquals($expectedResult, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSetDecimalSeparator()
|
public function testSetDecimalSeparator()
|
||||||
{
|
{
|
||||||
$expectedResult = ',';
|
$expectedResult = ',';
|
||||||
call_user_func([StringHelper::class, 'setDecimalSeparator'], $expectedResult);
|
StringHelper::setDecimalSeparator($expectedResult);
|
||||||
|
|
||||||
$result = call_user_func([StringHelper::class, 'getDecimalSeparator']);
|
$result = StringHelper::getDecimalSeparator();
|
||||||
$this->assertEquals($expectedResult, $result);
|
$this->assertEquals($expectedResult, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,16 +49,16 @@ class StringTest extends \PHPUnit_Framework_TestCase
|
||||||
$localeconv = localeconv();
|
$localeconv = localeconv();
|
||||||
|
|
||||||
$expectedResult = (!empty($localeconv['thousands_sep'])) ? $localeconv['thousands_sep'] : ',';
|
$expectedResult = (!empty($localeconv['thousands_sep'])) ? $localeconv['thousands_sep'] : ',';
|
||||||
$result = call_user_func([StringHelper::class, 'getThousandsSeparator']);
|
$result = StringHelper::getThousandsSeparator();
|
||||||
$this->assertEquals($expectedResult, $result);
|
$this->assertEquals($expectedResult, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSetThousandsSeparator()
|
public function testSetThousandsSeparator()
|
||||||
{
|
{
|
||||||
$expectedResult = ' ';
|
$expectedResult = ' ';
|
||||||
call_user_func([StringHelper::class, 'setThousandsSeparator'], $expectedResult);
|
StringHelper::setThousandsSeparator($expectedResult);
|
||||||
|
|
||||||
$result = call_user_func([StringHelper::class, 'getThousandsSeparator']);
|
$result = StringHelper::getThousandsSeparator();
|
||||||
$this->assertEquals($expectedResult, $result);
|
$this->assertEquals($expectedResult, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,16 +66,16 @@ class StringTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$localeconv = localeconv();
|
$localeconv = localeconv();
|
||||||
$expectedResult = (!empty($localeconv['currency_symbol']) ? $localeconv['currency_symbol'] : (!empty($localeconv['int_curr_symbol']) ? $localeconv['int_curr_symbol']: '$'));
|
$expectedResult = (!empty($localeconv['currency_symbol']) ? $localeconv['currency_symbol'] : (!empty($localeconv['int_curr_symbol']) ? $localeconv['int_curr_symbol']: '$'));
|
||||||
$result = call_user_func([StringHelper::class, 'getCurrencyCode']);
|
$result = StringHelper::getCurrencyCode();
|
||||||
$this->assertEquals($expectedResult, $result);
|
$this->assertEquals($expectedResult, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSetCurrencyCode()
|
public function testSetCurrencyCode()
|
||||||
{
|
{
|
||||||
$expectedResult = '£';
|
$expectedResult = '£';
|
||||||
call_user_func([StringHelper::class, 'setCurrencyCode'], $expectedResult);
|
StringHelper::setCurrencyCode($expectedResult);
|
||||||
|
|
||||||
$result = call_user_func([StringHelper::class, 'getCurrencyCode']);
|
$result = StringHelper::getCurrencyCode();
|
||||||
$this->assertEquals($expectedResult, $result);
|
$this->assertEquals($expectedResult, $result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ class TimeZoneTest extends \PHPUnit_Framework_TestCase
|
||||||
];
|
];
|
||||||
|
|
||||||
foreach ($timezoneValues as $timezoneValue) {
|
foreach ($timezoneValues as $timezoneValue) {
|
||||||
$result = call_user_func([TimeZone::class, 'setTimezone'], $timezoneValue);
|
$result = TimeZone::setTimezone($timezoneValue);
|
||||||
$this->assertTrue($result);
|
$this->assertTrue($result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@ class TimeZoneTest extends \PHPUnit_Framework_TestCase
|
||||||
public function testSetTimezoneWithInvalidValue()
|
public function testSetTimezoneWithInvalidValue()
|
||||||
{
|
{
|
||||||
$unsupportedTimezone = 'Etc/GMT+10';
|
$unsupportedTimezone = 'Etc/GMT+10';
|
||||||
$result = call_user_func([TimeZone::class, 'setTimezone'], $unsupportedTimezone);
|
$result = TimeZone::setTimezone($unsupportedTimezone);
|
||||||
$this->assertFalse($result);
|
$this->assertFalse($result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue