Skip to content

Commit e54bd27

Browse files
authored
Use PHP 8.4 and PHPUnit 11 (#157)
1 parent 4406922 commit e54bd27

29 files changed

+226
-12
lines changed

.github/workflows/continuous_integration.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
- name: Setup PHP
1818
uses: shivammathur/setup-php@0f7f1d08e3e32076e51cae65eb0b0c871405b16e
1919
with:
20-
php-version: '8.3'
20+
php-version: '8.4'
2121
tools: composer
2222

2323
- name: Get Composer Cache Directory

Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM php:8.3.10-cli-alpine3.20 AS build
1+
FROM php:8.4.10-cli-alpine3.22 AS build
22

33
RUN apk add --no-cache ca-certificates curl jo zip unzip
44

@@ -9,7 +9,7 @@ RUN curl -L -o install-php-extensions \
99
&& chmod +x install-php-extensions \
1010
&& install-php-extensions ds-^1@stable intl
1111

12-
COPY --from=composer:2.7.7 /usr/bin/composer /usr/local/bin/composer
12+
COPY --from=composer:2.8.9 /usr/bin/composer /usr/local/bin/composer
1313

1414
WORKDIR /opt/test-runner
1515
COPY . .
@@ -23,7 +23,7 @@ RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini" \
2323
COMPOSER_ALLOW_SUPERUSER=1 \
2424
composer install --no-cache --no-dev --no-interaction --no-progress
2525

26-
FROM php:8.3.10-cli-alpine3.20 AS runtime
26+
FROM php:8.4.10-cli-alpine3.22 AS runtime
2727

2828
COPY --from=build /usr/bin/jo /usr/bin/jo
2929
COPY --from=build /usr/local/lib/php/extensions /usr/local/lib/php/extensions

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ It meets the complete spec for testing all exercises.
1010
### Docker image
1111

1212
The website uses isolated Docker images to run untrusted code in a sandbox.
13-
The image provided by this repository consists of PHP 8.3.10 (PHPUnit 10).
13+
The image provided by this repository consists of PHP 8.4.10 (PHPUnit 11).
1414
All final assets are built into the image, because the image does not have network access once in use.
1515

1616
Includes PHP extensions: ds, intl

composer.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88
}
99
},
1010
"require": {
11-
"php": "^8.3",
12-
"phpunit/phpunit": "^10.5.29"
11+
"php": "^8.4",
12+
"phpunit/phpunit": "^11.5.26"
1313
},
1414
"require-dev": {
15-
"phpstan/phpstan": "^2.1",
16-
"slevomat/coding-standard": "^8.14.1",
17-
"squizlabs/php_codesniffer": "^3.12"
15+
"phpstan/phpstan": "^2.1.17",
16+
"slevomat/coding-standard": "^8.19.1",
17+
"squizlabs/php_codesniffer": "^3.13.2"
1818
},
1919
"scripts": {
2020
"phpstan": "phpstan analyse --configuration phpstan.neon --memory-limit=2G",

tests/all-fail/HelloWorld.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?php
2+
3+
function helloWorld()
4+
{
5+
return "Goodbye, Mars!";
6+
}

tests/all-fail/HelloWorldTest.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
class HelloWorldTest extends PHPUnit\Framework\TestCase
6+
{
7+
public static function setUpBeforeClass(): void
8+
{
9+
require_once 'HelloWorld.php';
10+
}
11+
12+
public function testHelloWorldOne(): void
13+
{
14+
$this->assertEquals('Hello, World!', helloWorld());
15+
}
16+
17+
public function testHelloWorldTwo(): void
18+
{
19+
$this->assertEquals('Hello, World!', helloWorld());
20+
}
21+
22+
public function testHelloWorldThree(): void
23+
{
24+
$this->assertEquals('Hello, World!', helloWorld());
25+
}
26+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"version":3,"status":"fail","tests":[{"name":"Hello world one","status":"fail","test_code":"$this->assertEquals('Hello, World!', helloWorld());\n","message":"HelloWorldTest::testHelloWorldOne\nFailed asserting that two strings are equal.\n--- Expected\n+++ Actual\n@@ @@\n-'Hello, World!'\n+'Goodbye, Mars!'\n\nHelloWorldTest.php:14"},{"name":"Hello world two","status":"fail","test_code":"$this->assertEquals('Hello, World!', helloWorld());\n","message":"HelloWorldTest::testHelloWorldTwo\nFailed asserting that two strings are equal.\n--- Expected\n+++ Actual\n@@ @@\n-'Hello, World!'\n+'Goodbye, Mars!'\n\nHelloWorldTest.php:19"},{"name":"Hello world three","status":"fail","test_code":"$this->assertEquals('Hello, World!', helloWorld());\n","message":"HelloWorldTest::testHelloWorldThree\nFailed asserting that two strings are equal.\n--- Expected\n+++ Actual\n@@ @@\n-'Hello, World!'\n+'Goodbye, Mars!'\n\nHelloWorldTest.php:24"}]}

tests/dataProvider-error/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'],
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?php
2+
3+
function helloWorld()
4+
{
5+
throw new \BadFunctionCallException("Implement the helloWorld() function");
6+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
class HelloWorldTest extends PHPUnit\Framework\TestCase
6+
{
7+
public static function setUpBeforeClass(): void
8+
{
9+
require_once 'HelloWorld.php';
10+
}
11+
12+
/** @task_id 99 */
13+
public function testHelloWorld(): void
14+
{
15+
$this->assertEquals('Hello, World!', helloWorld());
16+
}
17+
}

0 commit comments

Comments
 (0)