Fix code style

This commit is contained in:
Adrien Loison committed 2017-09-06 00:33:43 +02:00
1 parent 740fcfb8c1
commit b968513cb9
171 files changed
+517 -792

No files matched your search

+8 -12
View File
@@ -3,19 +3,15 @@
namespace Box\Spout\Reader\CSV;
use Box\Spout\Common\Creator\HelperFactory;
use Box\Spout\Common\Helper\EncodingHelper;
use Box\Spout\Common\Helper\GlobalFunctionsHelper;
use Box\Spout\Reader\CSV\Creator\EntityFactory;
use Box\Spout\Reader\CSV\Manager\OptionsManager;
use Box\Spout\Reader\ReaderFactory;
use Box\Spout\Common\Type;
use Box\Spout\Common\Helper\EncodingHelper;
use Box\Spout\Reader\ReaderInterface;
use Box\Spout\TestUsingResource;
/**
* Class ReaderTest
*
* @package Box\Spout\Reader\CSV
*/
class ReaderTest extends \PHPUnit_Framework_TestCase
{
@@ -79,7 +75,6 @@ class ReaderTest extends \PHPUnit_Framework_TestCase
$reader->open($resourcePath);
}
/**
* @return void
*/
@@ -144,7 +139,9 @@ class ReaderTest extends \PHPUnit_Framework_TestCase
{
$allRows = $this->getAllRowsForFile(
'csv_with_multiple_empty_lines.csv',
',', '"', EncodingHelper::ENCODING_UTF8,
',',
'"',
EncodingHelper::ENCODING_UTF8,
$shouldPreserveEmptyRows = true
);
@@ -379,7 +376,7 @@ class ReaderTest extends \PHPUnit_Framework_TestCase
$expectedRows = [
['A', 'B', 'C'],
['1', '2', '3'],
['0', '0', '0']
['0', '0', '0'],
];
$this->assertEquals($expectedRows, $allRows, 'There should be only 3 rows, because zeros (0) are valid values');
}
@@ -395,7 +392,7 @@ class ReaderTest extends \PHPUnit_Framework_TestCase
$expectedRows = [
['A', 'B', 'C'],
['0', '', ''],
['1', '1', '']
['1', '1', ''],
];
$this->assertEquals($expectedRows, $allRows, 'There should be 3 rows, with equal length');
}
@@ -490,8 +487,8 @@ class ReaderTest extends \PHPUnit_Framework_TestCase
$fieldDelimiter = ',',
$fieldEnclosure = '"',
$encoding = EncodingHelper::ENCODING_UTF8,
$shouldPreserveEmptyRows = false)
{
$shouldPreserveEmptyRows = false
) {
$allRows = [];
$resourcePath = $this->getResourcePath($fileName);
@@ -514,5 +511,4 @@ class ReaderTest extends \PHPUnit_Framework_TestCase
return $allRows;
}
}
-2
View File
@@ -8,8 +8,6 @@ use Box\Spout\TestUsingResource;
/**
* Class SheetTest
*
* @package Box\Spout\Reader\CSV
*/
class SheetTest extends \PHPUnit_Framework_TestCase
{
+4 -3
View File
@@ -6,8 +6,6 @@ namespace Box\Spout\Reader\CSV;
* Class SpoutTestStream
* Custom stream that reads CSV files located in the tests/resources/csv folder.
* For example: spout://foobar will point to tests/resources/csv/foobar.csv
*
* @package Box\Spout\Reader\CSV
*/
class SpoutTestStream
{
@@ -30,6 +28,7 @@ class SpoutTestStream
public function url_stat($path, $flag)
{
$filePath = $this->getFilePathFromStreamPath($path);
return stat($filePath);
}
@@ -40,6 +39,7 @@ class SpoutTestStream
private function getFilePathFromStreamPath($streamPath)
{
$fileName = parse_url($streamPath, PHP_URL_HOST);
return self::PATH_TO_CSV_RESOURCES . $fileName . self::CSV_EXTENSION;
}
@@ -68,6 +68,7 @@ class SpoutTestStream
public function stream_read($numBytes)
{
$this->position += $numBytes;
return fread($this->fileHandle, $numBytes);
}
@@ -93,7 +94,7 @@ class SpoutTestStream
if ($whence === SEEK_SET) {
$this->position = $offset;
} else if ($whence === SEEK_CUR) {
} elseif ($whence === SEEK_CUR) {
$this->position += $offset;
} else {
// not implemented
+6 -10
View File
@@ -9,8 +9,6 @@ use Box\Spout\TestUsingResource;
/**
* Class ReaderTest
*
* @package Box\Spout\Reader\ODS
*/
class ReaderTest extends \PHPUnit_Framework_TestCase
{
@@ -134,9 +132,9 @@ class ReaderTest extends \PHPUnit_Framework_TestCase
$allRows = $this->getAllRowsForFile($fileName);
$expectedRows = [
['header1','header2','header3','header4'],
['val11','val12','val13','val14'],
['val21','','val23','val23'],
['header1', 'header2', 'header3', 'header4'],
['val11', 'val12', 'val13', 'val14'],
['val21', '', 'val23', 'val23'],
['', 10.43, 29.11],
];
@@ -150,7 +148,6 @@ class ReaderTest extends \PHPUnit_Framework_TestCase
$this->assertEquals($expectedRows, $allRows);
}
/**
* @return void
*/
@@ -278,7 +275,6 @@ class ReaderTest extends \PHPUnit_Framework_TestCase
$this->assertEquals([$expectedRow], $allRows);
}
/**
* @NOTE: The LIBXML_NOENT is used to ACTUALLY substitute entities (and should therefore not be used)
*
@@ -450,7 +446,7 @@ class ReaderTest extends \PHPUnit_Framework_TestCase
$expectedRows = [
['A', 'B', 'C'],
['1', '2', '3'],
['0', '0', '0']
['0', '0', '0'],
];
$this->assertEquals($expectedRows, $allRows, 'There should be only 3 rows, because zeros (0) are valid values');
}
@@ -466,7 +462,7 @@ class ReaderTest extends \PHPUnit_Framework_TestCase
$expectedRows = [
['A', 'B', 'C'],
['0', '', ''],
['1', '1', '']
['1', '1', ''],
];
$this->assertEquals($expectedRows, $allRows, 'There should be 3 rows, with equal length');
}
@@ -513,7 +509,7 @@ class ReaderTest extends \PHPUnit_Framework_TestCase
$allRows = $this->getAllRowsForFile('sheet_with_inline_font_formatting.ods');
$expectedRows = [
['I am a yellow bird']
['I am a yellow bird'],
];
$this->assertEquals($expectedRows, $allRows, 'Text formatted inline should be read');
-2
View File
@@ -8,8 +8,6 @@ use Box\Spout\TestUsingResource;
/**
* Class SheetTest
*
* @package Box\Spout\Reader\ODS
*/
class SheetTest extends \PHPUnit_Framework_TestCase
{
-2
View File
@@ -4,8 +4,6 @@ namespace Box\Spout\Reader;
/**
* Class ReaderFactoryTest
*
* @package Box\Spout\Writer
*/
class ReaderFactoryTest extends \PHPUnit_Framework_TestCase
{
@@ -3,12 +3,9 @@
namespace Box\Spout\Reader\Wrapper;
use Box\Spout\TestUsingResource;
use Box\Spout\Reader\Exception\XMLProcessingException;
/**
* Class XMLReaderTest
*
* @package Box\Spout\Reader\Wrapper
*/
class XMLReaderTest extends \PHPUnit_Framework_TestCase
{
@@ -4,8 +4,6 @@ namespace Box\Spout\Reader\XLSX\Helper;
/**
* Class CellHelperTest
*
* @package Box\Spout\Reader\XLSX\Helper
*/
class CellHelperTest extends \PHPUnit_Framework_TestCase
{
@@ -15,9 +13,9 @@ class CellHelperTest extends \PHPUnit_Framework_TestCase
public function dataProviderForTestFillMissingArrayIndexes()
{
return [
[ null, [] ],
[ [], [] ],
[ [1 => 1, 3 => 3], ['FILL', 1, 'FILL', 3] ]
[null, []],
[[], []],
[[1 => 1, 3 => 3], ['FILL', 1, 'FILL', 3]],
];
}
@@ -6,8 +6,6 @@ use Box\Spout\Common\Helper\Escaper;
/**
* Class CellValueFormatterTest
*
* @package Box\Spout\Reader\XLSX\Helper
*/
class CellValueFormatterTest extends \PHPUnit_Framework_TestCase
{
@@ -47,7 +45,7 @@ class CellValueFormatterTest extends \PHPUnit_Framework_TestCase
->expects($this->atLeastOnce())
->method('item')
->with(0)
->will($this->returnValue((object)['nodeValue' => $nodeValue]));
->will($this->returnValue((object) ['nodeValue' => $nodeValue]));
$nodeMock = $this->getMockBuilder('DOMElement')->disableOriginalConstructor()->getMock();
@@ -162,7 +160,7 @@ class CellValueFormatterTest extends \PHPUnit_Framework_TestCase
->expects($this->atLeastOnce())
->method('item')
->with(0)
->will($this->returnValue((object)['nodeValue' => $value]));
->will($this->returnValue((object) ['nodeValue' => $value]));
$nodeMock = $this->getMockBuilder('DOMElement')->disableOriginalConstructor()->getMock();
$nodeMock
@@ -4,8 +4,6 @@ namespace Box\Spout\Reader\XLSX\Helper;
/**
* Class DateFormatHelperTest
*
* @package Box\Spout\Reader\XLSX\Helper
*/
class DateFormatHelperTest extends \PHPUnit_Framework_TestCase
{
@@ -6,8 +6,6 @@ use Box\Spout\Reader\XLSX\Creator\HelperFactory;
/**
* Class CachingStrategyFactoryTest
*
* @package Box\Spout\Reader\XLSX\Manager\SharedStringsCaching
*/
class CachingStrategyFactoryTest extends \PHPUnit_Framework_TestCase
{
@@ -21,9 +19,9 @@ class CachingStrategyFactoryTest extends \PHPUnit_Framework_TestCase
[CachingStrategyFactory::MAX_NUM_STRINGS_PER_TEMP_FILE, -1, 'FileBasedStrategy'],
[CachingStrategyFactory::MAX_NUM_STRINGS_PER_TEMP_FILE + 10, -1, 'FileBasedStrategy'],
[CachingStrategyFactory::MAX_NUM_STRINGS_PER_TEMP_FILE - 10, -1, 'InMemoryStrategy'],
[10 , CachingStrategyFactory::AMOUNT_MEMORY_NEEDED_PER_STRING_IN_KB * 10, 'FileBasedStrategy'],
[10, CachingStrategyFactory::AMOUNT_MEMORY_NEEDED_PER_STRING_IN_KB * 10, 'FileBasedStrategy'],
[15, CachingStrategyFactory::AMOUNT_MEMORY_NEEDED_PER_STRING_IN_KB * 10, 'FileBasedStrategy'],
[5 , CachingStrategyFactory::AMOUNT_MEMORY_NEEDED_PER_STRING_IN_KB * 10, 'InMemoryStrategy'],
[5, CachingStrategyFactory::AMOUNT_MEMORY_NEEDED_PER_STRING_IN_KB * 10, 'InMemoryStrategy'],
];
}
@@ -12,8 +12,6 @@ use Box\Spout\TestUsingResource;
/**
* Class SharedStringsManagerTest
*
* @package Box\Spout\Reader\XLSX\Manager
*/
class SharedStringsManagerTest extends \PHPUnit_Framework_TestCase
{
@@ -9,12 +9,9 @@ use Box\Spout\Reader\XLSX\Manager\SharedStringsCaching\CachingStrategyFactory;
/**
* Class StyleManagerTest
*
* @package Box\Spout\Reader\XLSX\Manager
*/
class StyleManagerTest extends \PHPUnit_Framework_TestCase
{
/**
* @param array $styleAttributes
* @param array $customNumberFormats
+5 -9
View File
@@ -9,8 +9,6 @@ use Box\Spout\TestUsingResource;
/**
* Class ReaderTest
*
* @package Box\Spout\Reader\XLSX
*/
class ReaderTest extends \PHPUnit_Framework_TestCase
{
@@ -51,7 +49,7 @@ class ReaderTest extends \PHPUnit_Framework_TestCase
['one_sheet_with_shared_strings.xlsx', 5, 5],
['one_sheet_with_inline_strings.xlsx', 5, 5],
['two_sheets_with_shared_strings.xlsx', 10, 5],
['two_sheets_with_inline_strings.xlsx', 10, 5]
['two_sheets_with_inline_strings.xlsx', 10, 5],
];
}
@@ -236,7 +234,7 @@ class ReaderTest extends \PHPUnit_Framework_TestCase
\DateTime::createFromFormat('Y-m-d H:i:s', '1900-02-28 23:59:59'),
\DateTime::createFromFormat('Y-m-d H:i:s', '1900-03-01 00:00:00'),
\DateTime::createFromFormat('Y-m-d H:i:s', '1900-02-28 11:00:00'), // 1900-02-29 should be converted to 1900-02-28
]
],
];
$this->assertEquals($expectedRows, $allRows);
}
@@ -258,7 +256,7 @@ class ReaderTest extends \PHPUnit_Framework_TestCase
\DateTime::createFromFormat('Y-m-d H:i:s', '1900-01-01 23:29:00'),
\DateTime::createFromFormat('Y-m-d H:i:s', '1900-01-01 01:42:25'),
\DateTime::createFromFormat('Y-m-d H:i:s', '1900-01-01 13:42:25'),
]
],
];
$this->assertEquals($expectedRows, $allRows);
}
@@ -579,7 +577,7 @@ class ReaderTest extends \PHPUnit_Framework_TestCase
$expectedRows = [
['A', 'B', 'C'],
['1', '2', '3'],
['0', '0', '0']
['0', '0', '0'],
];
$this->assertEquals($expectedRows, $allRows, 'There should be only 3 rows, because zeros (0) are valid values');
}
@@ -595,12 +593,11 @@ class ReaderTest extends \PHPUnit_Framework_TestCase
$expectedRows = [
['A', 'B', 'C'],
['0', '', ''],
['1', '1', '']
['1', '1', ''],
];
$this->assertEquals($expectedRows, $allRows, 'There should be 3 rows, with equal length');
}
/**
* https://github.com/box/spout/issues/195
* @return void
@@ -618,7 +615,6 @@ class ReaderTest extends \PHPUnit_Framework_TestCase
$this->assertEquals($expectedRows, $allRows, 'Cell values should not be trimmed');
}
/**
* @param string $fileName
* @param bool $shouldFormatDates
-2
View File
@@ -8,8 +8,6 @@ use Box\Spout\TestUsingResource;
/**
* Class SheetTest
*
* @package Box\Spout\Reader\XLSX
*/
class SheetTest extends \PHPUnit_Framework_TestCase
{