Skip to content

Commit 76fb780

Browse files
authored
CI Add PHPUnit 10 and PHP 8.3 (#656)
1 parent ad68b57 commit 76fb780

File tree

6 files changed

+55
-7
lines changed

6 files changed

+55
-7
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Exercise tests with PHPUnit 10
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- main
8+
pull_request:
9+
10+
jobs:
11+
test:
12+
name: PHP ${{ matrix.php-version }} - ${{ matrix.os }} - ${{ github.event_name }}
13+
runs-on: ${{ matrix.os }}
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
#php-version: [8.1, 8.2, 8.3]
18+
php-version: [8.3]
19+
#os: [ubuntu-22.04, windows-2022, macOS-12]
20+
os: [ubuntu-22.04]
21+
22+
steps:
23+
- name: Set git line endings
24+
if: ${{ matrix.os == 'windows-2022' }}
25+
run: |
26+
git config --system core.autocrlf false
27+
git config --system core.eol lf
28+
29+
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
30+
31+
- uses: shivammathur/setup-php@6d7209f44a25a59e904b1ee9f3b0c33ab2cd888d
32+
with:
33+
php-version: ${{ matrix.php-version }}
34+
extensions: gmp
35+
36+
- name: Install dependencies
37+
shell: bash
38+
run: |
39+
curl -Lo ./bin/phpunit-10.phar https://phar.phpunit.de/phpunit-10.phar
40+
chmod +x bin/phpunit-10.phar
41+
42+
- name: Test exercises
43+
continue-on-error: true
44+
shell: bash
45+
env:
46+
PHPUNIT_BIN: 'bin/phpunit-10.phar'
47+
XDEBUG_MODE: off
48+
run: bin/test.sh

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
}
1111
},
1212
"require-dev": {
13-
"php": "^7.4|^8.0",
14-
"phpunit/phpunit": "^9.6",
13+
"php": "^7.4 || ^8.0",
14+
"phpunit/phpunit": "^9.6 || ^10.5",
1515
"slevomat/coding-standard": "^8.14.1",
1616
"squizlabs/php_codesniffer": "^3.9"
1717
},

exercises/practice/allergies/AllergiesTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public function testAllergiesToOneAllergen($allergicTo): void
6262
}, $otherAllergen);
6363
}
6464

65-
public function provideListOfAllergen(): array
65+
public static function provideListOfAllergen(): array
6666
{
6767
require_once 'Allergies.php';
6868

exercises/practice/binary/BinaryTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public function testItOnlyAcceptsStringsContainingZerosAndOnes($value): void
8282
parse_binary($value);
8383
}
8484

85-
public function invalidValues(): array
85+
public static function invalidValues(): array
8686
{
8787
return [
8888
['2'], ['12345'], ['a'], ['0abcdef'],

exercises/practice/gigasecond/GigasecondTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function dateSetup($date): DateTimeImmutable
3737
return new DateTimeImmutable($date, $UTC);
3838
}
3939

40-
public function inputAndExpectedDates(): array
40+
public static function inputAndExpectedDates(): array
4141
{
4242
return [
4343
['2011-04-25', '2043-01-01 01:46:40'],
@@ -48,7 +48,7 @@ public function inputAndExpectedDates(): array
4848
];
4949
}
5050

51-
public function inputDates(): array
51+
public static function inputDates(): array
5252
{
5353
return [
5454
['2011-04-25'],

exercises/practice/protein-translation/ProteinTranslationTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ public function testTranslationStopsIfStopCodonInMiddleOfSixCodonSequence(): voi
174174
);
175175
}
176176

177-
public function invalidCodonDataProvider(): array
177+
public static function invalidCodonDataProvider(): array
178178
{
179179
return [
180180
'Non-existing' => ['AAA'],

0 commit comments

Comments
 (0)