From 30b037105951ccd827a1033d934f0a1210daabd1 Mon Sep 17 00:00:00 2001 From: Michael Kramer Date: Sat, 4 May 2024 14:25:14 +0200 Subject: [PATCH 1/7] All PHP versions and OSses in PHPUnit 10 workflow --- .github/workflows/exercise-tests-phpunit-10.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/exercise-tests-phpunit-10.yml b/.github/workflows/exercise-tests-phpunit-10.yml index 2c777740d..72c720433 100644 --- a/.github/workflows/exercise-tests-phpunit-10.yml +++ b/.github/workflows/exercise-tests-phpunit-10.yml @@ -14,10 +14,8 @@ jobs: 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] + php-version: [8.1, 8.2, 8.3] + os: [ubuntu-22.04, windows-2022, macOS-14] steps: - name: Set git line endings From b0a8a73db70486682215cb67a844b51bbb2177cb Mon Sep 17 00:00:00 2001 From: Michael Kramer Date: Sat, 4 May 2024 15:12:02 +0200 Subject: [PATCH 2/7] Do not test with PHPUnit 9 / PHP 8.0 anymore --- .../workflows/exercise-tests-phpunit-9.yml | 45 ------------------- 1 file changed, 45 deletions(-) delete mode 100644 .github/workflows/exercise-tests-phpunit-9.yml diff --git a/.github/workflows/exercise-tests-phpunit-9.yml b/.github/workflows/exercise-tests-phpunit-9.yml deleted file mode 100644 index 4746e824c..000000000 --- a/.github/workflows/exercise-tests-phpunit-9.yml +++ /dev/null @@ -1,45 +0,0 @@ -name: Exercise tests with PHPUnit 9 - -on: - workflow_dispatch: - push: - branches: - - main - - master - 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.0, 8.1, 8.2] - os: [ubuntu-22.04, windows-2022] - - 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@0ad4b8fadaa221de15dcec353f45205ec38ea70b - - - uses: shivammathur/setup-php@c665c7a15b5295c2488ac8a87af9cb806cd72198 - with: - php-version: ${{ matrix.php-version }} - extensions: gmp - - - name: Install dependencies - shell: bash - run: | - curl -Lo ./bin/phpunit-9.phar https://phar.phpunit.de/phpunit-9.phar - chmod +x bin/phpunit-9.phar - - - name: Test exercises\ - shell: bash - env: - PHPUNIT_BIN: 'bin/phpunit-9.phar' - run: bin/test.sh From f6516f27d9fe510cd6be54a240c78d6a6d1b722d Mon Sep 17 00:00:00 2001 From: Michael Kramer Date: Sat, 4 May 2024 15:44:00 +0200 Subject: [PATCH 3/7] Update track documentation --- README.md | 2 +- docs/INSTALLATION.md | 68 +++++++++++++++++++-------------- docs/TESTS.md | 8 ++-- exercises/shared/.docs/tests.md | 17 ++++----- 4 files changed, 53 insertions(+), 42 deletions(-) diff --git a/README.md b/README.md index 7c5d0a883..bea83633c 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ The following system dependencies are required: - `composer`, as recommended in the [PHP track installation docs][exercism-track-installation-composer]. - [`bash` shell][gnu-bash]. -- PHP V8.2+ CLI. +- PHP V8.3+ CLI. - An active Internet connection for installing required tools / composer packages. Run the following command to get started with this project: diff --git a/docs/INSTALLATION.md b/docs/INSTALLATION.md index 7dd5a4c57..a32c80d56 100644 --- a/docs/INSTALLATION.md +++ b/docs/INSTALLATION.md @@ -2,49 +2,60 @@ ## Which version to chose? -We encourage to use a stable PHP release with active support. Currently this is **PHP 8.0, 8.1 and 8.2**. Details on current releases and their timelines can be found at [php.net/supported-versions](https://www.php.net/supported-versions.php). +We encourage to use a stable PHP release with active support. +Currently this is **PHP 8.1, 8.2 and 8.3**. +Details on current releases and their timelines can be found in [the official PHP documentation](https://www.php.net/supported-versions.php). ## Install PHP +Most package managers for Linux / macOS provide pre-built packages. PHP can be downloaded and built from source, available at [php.net/downloads.php](https://php.net/downloads.php) or [windows.php.net/download](https://windows.php.net/download). -> Note: A web server such as nginx or Apache HTTP server is not required to complete the exercises. +~~~~exercism/note +A web server such as nginx or Apache HTTP server is not required to complete the exercises. +~~~~ ### Linux -Different distributions have different methods. You should be able to +Different distributions have different methods. +You should be able to -```bash -$ yum install php +```shell +yum install php ``` or -```bash -$ apt-get install php +```shell +apt-get install php ``` -depending on your repository manager. +depending on your package manager. -For further instructions, read the manual on [Installation on Unix systems](https://www.php.net/manual/en/install.unix.php). +For further instructions, read the PHP manual on [Installation on Unix systems](https://www.php.net/manual/en/install.unix.php). ### macOS -While PHP is often bundled with macOS, it is often outdated. We recommended installing PHP through [Homebrew](https://brew.sh/). You can install Homebrew following the instructions [here](https://brew.sh/#install). +While PHP is often bundled with macOS, it is often outdated. +We recommended installing PHP through [Homebrew](https://brew.sh/). +You can install Homebrew following the instructions [here](https://brew.sh/#install). -To confirm its installation try the following command, it should output Homebrew `3.2.x` at the time of this writing. -```bash -$ brew --version +To confirm its installation try the following command, it should output Homebrew `4.2.x` at the time of this writing. + +```shell +brew --version ``` Install PHP via homebrew -```bash -$ brew install php@8.0 + +```shell +brew install php@8.3 ``` -This should display the now installed version of PHP, at least version `8.0.x`. -```bash -$ php -v +This should display the now installed version of PHP, at least version `8.1.x`. + +```shell +php -v ``` For further instructions, read the manual on [Installation on macOS](https://www.php.net/manual/en/install.macosx.php). @@ -66,21 +77,22 @@ You will also need [Docker](https://docs.docker.com/engine/install/). If you want to use a different OS, see instruction on [php.net/manual/en/install](https://www.php.net/manual/en/install.php). -### Install Composer -Install [Composer](https://getcomposer.org) [here](https://getcomposer.org/doc/00-intro.md) following your devices OS installation instructions. We recommend installing it globally for ease of use. +## Install Composer + +Install [Composer](https://getcomposer.org) [here](https://getcomposer.org/doc/00-intro.md) following your devices OS installation instructions. We recommend installing it globally for ease of use. -### Install PHPUnit +## Install PHPUnit -#### Via Composer +### Via Composer -PHPUnit version 9 can be installed globally via [Composer](https://getcomposer.org), using the following command. +PHPUnit version 10 can be installed globally via [Composer](https://getcomposer.org), using the following command: -```bash -> composer global require phpunit/phpunit ^9 +```shell +composer global require phpunit/phpunit ^10.5 ``` -If you are using PHP 8+ make sure you install at version 9.5 or later. +Please make sure you install version 10.5 or later. -#### Manual installation +### Manual installation -If you are not using Composer package manager, follow the official [Installing PHPUnit instructions](https://phpunit.readthedocs.io/en/9.5/installation.html). +If you are not using Composer package manager, follow the official [Installing PHPUnit instructions](https://docs.phpunit.de/en/10.5/installation.html#installing-phpunit). diff --git a/docs/TESTS.md b/docs/TESTS.md index eab79c629..05619d486 100644 --- a/docs/TESTS.md +++ b/docs/TESTS.md @@ -3,11 +3,11 @@ Execute the tests with: ```shell -> phpunit file_to_test.php +phpunit file_to_test.php ``` -For example, to run the tests for the Hello World exercise, you would run: +For example, to run the tests for the Hello World exercise, you would run: -``` -$ phpunit HellowWorldTest.php +```shell +phpunit HelloWorldTest.php ``` diff --git a/exercises/shared/.docs/tests.md b/exercises/shared/.docs/tests.md index 1551deaef..e8df8f0ba 100644 --- a/exercises/shared/.docs/tests.md +++ b/exercises/shared/.docs/tests.md @@ -3,21 +3,20 @@ 1. Go to the root of your PHP exercise directory, which is `/php`. To find the Exercism workspace run - ➜ exercism debug | grep Workspace + exercism debug | grep Workspace -1. Get [PHPUnit] if you don't have it already. +2. Get [PHPUnit] if you don't have it already. - ➜ wget -O phpunit https://phar.phpunit.de/phpunit-9.phar - ➜ chmod +x phpunit - ➜ ./phpunit --version + wget -O phpunit https://phar.phpunit.de/phpunit-10.phar + chmod +x phpunit + ./phpunit --version -2. Execute the tests: +3. Execute the tests: - ➜ ./phpunit file_to_test.php + ./phpunit file_to_test.php For example, to run the tests for the Hello World exercise, you would run: - ➜ ./phpunit HelloWorldTest.php + ./phpunit HelloWorldTest.php [PHPUnit]: https://phpunit.de - From dbe196053deb22ccbc5c8ce831d342f5321ddeef Mon Sep 17 00:00:00 2001 From: Michael Kramer Date: Sat, 4 May 2024 15:44:24 +0200 Subject: [PATCH 4/7] Upgrade contribution requirements --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 695a71d98..ee007c67f 100644 --- a/composer.json +++ b/composer.json @@ -10,8 +10,8 @@ } }, "require-dev": { - "php": "^8.0", - "phpunit/phpunit": "^9.6 || ^10.5", + "php": "^8.1", + "phpunit/phpunit": "^10.5", "slevomat/coding-standard": "^8.14.1", "squizlabs/php_codesniffer": "^3.9" }, From e89424265692a31c9d332c5c46384301da13e36b Mon Sep 17 00:00:00 2001 From: mk-mxp <55182845+mk-mxp@users.noreply.github.com> Date: Sun, 5 May 2024 09:25:29 +0200 Subject: [PATCH 5/7] Use full version Co-authored-by: homersimpsons --- docs/INSTALLATION.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/INSTALLATION.md b/docs/INSTALLATION.md index a32c80d56..943120d8b 100644 --- a/docs/INSTALLATION.md +++ b/docs/INSTALLATION.md @@ -52,7 +52,7 @@ Install PHP via homebrew brew install php@8.3 ``` -This should display the now installed version of PHP, at least version `8.1.x`. +This should display the now installed version of PHP, at least version `8.1.0`. ```shell php -v From e3f26d169bc0827e9ec53fca888418d0d430dc18 Mon Sep 17 00:00:00 2001 From: mk-mxp <55182845+mk-mxp@users.noreply.github.com> Date: Sun, 5 May 2024 09:26:12 +0200 Subject: [PATCH 6/7] Move link to better position Co-authored-by: homersimpsons --- docs/INSTALLATION.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/INSTALLATION.md b/docs/INSTALLATION.md index 943120d8b..91f4df85b 100644 --- a/docs/INSTALLATION.md +++ b/docs/INSTALLATION.md @@ -79,7 +79,7 @@ If you want to use a different OS, see instruction on [php.net/manual/en/install ## Install Composer -Install [Composer](https://getcomposer.org) [here](https://getcomposer.org/doc/00-intro.md) following your devices OS installation instructions. We recommend installing it globally for ease of use. +Install [Composer](https://getcomposer.org) following your devices OS [installation instructions](https://getcomposer.org/doc/00-intro.md). We recommend installing it globally for ease of use. ## Install PHPUnit From 7d39052fe30bbeb77a1cea97e7fe1562f411b9ae Mon Sep 17 00:00:00 2001 From: Michael Kramer Date: Sun, 5 May 2024 09:33:11 +0200 Subject: [PATCH 7/7] Change example file name to match content --- docs/TESTS.md | 2 +- exercises/shared/.docs/tests.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/TESTS.md b/docs/TESTS.md index 05619d486..a0f3b7e39 100644 --- a/docs/TESTS.md +++ b/docs/TESTS.md @@ -3,7 +3,7 @@ Execute the tests with: ```shell -phpunit file_to_test.php +phpunit test_file.php ``` For example, to run the tests for the Hello World exercise, you would run: diff --git a/exercises/shared/.docs/tests.md b/exercises/shared/.docs/tests.md index e8df8f0ba..8527d5e85 100644 --- a/exercises/shared/.docs/tests.md +++ b/exercises/shared/.docs/tests.md @@ -13,7 +13,7 @@ 3. Execute the tests: - ./phpunit file_to_test.php + ./phpunit test_file.php For example, to run the tests for the Hello World exercise, you would run: