mirrored from git://develop.git.wordpress.org/
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: update PHPUnit testing README.md with corrections #62065
- Loading branch information
Showing
2 changed files
with
33 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# PHPUnit Tests | ||
|
||
PHPUnit is the official testing framework chosen by the core team to test our PHP code. | ||
|
||
This documentation will assume you have a local development environment of your own choosing. For other testing workflows, such as Docker, see the [PHP: PHP Unit](https://make.wordpress.org/core/handbook/testing/automated-testing/phpunit/) handbook page. | ||
|
||
## Setup | ||
|
||
1. Check out the wordpress-develop repository | ||
|
||
git clone git://develop.git.wordpress.org/ wordpress-develop | ||
cd wordpress-develop | ||
|
||
2. Run `composer update --with-all-dependencies` | ||
3. Create a clean MySQL database and user. **DO NOT USE AN EXISTING DATABASE** or you will lose data, guaranteed. | ||
4. Copy `wp-tests-config-sample.php` to `wp-tests-config.php`, edit it to include your testing database credentials. | ||
5. Run the tests from the repository root: | ||
- To execute a particular test: | ||
|
||
$ vendor/bin/phpunit tests/phpunit/tests/test_case.php | ||
- To execute all tests: | ||
|
||
$ vendor/bin/phpunit | ||
|
||
## Notes: | ||
|
||
Test cases live in the `tests` subdirectory. All files in that directory will be included by default. Extend the `WP_UnitTestCase` class to ensure your test is run. | ||
|
||
`phpunit` will initialize and install a (more or less) complete running copy of WordPress each time it is run. This makes it possible to run functional interface and module tests against a fully working database and codebase, as opposed to pure unit tests with mock objects and stubs. Pure unit tests may be used also, of course. | ||
|
||
Changes to the test database will be rolled back as tests are finished, to ensure a clean start next time the tests are run. | ||
|
||
`phpunit` is intended to run at the command line, not via a web server. |
This file was deleted.
Oops, something went wrong.