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`.
|
||||
|
||||
All command-line arguments are documented on [phpunit.de](http://www.phpunit.de/manual/current/en/textui.html).
|
||||
|
||||
## Usage of "phpunit" executable
|
||||
phpunit
|
||||
## Usage of "" executable
|
||||
|
||||
* `phpunit`: Runs all tests in all folders
|
||||
* `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 '' 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
|
||||
|
||||
* `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
|
||||
the [Testing Glossary](#glossary).
|
||||
|
||||
To get started now, follow the installation instructions below, and check
|
||||
[Troubleshooting](/topics/testing/testing-guide-troubleshooting) in case you run into any problems.
|
||||
|
||||
## Installation
|
||||
|
||||
The framework has a required dependency on [PHPUnit](http://www.phpunit.de/) and an optional dependency on
|
||||
[SimpleTest](http://simpletest.org/), the two premiere PHP testing frameworks.
|
||||
Unit tests are not included in the normal SilverStripe downloads,
|
||||
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
|
||||
that you have the PEAR command line client installed. To test this out, type `pear help` at your prompt. You should
|
||||
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)).
|
||||
Once you've got the project up and running,
|
||||
check out the additional requirements to run unit tests:
|
||||
|
||||
The PHPUnit installation via PEAR is very straightforward.
|
||||
You might have to perform the following commands as root or super user (sudo).
|
||||
composer update --dev
|
||||
|
||||
<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:
|
||||
|
||||
pear channel-discover pear.phpunit.de
|
||||
pear channel-discover pear.symfony-project.com
|
||||
pear install phpunit/PHPUnit
|
||||
Alternatively, you can check out phpunit globally via the PEAR packanage manager
|
||||
([instructions](https://github.com/sebastianbergmann/phpunit/)).
|
||||
|
||||
## Running Tests
|
||||
|
||||
@ -57,6 +51,7 @@ their own:
|
||||
|
||||
/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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user