Skip to content

Commit 5ef1910

Browse files
authored
Make PHAR the prefered way to install PHPUnit (#882)
1 parent 1da70db commit 5ef1910

File tree

1 file changed

+41
-6
lines changed

1 file changed

+41
-6
lines changed

docs/INSTALLATION.md

+41-6
Original file line numberDiff line numberDiff line change
@@ -83,16 +83,51 @@ Install [Composer](https://getcomposer.org) following your devices OS [installat
8383

8484
## Install PHPUnit
8585

86-
### Via Composer
86+
### Via PHP Archive (PHAR)
87+
88+
The easiest way to use PHPUnit for Exercism exercises is downloading a distribution that is packaged as a PHP Archive (PHAR), which is also the recommended way to use PHPUnit.
89+
Store the PHAR where you stored the `exercism` CLI to run PHPUnit from wherever you are.
8790

88-
PHPUnit version 10 can be installed globally via [Composer](https://getcomposer.org), using the following command:
91+
You can download a release of PHPUnit packages as a PHP archive:
8992

9093
```shell
91-
composer global require phpunit/phpunit ^10.5
94+
wget -O phpunit.phar https://phar.phpunit.de/phpunit-10.phar
95+
```
96+
97+
Then make the downloaded file executable:
98+
99+
```shell
100+
chmod +x phpunit.phar
92101
```
93102

94-
Please make sure you install version 10.5 or later.
103+
And move it to the same location as you moved the `exercism` CLI, naming the command `phpunit`:
104+
105+
```shell
106+
mv phpunit.phar ~/bin/phpunit
107+
```
108+
109+
Now you can run `phpunit` from wherever you are, as shown in the [PHP track testing docs](https://exercism.org/docs/tracks/php/tests):
110+
111+
```shell
112+
phpunit --version
113+
```
95114

96-
### Manual installation
115+
The output should look like this:
116+
117+
```
118+
PHPUnit 10.5.45 by Sebastian Bergmann and contributors.
119+
120+
```
121+
122+
123+
You can also follow the official [Installing PHPUnit instructions](https://docs.phpunit.de/en/10.5/installation.html#installing-phpunit) to install PHPUnit.
124+
125+
### Via Composer
126+
127+
PHPUnit version 10 can also be installed globally via [Composer](https://getcomposer.org), using the following command:
128+
129+
```shell
130+
composer global require phpunit/phpunit ^10.5
131+
```
97132

98-
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).
133+
Please make sure you install version 10.5 or later.

0 commit comments

Comments
 (0)