mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Documenting PHPUnit install through composer
This commit is contained in:
parent
84692bf499
commit
0a580deb3f
@ -21,8 +21,8 @@ If you're using [phpUnderControl](http://phpundercontrol.org/) or a similar tool
|
|||||||
you will most likely need the `--log-junit` and `--coverage-xml` flags that are not available through `sake`.
|
you will most likely need the `--log-junit` and `--coverage-xml` flags that are not available through `sake`.
|
||||||
|
|
||||||
All command-line arguments are documented on [phpunit.de](http://www.phpunit.de/manual/current/en/textui.html).
|
All command-line arguments are documented on [phpunit.de](http://www.phpunit.de/manual/current/en/textui.html).
|
||||||
|
phpunit
|
||||||
## Usage of "phpunit" executable
|
## Usage of "" executable
|
||||||
|
|
||||||
* `phpunit`: Runs all tests in all folders
|
* `phpunit`: Runs all tests in all folders
|
||||||
* `phpunit framework/tests/`: Run all tests of the framework module
|
* `phpunit framework/tests/`: Run all tests of the framework module
|
||||||
@ -30,6 +30,10 @@ All command-line arguments are documented on [phpunit.de](http://www.phpunit.de/
|
|||||||
* `phpunit framework/tests/filesystem/FolderTest.php`: Run a single test
|
* `phpunit framework/tests/filesystem/FolderTest.php`: Run a single test
|
||||||
* `phpunit framework/tests '' flush=all`: Run tests with optional `$_GET` parameters (you need an empty second argument)
|
* `phpunit framework/tests '' flush=all`: Run tests with optional `$_GET` parameters (you need an empty second argument)
|
||||||
|
|
||||||
|
Note that if you have installed PHPUnit through Composer rather than PEAR
|
||||||
|
([instructions](/topics/installation/composer)), the binary will be placed
|
||||||
|
in `vendor/bin/phpunit` instead of `phpunit`.
|
||||||
|
|
||||||
## Coverage reports
|
## Coverage reports
|
||||||
|
|
||||||
* `phpunit --coverage-html assets/coverage-report`: Generate coverage report for the whole project
|
* `phpunit --coverage-html assets/coverage-report`: Generate coverage report for the whole project
|
||||||
|
@ -16,31 +16,25 @@ fundamental concepts that we build on in this documentation.
|
|||||||
|
|
||||||
If you're more familiar with unit testing, but want a refresher of some of the concepts and terminology, you can browse
|
If you're more familiar with unit testing, but want a refresher of some of the concepts and terminology, you can browse
|
||||||
the [Testing Glossary](#glossary).
|
the [Testing Glossary](#glossary).
|
||||||
|
|
||||||
To get started now, follow the installation instructions below, and check
|
To get started now, follow the installation instructions below, and check
|
||||||
[Troubleshooting](/topics/testing/testing-guide-troubleshooting) in case you run into any problems.
|
[Troubleshooting](/topics/testing/testing-guide-troubleshooting) in case you run into any problems.
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
The framework has a required dependency on [PHPUnit](http://www.phpunit.de/) and an optional dependency on
|
Unit tests are not included in the normal SilverStripe downloads,
|
||||||
[SimpleTest](http://simpletest.org/), the two premiere PHP testing frameworks.
|
you are expected to work with local git repositories
|
||||||
|
([installation instructions](/topics/installation/composer)).
|
||||||
|
|
||||||
To run SilverStripe tests, you'll need to be able to access PHPUnit on your include path. First, you'll need to make sure
|
Once you've got the project up and running,
|
||||||
that you have the PEAR command line client installed. To test this out, type `pear help` at your prompt. You should
|
check out the additional requirements to run unit tests:
|
||||||
see a bunch of generic PEAR info. If it's not installed, you'll need to set it up first (see: [Getting Started with
|
|
||||||
PEAR](http://www.sitepoint.com/article/getting-started-with-pear/)) or else manually install PHPUnit (see: [Installation
|
|
||||||
instructions](http://www.phpunit.de/pocket_guide/3.3/en/installation.html)).
|
|
||||||
|
|
||||||
The PHPUnit installation via PEAR is very straightforward.
|
composer update --dev
|
||||||
You might have to perform the following commands as root or super user (sudo).
|
|
||||||
|
|
||||||
<del>We need a specific version of PHPUnit (3.3.x), as 3.4 or higher breaks our test runner (see [#4573](http://open.silverstripe.com/ticket/4573))</del>
|
The will install (among other things) the [PHPUnit](http://www.phpunit.de/) dependency,
|
||||||
|
which is the framework we're building our unit tests on.
|
||||||
|
|
||||||
At your prompt, type the following commands:
|
Alternatively, you can check out phpunit globally via the PEAR packanage manager
|
||||||
|
([instructions](https://github.com/sebastianbergmann/phpunit/)).
|
||||||
pear channel-discover pear.phpunit.de
|
|
||||||
pear channel-discover pear.symfony-project.com
|
|
||||||
pear install phpunit/PHPUnit
|
|
||||||
|
|
||||||
## Running Tests
|
## Running Tests
|
||||||
|
|
||||||
@ -57,6 +51,7 @@ their own:
|
|||||||
|
|
||||||
/path/to/project$ sake dev/tests/all
|
/path/to/project$ sake dev/tests/all
|
||||||
|
|
||||||
|
Alternatively, you can use the `phpunit` binary to run tests, see [PHPUnit Configuration](phpunit-configuration) for details.
|
||||||
|
|
||||||
### Partial Test Runs
|
### Partial Test Runs
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user