Commit Graph

15 Commits

Author SHA1 Message Date
Jonathan Desrosiers 225f191f32 REST API: Introduce Autosaves controller and endpoint.
- Adds `WP_REST_Autosaves_Controller` which extends `WP_REST_Revisions_Controller`.
- Autosaves endpoint is registered for all post types except attachment because even post types without revisions enabled are expected to autosave.
- Because setting the `DOING_AUTOSAVE` constant pollutes the test suite, autosaves tests are run last. We may want to improve upon this later. 

Also, use a truly impossibly high number in User Controller tests. The number `100`, (or `7777` in `trunk`), could be valid in certain test run configurations. The `REST_TESTS_IMPOSSIBLY_HIGH_NUMBER` constant is impossibly high for this very reason.

Finally, Skip Autosaves controller test for multisite. There's a PHP 5.2 edge case where paths calculated differently, possibly caused by differing version of PHPUnit.

Props adamsilverstein, aduth, azaozz, danielbachhuber, rmccue, danielbachhuber.

Merges [43767], [43768], [43769] to trunk.

See #45132, #45131.
Fixes #45128, #43316.

git-svn-id: https://develop.svn.wordpress.org/trunk@44126 602fd350-edb4-49c9-b593-d223f7449a82
2018-12-13 22:41:47 +00:00
John Blackbourn b7c2dfb9ae Build/Test Tools: Allow code coverage reports to be generated.
This corrects the attribute needed to allow PHPUnit to generate coverage reports, and also adds a blacklist of files and directories that are excluded from coverage reports.

Props schlessera, jipmoors

Fixes #43067, #43240


git-svn-id: https://develop.svn.wordpress.org/trunk@42665 602fd350-edb4-49c9-b593-d223f7449a82
2018-02-07 22:20:25 +00:00
Gary Pendergast 5ee7f7dfdb Tests: Rename ignored tests in `phpunit.xml.dist`.
Some of the files renamed in [41261] are listed in `phpunit.xml.dist`, as they need to be ignore in PHP 5.2.

This followup commit changes `phpunit.xml.dist` to match their new names.

See #41658.



git-svn-id: https://develop.svn.wordpress.org/trunk@41262 602fd350-edb4-49c9-b593-d223f7449a82
2017-08-18 10:26:50 +00:00
John Blackbourn a5a1a4d20e Build/Test Tools: Be strict about tests that do not test anything.
See #40538


git-svn-id: https://develop.svn.wordpress.org/trunk@40534 602fd350-edb4-49c9-b593-d223f7449a82
2017-04-23 01:24:41 +00:00
John Blackbourn 4f8057f7d5 Build/Test Tools: Introduce `ms-required` and `ms-excluded` groups for tests.
Tests in the `ms-excluded` group are now excluded when running tests with multisite enabled, and tests in the `ms-required` group are excluded when running tests without multisite enabled. The end result is a significantly reduced number of skipped tests polluting PHPUnit's output, which means verbose mode can be used to more easily see which tests are skipped or incomplete, and why.

See #40531


git-svn-id: https://develop.svn.wordpress.org/trunk@40520 602fd350-edb4-49c9-b593-d223f7449a82
2017-04-22 18:58:46 +00:00
John Blackbourn 29cfd0b336 oEmbed: Remove the oEmbed provider unit tests.
This reverts [38454] along with its follow-up commits, [38512], [38514], and [38692]. These tests are currently not pass
ing, and maybe they never will. The tests are in a group which does not run by default without a flag, making them quest
ionably useful.

We can re-visit this at a later date.

See #32360


git-svn-id: https://develop.svn.wordpress.org/trunk@38840 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-20 09:15:10 +00:00
Scott Taylor 7ca480cc4e OEmbed: add unit tests. `@group external-oembed` is not run by default.
Props johnbillion, wonderboymusic.
See #32360.


git-svn-id: https://develop.svn.wordpress.org/trunk@38454 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-30 18:54:53 +00:00
Aaron Jorbin 747a327c3c Set a whitelist for PHPUnit code coverage.
PHPUnit requires a whitelist as of version 5 in order to generate code coverage. See https://github.com/sebastianbergmann/phpunit-documentation/issues/335 .

Fixes #36867.



git-svn-id: https://develop.svn.wordpress.org/trunk@37449 602fd350-edb4-49c9-b593-d223f7449a82
2016-05-17 20:22:57 +00:00
Jeremy Felt 888d3524f5 Tests: Exclude `ms-files` test group from default PHPUnit config
Multisite specific tests run as normal with `phpunit.xml.dist` and multisite constants defined. The `ms-files` group causes pollution when mixed with the rest of the tests, so it should be excluded here too.

See #36566.


git-svn-id: https://develop.svn.wordpress.org/trunk@37269 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-20 17:10:21 +00:00
Scott Taylor 2845280ffd Unit Tests: add `SpeedTrapListener` to `phpunit/includes` and add the config node to `phpunit.xml.dist`.
See #30017, #33968.


git-svn-id: https://develop.svn.wordpress.org/trunk@35214 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-16 00:27:28 +00:00
Gary Pendergast 7c508ff9fa Tests: Exclude the `oembed/headers.php` test file, which was marked as PHP >= 5.3.0 in [34904].
See #32522.



git-svn-id: https://develop.svn.wordpress.org/trunk@34905 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-07 12:00:34 +00:00
Gary Pendergast a170c1f67e Embeds: After [34903], remove an accidentally included text domain, and exclude a test failing in PHP 5.2.
git-svn-id: https://develop.svn.wordpress.org/trunk@34904 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-07 11:00:59 +00:00
Boone Gorges df11fb8593 Exclude external-http tests when running `phpunit`.
The external-http tests are very slow, and `Wp_Http` functionality is fairly
isolated, so the benefits of skipping these tests by default outweigh the
risks.

A `grunt phpunit:external-http` subtask has been added, to ensure that the
tests are executed during exhaustive runs of the test suite, such as in
continuous integration.

Fixes #30304.

git-svn-id: https://develop.svn.wordpress.org/trunk@30298 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-10 14:48:28 +00:00
Boone Gorges f7dbf962d7 Only reset taxonomies and post types between tests when running core tests.
A growing number of plugins and other WP-based projects use the core test
tools, such as WP_UnitTestCase, as the basis of their own tests and continuous
integration setups. At the same time, many of these third-party plugins use
custom post types and taxonomies, which are generally registered a single time
during a run of the tests: at 'init', before the testcases have run. Wiping out
these globals between tests will mess with these third-party builds.

Best practice for plugin developers is probably to clean up their own post types
and taxonomies and then reinitialize before each test. But, in the interest of
not breaking everyone's builds, the core test suite will not enforce this.

Fixes #29827.

git-svn-id: https://develop.svn.wordpress.org/trunk@29869 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-10 20:25:39 +00:00
Andrew Nacin 8045afd81b Move PHPUnit tests into a tests/phpunit directory.
wp-tests-config.php can/should reside in the root of a develop checkout. `phpunit` should be run from the root.

see #25088.


git-svn-id: https://develop.svn.wordpress.org/trunk@25165 602fd350-edb4-49c9-b593-d223f7449a82
2013-08-29 18:39:34 +00:00