Upgrade PHP and dev dependencies

/!\ Removed PHP 7.2 support /!\

- PHPUnit 8 => 9 (+ fix the tests)
- PHP-CS-Fixer 2 => 3 (+ fix the code)
- Introduced PHP stan
This commit is contained in:
Adrien Loison committed 2022-01-12 23:38:25 +01:00
1 parent 6a10ec3586
commit 6b7366bb6f
46 files changed
+247 -251

No files matched your search

@@ -10,7 +10,7 @@ use PHPUnit\Framework\TestCase;
class CellTypeHelperTest extends TestCase
{
/**
* @return array
* @return void
*/
public function testIsEmpty()
{
@@ -27,7 +27,7 @@ class CellTypeHelperTest extends TestCase
}
/**
* @return array
* @return void
*/
public function testIsNonEmptyString()
{
@@ -44,7 +44,7 @@ class CellTypeHelperTest extends TestCase
}
/**
* @return array
* @return void
*/
public function testIsNumeric()
{
@@ -66,7 +66,7 @@ class CellTypeHelperTest extends TestCase
}
/**
* @return array
* @return void
*/
public function testIsBoolean()
{
+3 -3
View File
@@ -9,10 +9,10 @@ namespace Box\Spout\Reader\CSV;
*/
class SpoutTestStream
{
const CLASS_NAME = __CLASS__;
public const CLASS_NAME = __CLASS__;
const PATH_TO_CSV_RESOURCES = 'tests/resources/csv/';
const CSV_EXTENSION = '.csv';
public const PATH_TO_CSV_RESOURCES = 'tests/resources/csv/';
public const CSV_EXTENSION = '.csv';
/** @var int */
private $position;
@@ -46,7 +46,7 @@ class CachingStrategyFactoryTest extends TestCase
$factoryStub->method('getMemoryLimitInKB')->willReturn($memoryLimitInKB);
$tempFolder = sys_get_temp_dir();
$helperFactory = new HelperFactory($factoryStub);
$helperFactory = new HelperFactory();
$strategy = $factoryStub->createBestCachingStrategy($sharedStringsUniqueCount, $tempFolder, $helperFactory);
$fullExpectedStrategyClassName = 'Box\Spout\Reader\XLSX\Manager\SharedStringsCaching\\' . $expectedStrategyClassName;
+1 -1
View File
@@ -62,7 +62,7 @@ class ReflectionHelper
// to prevent side-effects in later tests, we need to remember the original value and reset it on tear down
// @NOTE: we need to check isset in case the original value was null or array()
if ($saveOriginalValue && (!isset(self::$privateVarsToReset[$class]) || !isset(self::$privateVarsToReset[$class][$name]))) {
if ($saveOriginalValue && (!isset(self::$privateVarsToReset[$class]) || !isset(self::$privateVarsToReset[$class][$valueName]))) {
self::$privateVarsToReset[$class][$valueName] = $reflectionProperty->getValue();
}
$reflectionProperty->setValue($value);
+1 -1
View File
@@ -95,7 +95,7 @@ class SheetTest extends TestCase
/**
* @param string $fileName
* @param string $sheetName
* @return Sheet
* @return void
*/
private function writeDataAndReturnSheetWithCustomName($fileName, $sheetName)
{
+1 -1
View File
@@ -132,7 +132,7 @@ class WriterTest extends TestCase
$writer->addRows($dataRows);
$this->fail('Exception should have been thrown');
} catch (SpoutException $e) {
$this->assertFileNotExists($fileName, 'Output file should have been deleted');
$this->assertFileDoesNotExist($fileName, 'Output file should have been deleted');
$numFiles = iterator_count(new \FilesystemIterator($tempFolderPath, \FilesystemIterator::SKIP_DOTS));
$this->assertEquals(0, $numFiles, 'All temp files should have been deleted');
+1 -1
View File
@@ -163,7 +163,7 @@ class WriterTest extends TestCase
$writer->addRows($dataRows);
$this->fail('Exception should have been thrown');
} catch (SpoutException $e) {
$this->assertFileNotExists($fileName, 'Output file should have been deleted');
$this->assertFileDoesNotExist($fileName, 'Output file should have been deleted');
$numFiles = iterator_count(new \FilesystemIterator($tempFolderPath, \FilesystemIterator::SKIP_DOTS));
$this->assertEquals(0, $numFiles, 'All temp files should have been deleted');