PSR2 Fixes

This commit is contained in:
Progi1984 2015-05-17 19:26:34 +02:00
parent b6bc0db105
commit 004936e35a
9 changed files with 57 additions and 59 deletions

View File

@ -45,10 +45,10 @@ class AutoloaderTest extends PHPUnit_Framework_TestCase
public function testAutoloadInstantiateSuccess()
{
$result = new PHPExcel_Calculation_Function(1,2,3);
$result = new PHPExcel_Calculation_Function(1, 2, 3);
// Must return an object...
$this->assertTrue(is_object($result));
// ... of the correct type
$this->assertTrue(is_a($result,'PHPExcel_Calculation_Function'));
$this->assertTrue(is_a($result, 'PHPExcel_Calculation_Function'));
}
}

View File

@ -23,7 +23,7 @@ class DateTimeTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','DATE'), $args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'DATE'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-8);
}
@ -35,7 +35,7 @@ class DateTimeTest extends PHPUnit_Framework_TestCase
public function testDATEtoPHP()
{
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC);
$result = PHPExcel_Calculation_DateTime::DATE(2012,1,31);
$result = PHPExcel_Calculation_DateTime::DATE(2012, 1, 31);
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);
$this->assertEquals(1327968000, $result, null, 1E-8);
}
@ -43,30 +43,30 @@ class DateTimeTest extends PHPUnit_Framework_TestCase
public function testDATEtoPHPObject()
{
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT);
$result = PHPExcel_Calculation_DateTime::DATE(2012,1,31);
$result = PHPExcel_Calculation_DateTime::DATE(2012, 1, 31);
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);
// Must return an object...
$this->assertTrue(is_object($result));
// ... of the correct type
$this->assertTrue(is_a($result,'DateTime'));
$this->assertTrue(is_a($result, 'DateTime'));
// ... with the correct value
$this->assertEquals($result->format('d-M-Y'),'31-Jan-2012');
$this->assertEquals($result->format('d-M-Y'), '31-Jan-2012');
}
public function testDATEwith1904Calendar()
{
PHPExcel_Shared_Date::setExcelCalendar(PHPExcel_Shared_Date::CALENDAR_MAC_1904);
$result = PHPExcel_Calculation_DateTime::DATE(1918,11,11);
$result = PHPExcel_Calculation_DateTime::DATE(1918, 11, 11);
PHPExcel_Shared_Date::setExcelCalendar(PHPExcel_Shared_Date::CALENDAR_WINDOWS_1900);
$this->assertEquals($result,5428);
$this->assertEquals($result, 5428);
}
public function testDATEwith1904CalendarError()
{
PHPExcel_Shared_Date::setExcelCalendar(PHPExcel_Shared_Date::CALENDAR_MAC_1904);
$result = PHPExcel_Calculation_DateTime::DATE(1901,1,31);
$result = PHPExcel_Calculation_DateTime::DATE(1901, 1, 31);
PHPExcel_Shared_Date::setExcelCalendar(PHPExcel_Shared_Date::CALENDAR_WINDOWS_1900);
$this->assertEquals($result,'#NUM!');
$this->assertEquals($result, '#NUM!');
}
/**
@ -76,7 +76,7 @@ class DateTimeTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','DATEVALUE'), $args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'DATEVALUE'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-8);
}
@ -101,9 +101,9 @@ class DateTimeTest extends PHPUnit_Framework_TestCase
// Must return an object...
$this->assertTrue(is_object($result));
// ... of the correct type
$this->assertTrue(is_a($result,'DateTime'));
$this->assertTrue(is_a($result, 'DateTime'));
// ... with the correct value
$this->assertEquals($result->format('d-M-Y'),'31-Jan-2012');
$this->assertEquals($result->format('d-M-Y'), '31-Jan-2012');
}
/**
@ -113,7 +113,7 @@ class DateTimeTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','YEAR'), $args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'YEAR'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-8);
}
@ -129,7 +129,7 @@ class DateTimeTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','MONTHOFYEAR'), $args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'MONTHOFYEAR'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-8);
}
@ -145,7 +145,7 @@ class DateTimeTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','WEEKOFYEAR'), $args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'WEEKOFYEAR'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-8);
}
@ -161,7 +161,7 @@ class DateTimeTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','DAYOFWEEK'), $args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'DAYOFWEEK'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-8);
}
@ -177,7 +177,7 @@ class DateTimeTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','DAYOFMONTH'), $args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'DAYOFMONTH'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-8);
}
@ -193,7 +193,7 @@ class DateTimeTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','TIME'), $args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'TIME'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-8);
}
@ -205,7 +205,7 @@ class DateTimeTest extends PHPUnit_Framework_TestCase
public function testTIMEtoPHP()
{
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC);
$result = PHPExcel_Calculation_DateTime::TIME(7,30,20);
$result = PHPExcel_Calculation_DateTime::TIME(7, 30, 20);
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);
$this->assertEquals(27020, $result, null, 1E-8);
}
@ -213,14 +213,14 @@ class DateTimeTest extends PHPUnit_Framework_TestCase
public function testTIMEtoPHPObject()
{
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT);
$result = PHPExcel_Calculation_DateTime::TIME(7,30,20);
$result = PHPExcel_Calculation_DateTime::TIME(7, 30, 20);
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);
// Must return an object...
$this->assertTrue(is_object($result));
// ... of the correct type
$this->assertTrue(is_a($result,'DateTime'));
$this->assertTrue(is_a($result, 'DateTime'));
// ... with the correct value
$this->assertEquals($result->format('H:i:s'),'07:30:20');
$this->assertEquals($result->format('H:i:s'), '07:30:20');
}
/**
@ -230,7 +230,7 @@ class DateTimeTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','TIMEVALUE'), $args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'TIMEVALUE'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-8);
}
@ -255,9 +255,9 @@ class DateTimeTest extends PHPUnit_Framework_TestCase
// Must return an object...
$this->assertTrue(is_object($result));
// ... of the correct type
$this->assertTrue(is_a($result,'DateTime'));
$this->assertTrue(is_a($result, 'DateTime'));
// ... with the correct value
$this->assertEquals($result->format('H:i:s'),'07:30:20');
$this->assertEquals($result->format('H:i:s'), '07:30:20');
}
/**
@ -267,7 +267,7 @@ class DateTimeTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','HOUROFDAY'), $args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'HOUROFDAY'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-8);
}
@ -283,7 +283,7 @@ class DateTimeTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','MINUTEOFHOUR'), $args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'MINUTEOFHOUR'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-8);
}
@ -299,7 +299,7 @@ class DateTimeTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','SECONDOFMINUTE'), $args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'SECONDOFMINUTE'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-8);
}
@ -315,7 +315,7 @@ class DateTimeTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','NETWORKDAYS'), $args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'NETWORKDAYS'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-8);
}
@ -331,7 +331,7 @@ class DateTimeTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','WORKDAY'), $args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'WORKDAY'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-8);
}
@ -347,7 +347,7 @@ class DateTimeTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','EDATE'), $args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'EDATE'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-8);
}
@ -372,9 +372,9 @@ class DateTimeTest extends PHPUnit_Framework_TestCase
// Must return an object...
$this->assertTrue(is_object($result));
// ... of the correct type
$this->assertTrue(is_a($result,'DateTime'));
$this->assertTrue(is_a($result, 'DateTime'));
// ... with the correct value
$this->assertEquals($result->format('d-M-Y'),'26-Dec-2011');
$this->assertEquals($result->format('d-M-Y'), '26-Dec-2011');
}
/**
@ -384,7 +384,7 @@ class DateTimeTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','EOMONTH'), $args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'EOMONTH'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-8);
}
@ -409,9 +409,9 @@ class DateTimeTest extends PHPUnit_Framework_TestCase
// Must return an object...
$this->assertTrue(is_object($result));
// ... of the correct type
$this->assertTrue(is_a($result,'DateTime'));
$this->assertTrue(is_a($result, 'DateTime'));
// ... with the correct value
$this->assertEquals($result->format('d-M-Y'),'31-Dec-2011');
$this->assertEquals($result->format('d-M-Y'), '31-Dec-2011');
}
/**
@ -421,7 +421,7 @@ class DateTimeTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','DATEDIF'), $args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'DATEDIF'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-8);
}
@ -437,7 +437,7 @@ class DateTimeTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','DAYS360'), $args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'DAYS360'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-8);
}
@ -453,7 +453,7 @@ class DateTimeTest extends PHPUnit_Framework_TestCase
{
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime','YEARFRAC'), $args);
$result = call_user_func_array(array('PHPExcel_Calculation_DateTime', 'YEARFRAC'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-8);
}

View File

@ -326,13 +326,13 @@ 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(array('PHPExcel_Shared_String','setDecimalSeparator'),'.');
call_user_func(array('PHPExcel_Shared_String','setThousandsSeparator'),',');
call_user_func(array('PHPExcel_Shared_String','setCurrencyCode'),'$');
call_user_func(array('PHPExcel_Shared_String', 'setDecimalSeparator'), '.');
call_user_func(array('PHPExcel_Shared_String', 'setThousandsSeparator'), ',');
call_user_func(array('PHPExcel_Shared_String', 'setCurrencyCode'), '$');
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','TEXTFORMAT'), $args);
$result = call_user_func_array(array('PHPExcel_Calculation_TextData', 'TEXTFORMAT'), $args);
$this->assertEquals($expectedResult, $result);
}
@ -346,13 +346,13 @@ class TextDataTest extends PHPUnit_Framework_TestCase
*/
public function testVALUE()
{
call_user_func(array('PHPExcel_Shared_String','setDecimalSeparator'),'.');
call_user_func(array('PHPExcel_Shared_String','setThousandsSeparator'),' ');
call_user_func(array('PHPExcel_Shared_String','setCurrencyCode'),'$');
call_user_func(array('PHPExcel_Shared_String', 'setDecimalSeparator'), '.');
call_user_func(array('PHPExcel_Shared_String', 'setThousandsSeparator'), ' ');
call_user_func(array('PHPExcel_Shared_String', 'setCurrencyCode'), '$');
$args = func_get_args();
$expectedResult = array_pop($args);
$result = call_user_func_array(array('PHPExcel_Calculation_TextData','VALUE'), $args);
$result = call_user_func_array(array('PHPExcel_Calculation_TextData', 'VALUE'), $args);
$this->assertEquals($expectedResult, $result, null, 1E-8);
}

