mirror of
https://github.com/parsecsv/parsecsv-for-php.git
synced 2026-02-19 00:36:38 +00:00
Extend test coverage to PHP 8.3
This commit is contained in:
41
.github/workflows/phpunit.yml
vendored
41
.github/workflows/phpunit.yml
vendored
@@ -4,13 +4,52 @@ on:
|
|||||||
push:
|
push:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test_php_82_and_newer:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
php_version:
|
php_version:
|
||||||
|
- "8.3"
|
||||||
- "8.2"
|
- "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.1"
|
||||||
- "8.0"
|
- "8.0"
|
||||||
- "7.4"
|
- "7.4"
|
||||||
|
|||||||
7
.gitignore
vendored
7
.gitignore
vendored
@@ -1,7 +1,14 @@
|
|||||||
*.bak
|
*.bak
|
||||||
|
.env
|
||||||
|
.envrc
|
||||||
/.idea
|
/.idea
|
||||||
|
/.vscode
|
||||||
|
/composer-setup.php
|
||||||
/composer.lock
|
/composer.lock
|
||||||
/coverage_clover.xml
|
/coverage_clover.xml
|
||||||
|
/docker-compose.yml
|
||||||
|
/examples/people.csv
|
||||||
/phive.xml
|
/phive.xml
|
||||||
|
/tests/.phpunit.result.cache
|
||||||
/tools
|
/tools
|
||||||
/vendor/
|
/vendor/
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ class DataRowCountTest extends TestCase {
|
|||||||
$this->csv = new Csv();
|
$this->csv = new Csv();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function countRowsProvider() {
|
public static function countRowsProvider() {
|
||||||
return [
|
return [
|
||||||
'auto-double-enclosure' => [
|
'auto-double-enclosure' => [
|
||||||
'auto-double-enclosure.csv',
|
'auto-double-enclosure.csv',
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ class ParseTest extends TestCase {
|
|||||||
/**
|
/**
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function autoDetectionProvider() {
|
public static function autoDetectionProvider() {
|
||||||
return [
|
return [
|
||||||
'UTF8_no_BOM' => [__DIR__ . '/../example_files/UTF-8_sep_row_but_no_BOM.csv'],
|
'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'],
|
'UTF8' => [__DIR__ . '/../example_files/UTF-8_with_BOM_and_sep_row.csv'],
|
||||||
@@ -294,7 +294,7 @@ class ParseTest extends TestCase {
|
|||||||
/**
|
/**
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function autoQuotesDataProvider(): array {
|
public static function autoQuotesDataProvider(): array {
|
||||||
return array(
|
return array(
|
||||||
array('auto-double-enclosure.csv', '"'),
|
array('auto-double-enclosure.csv', '"'),
|
||||||
array('auto-single-enclosure.csv', "'"),
|
array('auto-single-enclosure.csv', "'"),
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ class OffsetTest extends BaseClass {
|
|||||||
$this->assertEquals($expected, $actual);
|
$this->assertEquals($expected, $actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function numberRangeZeroToFourProvider() {
|
public static function numberRangeZeroToFourProvider() {
|
||||||
return array_map(function ($number) {
|
return array_map(function ($number) {
|
||||||
return [$number];
|
return [$number];
|
||||||
}, range(0, 4));
|
}, range(0, 4));
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ class SortByTest extends BaseClass {
|
|||||||
public function testSortByRating() {
|
public function testSortByRating() {
|
||||||
$this->csv->sort_by = 'rating';
|
$this->csv->sort_by = 'rating';
|
||||||
$this->csv->conditions = 'title does not contain Blood';
|
$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([
|
$this->_compareWithExpected([
|
||||||
// Rating 0
|
// Rating 0
|
||||||
'The Killing Kind',
|
'The Killing Kind',
|
||||||
|
|||||||
17
tests/rector.php
Normal file
17
tests/rector.php
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
use Rector\Config\RectorConfig;
|
||||||
|
use Rector\PHPUnit\CodeQuality\Rector\Class_\AddCoversClassAttributeRector;
|
||||||
|
use Rector\PHPUnit\AnnotationsToAttributes\Rector\ClassMethod\DataProviderAnnotationToAttributeRector;
|
||||||
|
use Rector\PHPUnit\PHPUnit60\Rector\ClassMethod\AddDoesNotPerformAssertionToNonAssertingTestRector;
|
||||||
|
use Rector\PHPUnit\AnnotationsToAttributes\Rector\ClassMethod\DependsAnnotationWithValueToAttributeRector;
|
||||||
|
use \Rector\Php80\Rector\Class_\AnnotationToAttributeRector;
|
||||||
|
|
||||||
|
return static function(RectorConfig $rectorConfig): void {
|
||||||
|
$rectorConfig->rule(AddCoversClassAttributeRector::class);
|
||||||
|
$rectorConfig->rule(DataProviderAnnotationToAttributeRector::class);
|
||||||
|
$rectorConfig->rule(AddDoesNotPerformAssertionToNonAssertingTestRector::class);
|
||||||
|
$rectorConfig->rule(DependsAnnotationWithValueToAttributeRector::class);
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user