diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml index 06c9759..caa6ffb 100644 --- a/.github/workflows/phpunit.yml +++ b/.github/workflows/phpunit.yml @@ -4,13 +4,52 @@ on: push: jobs: - test: + test_php_82_and_newer: runs-on: ubuntu-latest strategy: fail-fast: false matrix: php_version: + - "8.3" - "8.2" + steps: + - uses: actions/checkout@v3 + - uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php_version }} + env: + COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Get composer cache directory + id: composer-cache + run: echo "::set-output name=dir::$(composer config cache-files-dir)" + - name: Cache composer dependencies + uses: actions/cache@v2 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} + restore-keys: ${{ runner.os }}-composer- + - name: Update PHPUnit + run: composer require phpunit/phpunit --dev -W + - name: Install dependencies + run: composer update + - name: Validate dependencies + run: composer validate + - name: install Rector + run: composer require rector/rector --dev -W + - name: run Rector + run: cd tests && ../vendor/bin/phpunit --migrate-configuration + shell: bash + - name: run Rector + run: cd tests && ../vendor/bin/rector process . + shell: bash + - name: Run tests + run: vendor/bin/phpunit --configuration tests/phpunit.xml + test_php_81_and_lower: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + php_version: - "8.1" - "8.0" - "7.4" diff --git a/.gitignore b/.gitignore index a3b69ef..439b338 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,14 @@ *.bak +.env +.envrc /.idea +/.vscode +/composer-setup.php /composer.lock /coverage_clover.xml +/docker-compose.yml +/examples/people.csv /phive.xml +/tests/.phpunit.result.cache /tools /vendor/ diff --git a/tests/methods/DataRowCountTest.php b/tests/methods/DataRowCountTest.php index aa7c89f..8359263 100644 --- a/tests/methods/DataRowCountTest.php +++ b/tests/methods/DataRowCountTest.php @@ -21,7 +21,7 @@ class DataRowCountTest extends TestCase { $this->csv = new Csv(); } - public function countRowsProvider() { + public static function countRowsProvider() { return [ 'auto-double-enclosure' => [ 'auto-double-enclosure.csv', diff --git a/tests/methods/ParseTest.php b/tests/methods/ParseTest.php index cf00fc8..eae4bec 100644 --- a/tests/methods/ParseTest.php +++ b/tests/methods/ParseTest.php @@ -63,7 +63,7 @@ class ParseTest extends TestCase { /** * @return array */ - public function autoDetectionProvider() { + public static function autoDetectionProvider() { return [ 'UTF8_no_BOM' => [__DIR__ . '/../example_files/UTF-8_sep_row_but_no_BOM.csv'], 'UTF8' => [__DIR__ . '/../example_files/UTF-8_with_BOM_and_sep_row.csv'], @@ -294,7 +294,7 @@ class ParseTest extends TestCase { /** * @return array */ - public function autoQuotesDataProvider(): array { + public static function autoQuotesDataProvider(): array { return array( array('auto-double-enclosure.csv', '"'), array('auto-single-enclosure.csv', "'"), diff --git a/tests/properties/OffsetTest.php b/tests/properties/OffsetTest.php index a633792..7657222 100644 --- a/tests/properties/OffsetTest.php +++ b/tests/properties/OffsetTest.php @@ -25,7 +25,7 @@ class OffsetTest extends BaseClass { $this->assertEquals($expected, $actual); } - public function numberRangeZeroToFourProvider() { + public static function numberRangeZeroToFourProvider() { return array_map(function ($number) { return [$number]; }, range(0, 4)); diff --git a/tests/properties/SortByTest.php b/tests/properties/SortByTest.php index efdab03..7e1a2fe 100644 --- a/tests/properties/SortByTest.php +++ b/tests/properties/SortByTest.php @@ -7,7 +7,7 @@ class SortByTest extends BaseClass { public function testSortByRating() { $this->csv->sort_by = 'rating'; $this->csv->conditions = 'title does not contain Blood'; - if (!preg_match('/^8\.2\./', phpversion())) + if (!preg_match('/^8\.2\./', phpversion()) && !preg_match('/^8\.3\./', phpversion())) $this->_compareWithExpected([ // Rating 0 'The Killing Kind', diff --git a/tests/rector.php b/tests/rector.php new file mode 100644 index 0000000..5878741 --- /dev/null +++ b/tests/rector.php @@ -0,0 +1,17 @@ +rule(AddCoversClassAttributeRector::class); + $rectorConfig->rule(DataProviderAnnotationToAttributeRector::class); + $rectorConfig->rule(AddDoesNotPerformAssertionToNonAssertingTestRector::class); + $rectorConfig->rule(DependsAnnotationWithValueToAttributeRector::class); +};