View File

@ -129,5 +129,4 @@ class LegendTest extends PHPUnit_Framework_TestCase
$result = $testInstance->getOverlay();
$this->assertEquals($OverlayValue, $result);
}
}

View File

@ -47,9 +47,9 @@ class DateTest extends PHPUnit_Framework_TestCase
$args = func_get_args();
$expectedResult = array_pop($args);
if ($args[0] < 1) {
$expectedResult += gmmktime(0,0,0);
$expectedResult += gmmktime(0, 0, 0);
}
$result = call_user_func_array(array('PHPExcel_Shared_Date','ExcelToPHP'), $args);
$result = call_user_func_array(array('PHPExcel_Shared_Date', 'ExcelToPHP'), $args);
$this->assertEquals($expectedResult, $result);
}
@ -113,7 +113,7 @@ class DateTest extends PHPUnit_Framework_TestCase
$args = func_get_args();
$expectedResult = array_pop($args);
if ($args[0] < 1) {
$expectedResult += gmmktime(0,0,0);
$expectedResult += gmmktime(0, 0, 0);
}
$result = call_user_func_array(array('PHPExcel_Shared_Date','ExcelToPHP'), $args);
$this->assertEquals($expectedResult, $result);
@ -174,7 +174,7 @@ class DateTest extends PHPUnit_Framework_TestCase
$args = func_get_args();
$expectedResult = array_pop($args);
if ($args[0] < 1) {
$expectedResult += gmmktime(0,0,0);
$expectedResult += gmmktime(0, 0, 0);
}
$result = call_user_func_array(array('PHPExcel_Shared_Date','ExcelToPHP'), $args);
$this->assertEquals($expectedResult, $result);

