|
3 | 3 | <chapter id="installation">
|
4 | 4 | <title>Installing PHPUnit</title>
|
5 | 5 |
|
6 |
| - <para> |
7 |
| - There a three supported ways of installing PHPUnit. You can use the <ulink |
8 |
| - url="http://pear.php.net/manual/en/guide.users.commandline.cli.php">PEAR |
9 |
| - Installer</ulink> or <ulink url="http://getcomposer.org/">Composer</ulink> |
10 |
| - to download and install PHPUnit as well as its dependencies. You can also |
11 |
| - download a <ulink url="http://php.net/phar">PHP Archive (PHAR)</ulink> of |
12 |
| - PHPUnit that has all required (as well as some optional) dependencies of |
13 |
| - PHPUnit bundled in a single file. |
14 |
| - </para> |
15 |
| - |
16 |
| - <note> |
17 |
| - <para> |
18 |
| - Support for Composer and PHP Archive (PHAR) was added in PHPUnit 3.7 (and |
19 |
| - is known to be stable since PHPUnit 3.7.5). Earlier releases of PHPUnit |
20 |
| - are not available through these distribution channels. |
21 |
| - </para> |
22 |
| - </note> |
23 |
| - |
24 |
| - <note> |
25 |
| - <para> |
26 |
| - PHPUnit 3.7 requires PHP 5.3.3 (or later) but PHP 5.4.7 (or later) is |
27 |
| - highly recommended. |
28 |
| - </para> |
| 6 | + <section id="installation.phar"> |
| 7 | + <title>PHP Archive (PHAR)</title> |
29 | 8 |
|
30 | 9 | <para>
|
31 |
| - PHP_CodeCoverage, the library that is used by PHPUnit to collect and |
32 |
| - process code coverage information, depends on Xdebug 2.0.5 (or later) but |
33 |
| - Xdebug 2.2.0 (or later) is highly recommended. |
| 10 | + The easiest way to obtain PHPUnit is to download a <ulink |
| 11 | + url="http://php.net/phar">PHP Archive (PHAR)</ulink> that has all required |
| 12 | + (as well as some optional) dependencies of PHPUnit bundled in a single |
| 13 | + file: |
34 | 14 | </para>
|
35 |
| - </note> |
36 | 15 |
|
37 |
| - <section id="installation.pear"> |
38 |
| - <title>PEAR</title> |
| 16 | + <screen><userinput>wget http://pear.phpunit.de/get/phpunit.phar</userinput> |
| 17 | +<userinput>chmod +x phpunit.phar</userinput> |
| 18 | +<userinput>mv phpunit.phar /usr/local/bin/phpunit</userinput></screen> |
39 | 19 |
|
40 | 20 | <para>
|
41 |
| - The following two commands (which you may have to run as |
42 |
| - <literal>root</literal>) are all that is required to install PHPUnit using |
43 |
| - the PEAR Installer: |
| 21 | + You can also immediately use the PHAR after you have downloaded it, of |
| 22 | + course: |
44 | 23 | </para>
|
45 | 24 |
|
46 |
| - <screen><userinput>pear config-set auto_discover 1</userinput> |
47 |
| -<userinput>pear install pear.phpunit.de/PHPUnit</userinput></screen> |
48 |
| - |
49 |
| - <caution> |
50 |
| - <para> |
51 |
| - Depending on your OS distribution and/or your PHP environment, you may |
52 |
| - need to install PEAR or update your existing PEAR installation before |
53 |
| - you can proceed with the instructions in this section. |
54 |
| - </para> |
55 |
| - |
56 |
| - <para> |
57 |
| - <userinput>sudo pear upgrade PEAR</userinput> usually suffices to |
58 |
| - upgrade an existing PEAR installation. The <ulink |
59 |
| - url="http://pear.php.net/manual/en/installation.getting.php">PEAR Manual</ulink> |
60 |
| - explains how to perform a fresh installation of PEAR. |
61 |
| - </para> |
62 |
| - </caution> |
| 25 | + <screen><userinput>wget http://pear.phpunit.de/get/phpunit.phar</userinput> |
| 26 | +<userinput>php phpunit.phar</userinput></screen> |
63 | 27 | </section>
|
64 | 28 |
|
65 | 29 | <section id="installation.composer">
|
66 | 30 | <title>Composer</title>
|
67 | 31 |
|
68 | 32 | <para>
|
69 |
| - To add PHPUnit as a local, per-project dependency to your project, simply |
70 |
| - add a dependency on <literal>phpunit/phpunit</literal> to your project's |
71 |
| - <filename>composer.json</filename> file. Here is a minimal example of a |
72 |
| - <filename>composer.json</filename> file that just defines a |
73 |
| - development-time dependency on PHPUnit 3.7: |
| 33 | + Simply add a dependency on <literal>phpunit/phpunit</literal> to your |
| 34 | + project's <literal>composer.json</literal> file if you use |
| 35 | + <ulink url="http://getcomposer.org/">Composer</ulink> to manage the |
| 36 | + dependencies of your project. Here is a minimal example of a |
| 37 | + <literal>composer.json</literal> file that just defines a development-time |
| 38 | + dependency on PHPUnit 3.7: |
74 | 39 | </para>
|
75 | 40 |
|
76 | 41 | <programlisting><![CDATA[{
|
|
93 | 58 | "bin-dir": "/usr/local/bin/"
|
94 | 59 | }
|
95 | 60 | }]]></programlisting>
|
| 61 | + |
| 62 | + <note> |
| 63 | + <para> |
| 64 | + Support for Composer and PHP Archive (PHAR) was added in PHPUnit 3.7 |
| 65 | + (and is known to be stable since PHPUnit 3.7.5). Earlier releases of |
| 66 | + PHPUnit are not available through these distribution channels. |
| 67 | + </para> |
| 68 | + </note> |
96 | 69 | </section>
|
97 | 70 |
|
98 |
| - <section id="installation.phar"> |
99 |
| - <title>PHP Archive (PHAR)</title> |
| 71 | + <section id="installation.pear"> |
| 72 | + <title>PEAR</title> |
100 | 73 |
|
101 | 74 | <para>
|
102 |
| - You can also download a PHP Archive (PHAR) of PHPUnit that has all |
103 |
| - required (as well as some optional) dependencies of PHPUnit bundled in a |
104 |
| - single file: |
| 75 | + The following two commands (which you may have to run as |
| 76 | + <literal>root</literal>) are all that is required to install PHPUnit using |
| 77 | + the <ulink url="http://pear.php.net/manual/en/guide.users.commandline.cli.php">PEAR Installer</ulink>: |
105 | 78 | </para>
|
106 | 79 |
|
107 |
| - <screen><userinput>wget http://pear.phpunit.de/get/phpunit.phar</userinput> |
108 |
| -<userinput>chmod +x phpunit.phar</userinput></screen> |
| 80 | + <screen><userinput>pear config-set auto_discover 1</userinput> |
| 81 | +<userinput>pear install pear.phpunit.de/PHPUnit</userinput></screen> |
| 82 | + |
| 83 | + <caution> |
| 84 | + <para> |
| 85 | + Depending on your OS distribution and/or your PHP environment, you may |
| 86 | + need to install PEAR or update your existing PEAR installation before |
| 87 | + you can proceed with the instructions in this section. |
| 88 | + </para> |
| 89 | + |
| 90 | + <para> |
| 91 | + <userinput>sudo pear upgrade PEAR</userinput> usually suffices to |
| 92 | + upgrade an existing PEAR installation. The <ulink |
| 93 | + url="http://pear.php.net/manual/en/installation.getting.php">PEAR Manual</ulink> |
| 94 | + explains how to perform a fresh installation of PEAR. |
| 95 | + </para> |
| 96 | + </caution> |
| 97 | + |
| 98 | + <note> |
| 99 | + <para> |
| 100 | + PHPUnit 3.7 requires PHP 5.3.3 (or later) but PHP 5.5.1 (or later) is |
| 101 | + highly recommended. |
| 102 | + </para> |
| 103 | + |
| 104 | + <para> |
| 105 | + PHP_CodeCoverage, the library that is used by PHPUnit to collect and |
| 106 | + process code coverage information, depends on Xdebug 2.0.5 (or later) |
| 107 | + but Xdebug 2.2.3 (or later) is highly recommended. |
| 108 | + </para> |
| 109 | + </note> |
109 | 110 | </section>
|
110 | 111 |
|
111 | 112 | <section id="installation.optional-packages">
|
|
0 commit comments