Skip to content

Commit

Permalink
CI Add PHPUnit 10 and PHP 8.3 (#656)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasnorre authored Mar 4, 2024
1 parent ad68b57 commit 76fb780
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 7 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/exercise-tests-phpunit-10.yml
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
2 changes: 1 addition & 1 deletion exercises/practice/allergies/AllergiesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function testAllergiesToOneAllergen($allergicTo): void
}, $otherAllergen);
}

public function provideListOfAllergen(): array
public static function provideListOfAllergen(): array
{
require_once 'Allergies.php';

Expand Down
2 changes: 1 addition & 1 deletion exercises/practice/binary/BinaryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
Expand Down
4 changes: 2 additions & 2 deletions exercises/practice/gigasecond/GigasecondTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
Expand All @@ -48,7 +48,7 @@ public function inputAndExpectedDates(): array
];
}

public function inputDates(): array
public static function inputDates(): array
{
return [
['2011-04-25'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ public function testTranslationStopsIfStopCodonInMiddleOfSixCodonSequence(): voi
);
}

public function invalidCodonDataProvider(): array
public static function invalidCodonDataProvider(): array
{
return [
'Non-existing' => ['AAA'],
Expand Down

0 comments on commit 76fb780

Please sign in to comment.