Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade track to PHP 8.1 - 8.3 and PHPUnit 10.5 #704

Merged
merged 7 commits into from
May 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions .github/workflows/exercise-tests-phpunit-10.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
45 changes: 0 additions & 45 deletions .github/workflows/exercise-tests-phpunit-9.yml

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
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": "^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"
},
Expand Down
68 changes: 40 additions & 28 deletions docs/INSTALLATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 [email protected]

```shell
brew install [email protected]
```

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.0`.

```shell
php -v
```

For further instructions, read the manual on [Installation on macOS](https://www.php.net/manual/en/install.macosx.php).
Expand All @@ -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
mk-mxp marked this conversation as resolved.
Show resolved Hide resolved

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
## 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).
8 changes: 4 additions & 4 deletions docs/TESTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
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:
For example, to run the tests for the Hello World exercise, you would run:

```
$ phpunit HellowWorldTest.php
```shell
phpunit HelloWorldTest.php
```
17 changes: 8 additions & 9 deletions exercises/shared/.docs/tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,20 @@
1. Go to the root of your PHP exercise directory, which is `<EXERCISM_WORKSPACE>/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 test_file.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

Loading