diff --git a/tests/PhpSpreadsheetTests/Calculation/TextDataTest.php b/tests/PhpSpreadsheetTests/Calculation/TextDataTest.php index b539abba..8b5d0218 100644 --- a/tests/PhpSpreadsheetTests/Calculation/TextDataTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/TextDataTest.php @@ -323,9 +323,9 @@ class TextDataTest extends \PHPUnit_Framework_TestCase public function testTEXT() { // Enforce decimal and thousands separator values to UK/US, and currency code to USD - call_user_func([StringHelper::class, 'setDecimalSeparator'], '.'); - call_user_func([StringHelper::class, 'setThousandsSeparator'], ','); - call_user_func([StringHelper::class, 'setCurrencyCode'], '$'); + StringHelper::setDecimalSeparator('.'); + StringHelper::setThousandsSeparator(','); + StringHelper::setCurrencyCode('$'); $args = func_get_args(); $expectedResult = array_pop($args); @@ -343,9 +343,9 @@ class TextDataTest extends \PHPUnit_Framework_TestCase */ public function testVALUE() { - call_user_func([StringHelper::class, 'setDecimalSeparator'], '.'); - call_user_func([StringHelper::class, 'setThousandsSeparator'], ' '); - call_user_func([StringHelper::class, 'setCurrencyCode'], '$'); + StringHelper::setDecimalSeparator('.'); + StringHelper::setThousandsSeparator(' '); + StringHelper::setCurrencyCode('$'); $args = func_get_args(); $expectedResult = array_pop($args); diff --git a/tests/PhpSpreadsheetTests/Cell/DataTypeTest.php b/tests/PhpSpreadsheetTests/Cell/DataTypeTest.php index f0fb0aff..8fced6da 100644 --- a/tests/PhpSpreadsheetTests/Cell/DataTypeTest.php +++ b/tests/PhpSpreadsheetTests/Cell/DataTypeTest.php @@ -16,7 +16,7 @@ class DataTypeTest extends \PHPUnit_Framework_TestCase public function testGetErrorCodes() { - $result = call_user_func([DataType::class, 'getErrorCodes']); + $result = DataType::getErrorCodes(); $this->assertInternalType('array', $result); $this->assertGreaterThan(0, count($result)); $this->assertArrayHasKey('#NULL!', $result); diff --git a/tests/PhpSpreadsheetTests/Cell/DefaultValueBinderTest.php b/tests/PhpSpreadsheetTests/Cell/DefaultValueBinderTest.php index 38a3629b..c1cd9aae 100644 --- a/tests/PhpSpreadsheetTests/Cell/DefaultValueBinderTest.php +++ b/tests/PhpSpreadsheetTests/Cell/DefaultValueBinderTest.php @@ -81,7 +81,7 @@ class DefaultValueBinderTest extends \PHPUnit_Framework_TestCase $objRichText->createText('Hello World'); $expectedResult = DataType::TYPE_INLINE; - $result = call_user_func([DefaultValueBinder::class, 'dataTypeForValue'], $objRichText); + $result = DefaultValueBinder::dataTypeForValue($objRichText); $this->assertEquals($expectedResult, $result); } } diff --git a/tests/PhpSpreadsheetTests/CellTest.php b/tests/PhpSpreadsheetTests/CellTest.php index 7ad5e8bf..995d2926 100644 --- a/tests/PhpSpreadsheetTests/CellTest.php +++ b/tests/PhpSpreadsheetTests/CellTest.php @@ -27,7 +27,7 @@ class CellTest extends \PHPUnit_Framework_TestCase { $cellAddress = 'ABCD'; try { - call_user_func([Cell::class, 'columnIndexFromString'], $cellAddress); + Cell::columnIndexFromString($cellAddress); } catch (\Exception $e) { $this->assertInstanceOf(Exception::class, $e); $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 = ''; try { - call_user_func([Cell::class, 'columnIndexFromString'], $cellAddress); + Cell::columnIndexFromString($cellAddress); } catch (\Exception $e) { $this->assertInstanceOf(Exception::class, $e); $this->assertEquals($e->getMessage(), 'Column string index can not be empty'); @@ -87,7 +87,7 @@ class CellTest extends \PHPUnit_Framework_TestCase { $cellAddress = 'A1:AI2012'; try { - call_user_func([Cell::class, 'coordinateFromString'], $cellAddress); + Cell::coordinateFromString($cellAddress); } catch (\Exception $e) { $this->assertInstanceOf(Exception::class, $e); $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 = ''; try { - call_user_func([Cell::class, 'coordinateFromString'], $cellAddress); + Cell::coordinateFromString($cellAddress); } catch (\Exception $e) { $this->assertInstanceOf(Exception::class, $e); $this->assertEquals($e->getMessage(), 'Cell coordinate can not be zero-length string'); @@ -115,7 +115,7 @@ class CellTest extends \PHPUnit_Framework_TestCase { $cellAddress = 'AI'; try { - call_user_func([Cell::class, 'coordinateFromString'], $cellAddress); + Cell::coordinateFromString($cellAddress); } catch (\Exception $e) { $this->assertInstanceOf(Exception::class, $e); $this->assertEquals($e->getMessage(), 'Invalid cell coordinate ' . $cellAddress); @@ -145,7 +145,7 @@ class CellTest extends \PHPUnit_Framework_TestCase { $cellAddress = 'A1:AI2012'; try { - call_user_func([Cell::class, 'absoluteCoordinate'], $cellAddress); + Cell::absoluteCoordinate($cellAddress); } catch (\Exception $e) { $this->assertInstanceOf(Exception::class, $e); $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'; try { - call_user_func([Cell::class, 'absoluteReference'], $cellAddress); + Cell::absoluteReference($cellAddress); } catch (\Exception $e) { $this->assertInstanceOf(Exception::class, $e); $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 = ''; try { - call_user_func([Cell::class, 'buildRange'], $cellRange); + Cell::buildRange($cellRange); } catch (\Exception $e) { $this->assertInstanceOf(Exception::class, $e); $this->assertEquals($e->getMessage(), 'Range does not contain any information'); diff --git a/tests/PhpSpreadsheetTests/SettingsTest.php b/tests/PhpSpreadsheetTests/SettingsTest.php index 4a3c5fa5..4712f206 100644 --- a/tests/PhpSpreadsheetTests/SettingsTest.php +++ b/tests/PhpSpreadsheetTests/SettingsTest.php @@ -12,7 +12,7 @@ class SettingsTest extends \PHPUnit_Framework_TestCase */ public function testGetXMLSettings() { - $result = call_user_func([\PhpSpreadsheet\Settings::class, 'getLibXmlLoaderOptions']); + $result = \PhpSpreadsheet\Settings::getLibXmlLoaderOptions(); $this->assertTrue((bool) ((LIBXML_DTDLOAD | LIBXML_DTDATTR) & $result)); } @@ -21,7 +21,7 @@ class SettingsTest extends \PHPUnit_Framework_TestCase public function testSetXMLSettings() { 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)); } } diff --git a/tests/PhpSpreadsheetTests/Shared/CodePageTest.php b/tests/PhpSpreadsheetTests/Shared/CodePageTest.php index 10f93449..7376a97c 100644 --- a/tests/PhpSpreadsheetTests/Shared/CodePageTest.php +++ b/tests/PhpSpreadsheetTests/Shared/CodePageTest.php @@ -27,7 +27,7 @@ class CodePageTest extends \PHPUnit_Framework_TestCase { $invalidCodePage = 12345; try { - call_user_func([CodePage::class, 'numberToName'], $invalidCodePage); + CodePage::numberToName($invalidCodePage); } catch (Exception $e) { $this->assertEquals($e->getMessage(), 'Unknown codepage: 12345'); @@ -40,7 +40,7 @@ class CodePageTest extends \PHPUnit_Framework_TestCase { $unsupportedCodePage = 720; try { - call_user_func([CodePage::class, 'numberToName'], $unsupportedCodePage); + CodePage::numberToName($unsupportedCodePage); } catch (Exception $e) { $this->assertEquals($e->getMessage(), 'Code page 720 not supported.'); diff --git a/tests/PhpSpreadsheetTests/Shared/DateTest.php b/tests/PhpSpreadsheetTests/Shared/DateTest.php index ea0182e7..6b8f5741 100644 --- a/tests/PhpSpreadsheetTests/Shared/DateTest.php +++ b/tests/PhpSpreadsheetTests/Shared/DateTest.php @@ -14,7 +14,7 @@ class DateTest extends \PHPUnit_Framework_TestCase ]; foreach ($calendarValues as $calendarValue) { - $result = call_user_func([Date::class, 'setExcelCalendar'], $calendarValue); + $result = Date::setExcelCalendar($calendarValue); $this->assertTrue($result); } } @@ -22,7 +22,7 @@ class DateTest extends \PHPUnit_Framework_TestCase public function testSetExcelCalendarWithInvalidValue() { $unsupportedCalendar = '2012'; - $result = call_user_func([Date::class, 'setExcelCalendar'], $unsupportedCalendar); + $result = Date::setExcelCalendar($unsupportedCalendar); $this->assertFalse($result); } @@ -31,10 +31,7 @@ class DateTest extends \PHPUnit_Framework_TestCase */ public function testDateTimeExcelToTimestamp1900() { - call_user_func( - [Date::class, 'setExcelCalendar'], - Date::CALENDAR_WINDOWS_1900 - ); + Date::setExcelCalendar(Date::CALENDAR_WINDOWS_1900); $args = func_get_args(); $expectedResult = array_pop($args); @@ -52,10 +49,7 @@ class DateTest extends \PHPUnit_Framework_TestCase */ public function testDateTimeTimestampToExcel1900() { - call_user_func( - [Date::class, 'setExcelCalendar'], - Date::CALENDAR_WINDOWS_1900 - ); + Date::setExcelCalendar(Date::CALENDAR_WINDOWS_1900); $args = func_get_args(); $expectedResult = array_pop($args); @@ -73,10 +67,7 @@ class DateTest extends \PHPUnit_Framework_TestCase */ public function testDateTimeDateTimeToExcel() { - call_user_func( - [Date::class, 'setExcelCalendar'], - Date::CALENDAR_WINDOWS_1900 - ); + Date::setExcelCalendar(Date::CALENDAR_WINDOWS_1900); $args = func_get_args(); $expectedResult = array_pop($args); @@ -94,10 +85,7 @@ class DateTest extends \PHPUnit_Framework_TestCase */ public function testDateTimeFormattedPHPToExcel1900() { - call_user_func( - [Date::class, 'setExcelCalendar'], - Date::CALENDAR_WINDOWS_1900 - ); + Date::setExcelCalendar(Date::CALENDAR_WINDOWS_1900); $args = func_get_args(); $expectedResult = array_pop($args); @@ -115,10 +103,7 @@ class DateTest extends \PHPUnit_Framework_TestCase */ public function testDateTimeExcelToTimestamp1904() { - call_user_func( - [Date::class, 'setExcelCalendar'], - Date::CALENDAR_MAC_1904 - ); + Date::setExcelCalendar(Date::CALENDAR_MAC_1904); $args = func_get_args(); $expectedResult = array_pop($args); @@ -136,10 +121,7 @@ class DateTest extends \PHPUnit_Framework_TestCase */ public function testDateTimeTimestampToExcel1904() { - call_user_func( - [Date::class, 'setExcelCalendar'], - Date::CALENDAR_MAC_1904 - ); + Date::setExcelCalendar(Date::CALENDAR_MAC_1904); $args = func_get_args(); $expectedResult = array_pop($args); @@ -173,10 +155,7 @@ class DateTest extends \PHPUnit_Framework_TestCase */ public function testDateTimeExcelToTimestamp1900Timezone() { - call_user_func( - [Date::class, 'setExcelCalendar'], - Date::CALENDAR_WINDOWS_1900 - ); + Date::setExcelCalendar(Date::CALENDAR_WINDOWS_1900); $args = func_get_args(); $expectedResult = array_pop($args); diff --git a/tests/PhpSpreadsheetTests/Shared/FileTest.php b/tests/PhpSpreadsheetTests/Shared/FileTest.php index 61bc9729..cc05a6f6 100644 --- a/tests/PhpSpreadsheetTests/Shared/FileTest.php +++ b/tests/PhpSpreadsheetTests/Shared/FileTest.php @@ -10,7 +10,7 @@ class FileTest extends \PHPUnit_Framework_TestCase { $expectedResult = false; - $result = call_user_func([File::class, 'getUseUploadTempDirectory']); + $result = File::getUseUploadTempDirectory(); $this->assertEquals($expectedResult, $result); } @@ -22,9 +22,9 @@ class FileTest extends \PHPUnit_Framework_TestCase ]; 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); } } diff --git a/tests/PhpSpreadsheetTests/Shared/FontTest.php b/tests/PhpSpreadsheetTests/Shared/FontTest.php index 8a93425f..e50a3f15 100644 --- a/tests/PhpSpreadsheetTests/Shared/FontTest.php +++ b/tests/PhpSpreadsheetTests/Shared/FontTest.php @@ -10,7 +10,7 @@ class FontTest extends \PHPUnit_Framework_TestCase { $expectedResult = Font::AUTOSIZE_METHOD_APPROX; - $result = call_user_func([Font::class, 'getAutoSizeMethod']); + $result = Font::getAutoSizeMethod(); $this->assertEquals($expectedResult, $result); } @@ -22,7 +22,7 @@ class FontTest extends \PHPUnit_Framework_TestCase ]; foreach ($autosizeMethodValues as $autosizeMethodValue) { - $result = call_user_func([Font::class, 'setAutoSizeMethod'], $autosizeMethodValue); + $result = Font::setAutoSizeMethod($autosizeMethodValue); $this->assertTrue($result); } } @@ -31,7 +31,7 @@ class FontTest extends \PHPUnit_Framework_TestCase { $unsupportedAutosizeMethod = 'guess'; - $result = call_user_func([Font::class, 'setAutoSizeMethod'], $unsupportedAutosizeMethod); + $result = Font::setAutoSizeMethod($unsupportedAutosizeMethod); $this->assertFalse($result); } diff --git a/tests/PhpSpreadsheetTests/Shared/StringTest.php b/tests/PhpSpreadsheetTests/Shared/StringTest.php index 8accc643..4fe28bc1 100644 --- a/tests/PhpSpreadsheetTests/Shared/StringTest.php +++ b/tests/PhpSpreadsheetTests/Shared/StringTest.php @@ -11,18 +11,18 @@ class StringTest extends \PHPUnit_Framework_TestCase parent::setUp(); // Reset Currency Code - call_user_func([StringHelper::class, 'setCurrencyCode'], null); + StringHelper::setCurrencyCode(null); } public function testGetIsMbStringEnabled() { - $result = call_user_func([StringHelper::class, 'getIsMbstringEnabled']); + $result = StringHelper::getIsMbstringEnabled(); $this->assertTrue($result); } public function testGetIsIconvEnabled() { - $result = call_user_func([StringHelper::class, 'getIsIconvEnabled']); + $result = StringHelper::getIsIconvEnabled(); $this->assertTrue($result); } @@ -31,16 +31,16 @@ class StringTest extends \PHPUnit_Framework_TestCase $localeconv = localeconv(); $expectedResult = (!empty($localeconv['decimal_point'])) ? $localeconv['decimal_point'] : ','; - $result = call_user_func([StringHelper::class, 'getDecimalSeparator']); + $result = StringHelper::getDecimalSeparator(); $this->assertEquals($expectedResult, $result); } public function testSetDecimalSeparator() { $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); } @@ -49,16 +49,16 @@ class StringTest extends \PHPUnit_Framework_TestCase $localeconv = localeconv(); $expectedResult = (!empty($localeconv['thousands_sep'])) ? $localeconv['thousands_sep'] : ','; - $result = call_user_func([StringHelper::class, 'getThousandsSeparator']); + $result = StringHelper::getThousandsSeparator(); $this->assertEquals($expectedResult, $result); } public function testSetThousandsSeparator() { $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); } @@ -66,16 +66,16 @@ class StringTest extends \PHPUnit_Framework_TestCase { $localeconv = localeconv(); $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); } public function testSetCurrencyCode() { $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); } } diff --git a/tests/PhpSpreadsheetTests/Shared/TimeZoneTest.php b/tests/PhpSpreadsheetTests/Shared/TimeZoneTest.php index 3b6d05e5..5483e730 100644 --- a/tests/PhpSpreadsheetTests/Shared/TimeZoneTest.php +++ b/tests/PhpSpreadsheetTests/Shared/TimeZoneTest.php @@ -17,7 +17,7 @@ class TimeZoneTest extends \PHPUnit_Framework_TestCase ]; foreach ($timezoneValues as $timezoneValue) { - $result = call_user_func([TimeZone::class, 'setTimezone'], $timezoneValue); + $result = TimeZone::setTimezone($timezoneValue); $this->assertTrue($result); } } @@ -25,7 +25,7 @@ class TimeZoneTest extends \PHPUnit_Framework_TestCase public function testSetTimezoneWithInvalidValue() { $unsupportedTimezone = 'Etc/GMT+10'; - $result = call_user_func([TimeZone::class, 'setTimezone'], $unsupportedTimezone); + $result = TimeZone::setTimezone($unsupportedTimezone); $this->assertFalse($result); } }