View File

@ -60,7 +60,7 @@ class ColumnCellIteratorTest extends PHPUnit_Framework_TestCase
$iterator->seek(4);
$this->assertEquals($columnIndexResult, $iterator->key());
for($i = 1; $i < $columnIndexResult-1; $i++) {
for ($i = 1; $i < $columnIndexResult-1; $i++) {
$iterator->prev();
$this->assertEquals($columnIndexResult - $i, $iterator->key());
}
@ -83,5 +83,4 @@ class ColumnCellIteratorTest extends PHPUnit_Framework_TestCase
$iterator = new PHPExcel_Worksheet_ColumnCellIterator($this->mockWorksheet, 'A', 2, 4);
$iterator->prev();
}
}

View File

@ -55,7 +55,7 @@ class ColumnIteratorTest extends PHPUnit_Framework_TestCase
public function testIteratorSeekAndPrev()
{
$ranges = range('A','E');
$ranges = range('A', 'E');
$iterator = new PHPExcel_Worksheet_ColumnIterator($this->mockWorksheet, 'B', 'D');
$columnIndexResult = 'D';
$iterator->seek('D');

View File

@ -55,7 +55,7 @@ class RowCellIteratorTest extends PHPUnit_Framework_TestCase
public function testIteratorSeekAndPrev()
{
$ranges = range('A','E');
$ranges = range('A', 'E');
$iterator = new PHPExcel_Worksheet_RowCellIterator($this->mockWorksheet, 2, 'B', 'D');
$RowCellIndexResult = 'D';
$iterator->seek('D');

View File

@ -97,7 +97,7 @@ class testDataFileIterator implements Iterator
} elseif (($dataValue[0] == '"') && ($dataValue[strlen($dataValue)-1] == '"')) {
$dataValue = substr($dataValue, 1, -1);
} elseif (($dataValue[0] == '{') && ($dataValue[strlen($dataValue)-1] == '}')) {
$dataValue = explode(';',substr($dataValue, 1, -1));
$dataValue = explode(';', substr($dataValue, 1, -1));
foreach ($dataValue as &$dataRow) {
if (strpos($dataRow, '|') !== false) {
$dataRow = explode('|', $dataRow);