diff --git a/.github/workflows/exercise-tests-phpunit-10.yml b/.github/workflows/exercise-tests-phpunit-10.yml new file mode 100644 index 00000000..65658fcf --- /dev/null +++ b/.github/workflows/exercise-tests-phpunit-10.yml @@ -0,0 +1,48 @@ +name: Exercise tests with PHPUnit 10 + +on: + workflow_dispatch: + push: + branches: + - main + pull_request: + +jobs: + test: + name: PHP ${{ matrix.php-version }} - ${{ matrix.os }} - ${{ github.event_name }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + #php-version: [8.1, 8.2, 8.3] + php-version: [8.3] + #os: [ubuntu-22.04, windows-2022, macOS-12] + os: [ubuntu-22.04] + + steps: + - name: Set git line endings + if: ${{ matrix.os == 'windows-2022' }} + run: | + git config --system core.autocrlf false + git config --system core.eol lf + + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + + - uses: shivammathur/setup-php@6d7209f44a25a59e904b1ee9f3b0c33ab2cd888d + with: + php-version: ${{ matrix.php-version }} + extensions: gmp + + - name: Install dependencies + shell: bash + run: | + curl -Lo ./bin/phpunit-10.phar https://phar.phpunit.de/phpunit-10.phar + chmod +x bin/phpunit-10.phar + + - name: Test exercises + continue-on-error: true + shell: bash + env: + PHPUNIT_BIN: 'bin/phpunit-10.phar' + XDEBUG_MODE: off + run: bin/test.sh diff --git a/composer.json b/composer.json index 38dd195f..97f5ea4d 100644 --- a/composer.json +++ b/composer.json @@ -10,8 +10,8 @@ } }, "require-dev": { - "php": "^7.4|^8.0", - "phpunit/phpunit": "^9.6", + "php": "^7.4 || ^8.0", + "phpunit/phpunit": "^9.6 || ^10.5", "slevomat/coding-standard": "^8.14.1", "squizlabs/php_codesniffer": "^3.9" }, diff --git a/exercises/practice/allergies/AllergiesTest.php b/exercises/practice/allergies/AllergiesTest.php index 7c5ebad7..4189d33a 100644 --- a/exercises/practice/allergies/AllergiesTest.php +++ b/exercises/practice/allergies/AllergiesTest.php @@ -62,7 +62,7 @@ public function testAllergiesToOneAllergen($allergicTo): void }, $otherAllergen); } - public function provideListOfAllergen(): array + public static function provideListOfAllergen(): array { require_once 'Allergies.php'; diff --git a/exercises/practice/binary/BinaryTest.php b/exercises/practice/binary/BinaryTest.php index a9ddf7dc..ae7311ff 100644 --- a/exercises/practice/binary/BinaryTest.php +++ b/exercises/practice/binary/BinaryTest.php @@ -82,7 +82,7 @@ public function testItOnlyAcceptsStringsContainingZerosAndOnes($value): void parse_binary($value); } - public function invalidValues(): array + public static function invalidValues(): array { return [ ['2'], ['12345'], ['a'], ['0abcdef'], diff --git a/exercises/practice/gigasecond/GigasecondTest.php b/exercises/practice/gigasecond/GigasecondTest.php index 6f2bee16..4bfdee03 100644 --- a/exercises/practice/gigasecond/GigasecondTest.php +++ b/exercises/practice/gigasecond/GigasecondTest.php @@ -37,7 +37,7 @@ public function dateSetup($date): DateTimeImmutable return new DateTimeImmutable($date, $UTC); } - public function inputAndExpectedDates(): array + public static function inputAndExpectedDates(): array { return [ ['2011-04-25', '2043-01-01 01:46:40'], @@ -48,7 +48,7 @@ public function inputAndExpectedDates(): array ]; } - public function inputDates(): array + public static function inputDates(): array { return [ ['2011-04-25'], diff --git a/exercises/practice/protein-translation/ProteinTranslationTest.php b/exercises/practice/protein-translation/ProteinTranslationTest.php index d5452d30..f53799e1 100644 --- a/exercises/practice/protein-translation/ProteinTranslationTest.php +++ b/exercises/practice/protein-translation/ProteinTranslationTest.php @@ -174,7 +174,7 @@ public function testTranslationStopsIfStopCodonInMiddleOfSixCodonSequence(): voi ); } - public function invalidCodonDataProvider(): array + public static function invalidCodonDataProvider(): array { return [ 'Non-existing' => ['AAA'],