diff --git a/.github/workflows/continuous_integration.yml b/.github/workflows/continuous_integration.yml index b489d50..53a4c5a 100644 --- a/.github/workflows/continuous_integration.yml +++ b/.github/workflows/continuous_integration.yml @@ -17,7 +17,7 @@ jobs: - name: Setup PHP uses: shivammathur/setup-php@0f7f1d08e3e32076e51cae65eb0b0c871405b16e with: - php-version: '8.3' + php-version: '8.4' tools: composer - name: Get Composer Cache Directory diff --git a/Dockerfile b/Dockerfile index 73bdb44..92ecf20 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM php:8.3.10-cli-alpine3.20 AS build +FROM php:8.4.10-cli-alpine3.22 AS build RUN apk add --no-cache ca-certificates curl jo zip unzip @@ -9,7 +9,7 @@ RUN curl -L -o install-php-extensions \ && chmod +x install-php-extensions \ && install-php-extensions ds-^1@stable intl -COPY --from=composer:2.7.7 /usr/bin/composer /usr/local/bin/composer +COPY --from=composer:2.8.9 /usr/bin/composer /usr/local/bin/composer WORKDIR /opt/test-runner COPY . . @@ -23,7 +23,7 @@ RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini" \ COMPOSER_ALLOW_SUPERUSER=1 \ composer install --no-cache --no-dev --no-interaction --no-progress -FROM php:8.3.10-cli-alpine3.20 AS runtime +FROM php:8.4.10-cli-alpine3.22 AS runtime COPY --from=build /usr/bin/jo /usr/bin/jo COPY --from=build /usr/local/lib/php/extensions /usr/local/lib/php/extensions diff --git a/README.md b/README.md index 92fcea0..343166a 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ It meets the complete spec for testing all exercises. ### Docker image The website uses isolated Docker images to run untrusted code in a sandbox. -The image provided by this repository consists of PHP 8.3.10 (PHPUnit 10). +The image provided by this repository consists of PHP 8.4.10 (PHPUnit 11). All final assets are built into the image, because the image does not have network access once in use. Includes PHP extensions: ds, intl diff --git a/composer.json b/composer.json index b4d77ca..9b0be5e 100644 --- a/composer.json +++ b/composer.json @@ -8,13 +8,13 @@ } }, "require": { - "php": "^8.3", - "phpunit/phpunit": "^10.5.29" + "php": "^8.4", + "phpunit/phpunit": "^11.5.26" }, "require-dev": { - "phpstan/phpstan": "^2.1", - "slevomat/coding-standard": "^8.14.1", - "squizlabs/php_codesniffer": "^3.12" + "phpstan/phpstan": "^2.1.17", + "slevomat/coding-standard": "^8.19.1", + "squizlabs/php_codesniffer": "^3.13.2" }, "scripts": { "phpstan": "phpstan analyse --configuration phpstan.neon --memory-limit=2G", diff --git a/tests/all-fail/HelloWorld.php b/tests/all-fail/HelloWorld.php new file mode 100644 index 0000000..2e09437 --- /dev/null +++ b/tests/all-fail/HelloWorld.php @@ -0,0 +1,6 @@ +assertEquals('Hello, World!', helloWorld()); + } + + public function testHelloWorldTwo(): void + { + $this->assertEquals('Hello, World!', helloWorld()); + } + + public function testHelloWorldThree(): void + { + $this->assertEquals('Hello, World!', helloWorld()); + } +} diff --git a/tests/all-fail/expected_results.json b/tests/all-fail/expected_results.json new file mode 100644 index 0000000..4192004 --- /dev/null +++ b/tests/all-fail/expected_results.json @@ -0,0 +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"}]} diff --git a/tests/dataProvider-error/GigasecondTest.php b/tests/dataProvider-error/GigasecondTest.php index 8b193d4..e0903b4 100644 --- a/tests/dataProvider-error/GigasecondTest.php +++ b/tests/dataProvider-error/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/tests/error-with-task-id/HelloWorld.php b/tests/error-with-task-id/HelloWorld.php new file mode 100644 index 0000000..52c7826 --- /dev/null +++ b/tests/error-with-task-id/HelloWorld.php @@ -0,0 +1,6 @@ +assertEquals('Hello, World!', helloWorld()); + } +} diff --git a/tests/error-with-task-id/expected_results.json b/tests/error-with-task-id/expected_results.json new file mode 100644 index 0000000..e3f60e3 --- /dev/null +++ b/tests/error-with-task-id/expected_results.json @@ -0,0 +1 @@ +{"version":3,"status":"fail","tests":[{"name":"Hello world","status":"error","test_code":"$this->assertEquals('Hello, World!', helloWorld());\n","task_id":99,"message":"HelloWorldTest::testHelloWorld\nBadFunctionCallException: Implement the helloWorld() function\n\nHelloWorld.php:5\nHelloWorldTest.php:15"}]} diff --git a/tests/fail-with-array/HelloWorld.php b/tests/fail-with-array/HelloWorld.php new file mode 100644 index 0000000..9203e10 --- /dev/null +++ b/tests/fail-with-array/HelloWorld.php @@ -0,0 +1,6 @@ +assertEquals(['Hello, World!'], helloWorld()); + } +} diff --git a/tests/fail-with-array/expected_results.json b/tests/fail-with-array/expected_results.json new file mode 100644 index 0000000..d285488 --- /dev/null +++ b/tests/fail-with-array/expected_results.json @@ -0,0 +1 @@ +{"version":3,"status":"fail","tests":[{"name":"Hello world","status":"fail","test_code":"$this->assertEquals(['Hello, World!'], helloWorld());\n","message":"HelloWorldTest::testHelloWorld\nFailed asserting that two arrays are equal.\n--- Expected\n+++ Actual\n@@ @@\n Array (\n- 0 => 'Hello, World!'\n+ 0 => 'Goodbye, Mars!'\n )\n\nHelloWorldTest.php:14"}]} diff --git a/tests/fail-with-task-id/HelloWorld.php b/tests/fail-with-task-id/HelloWorld.php new file mode 100644 index 0000000..2e09437 --- /dev/null +++ b/tests/fail-with-task-id/HelloWorld.php @@ -0,0 +1,6 @@ +assertEquals('Hello, World!', helloWorld()); + } +} diff --git a/tests/fail-with-task-id/expected_results.json b/tests/fail-with-task-id/expected_results.json new file mode 100644 index 0000000..d2069b1 --- /dev/null +++ b/tests/fail-with-task-id/expected_results.json @@ -0,0 +1 @@ +{"version":3,"status":"fail","tests":[{"name":"Hello world","status":"fail","test_code":"$this->assertEquals('Hello, World!', helloWorld());\n","task_id":99,"message":"HelloWorldTest::testHelloWorld\nFailed asserting that two strings are equal.\n--- Expected\n+++ Actual\n@@ @@\n-'Hello, World!'\n+'Goodbye, Mars!'\n\nHelloWorldTest.php:15"}]} diff --git a/tests/success-with-testdox-and-task-id/HelloWorld.php b/tests/success-with-testdox-and-task-id/HelloWorld.php new file mode 100644 index 0000000..a017bb7 --- /dev/null +++ b/tests/success-with-testdox-and-task-id/HelloWorld.php @@ -0,0 +1,6 @@ +assertEquals('Hello, World!', helloWorld()); + } +} diff --git a/tests/success-with-testdox-and-task-id/expected_results.json b/tests/success-with-testdox-and-task-id/expected_results.json new file mode 100644 index 0000000..d1cd18d --- /dev/null +++ b/tests/success-with-testdox-and-task-id/expected_results.json @@ -0,0 +1 @@ +{"version":3,"status":"pass","tests":[{"name":"\"Hello, World!\" from TestDox attribute","status":"pass","test_code":"$this->assertEquals('Hello, World!', helloWorld());\n","task_id":99}]} diff --git a/tests/success-with-testdox-and-uuid/HelloWorld.php b/tests/success-with-testdox-and-uuid/HelloWorld.php new file mode 100644 index 0000000..a017bb7 --- /dev/null +++ b/tests/success-with-testdox-and-uuid/HelloWorld.php @@ -0,0 +1,6 @@ +assertEquals('Hello, World!', helloWorld()); + } +} diff --git a/tests/success-with-testdox-and-uuid/expected_results.json b/tests/success-with-testdox-and-uuid/expected_results.json new file mode 100644 index 0000000..ac94f9d --- /dev/null +++ b/tests/success-with-testdox-and-uuid/expected_results.json @@ -0,0 +1 @@ +{"version":3,"status":"pass","tests":[{"name":"\"Hello, World!\" from TestDox attribute","status":"pass","test_code":"$this->assertEquals('Hello, World!', helloWorld());\n"}]} diff --git a/tests/success-with-testdox-uuid-and-task-id/HelloWorld.php b/tests/success-with-testdox-uuid-and-task-id/HelloWorld.php new file mode 100644 index 0000000..a017bb7 --- /dev/null +++ b/tests/success-with-testdox-uuid-and-task-id/HelloWorld.php @@ -0,0 +1,6 @@ +assertEquals('Hello, World!', helloWorld()); + } +} diff --git a/tests/success-with-testdox-uuid-and-task-id/expected_results.json b/tests/success-with-testdox-uuid-and-task-id/expected_results.json new file mode 100644 index 0000000..d1cd18d --- /dev/null +++ b/tests/success-with-testdox-uuid-and-task-id/expected_results.json @@ -0,0 +1 @@ +{"version":3,"status":"pass","tests":[{"name":"\"Hello, World!\" from TestDox attribute","status":"pass","test_code":"$this->assertEquals('Hello, World!', helloWorld());\n","task_id":99}]} diff --git a/tests/success-with-testdox/HelloWorld.php b/tests/success-with-testdox/HelloWorld.php new file mode 100644 index 0000000..a017bb7 --- /dev/null +++ b/tests/success-with-testdox/HelloWorld.php @@ -0,0 +1,6 @@ +assertEquals('Hello, World!', helloWorld()); + } +} diff --git a/tests/success-with-testdox/expected_results.json b/tests/success-with-testdox/expected_results.json new file mode 100644 index 0000000..ac94f9d --- /dev/null +++ b/tests/success-with-testdox/expected_results.json @@ -0,0 +1 @@ +{"version":3,"status":"pass","tests":[{"name":"\"Hello, World!\" from TestDox attribute","status":"pass","test_code":"$this->assertEquals('Hello, World!', helloWorld());\n"}]}