Commit Graph

1370 Commits

Author SHA1 Message Date
Konstantin Obenland c7a86be42c Tests: Use updated filter names and oembed title for UT sanity.
See [35294], #31078.


git-svn-id: https://develop.svn.wordpress.org/trunk@35295 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-20 17:04:29 +00:00
Konstantin Obenland d625bd2428 Themes: Improve document title output.
Introduces more flexibility in filtering all parts of the document title,the
separator, and a way to short-circuit title generation. Plugins can now also
check for theme support and reliably filter the entire output. See #18548.
Deprecates `wp_title()`.

Fixes #31078.



git-svn-id: https://develop.svn.wordpress.org/trunk@35294 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-20 16:20:04 +00:00
Scott Taylor ea7e8314d2 Formatting: allow date strings to be passed to `get_gmt_from_date()`, instead of requiring `'Y-m-d H:i:s'`.
Adds unit tests.

Props pbearne.
Fixes #34279.


git-svn-id: https://develop.svn.wordpress.org/trunk@35284 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-20 06:07:45 +00:00
Scott Taylor 91d55f97c2 Users: when calling `wp_insert_user()` with an valid user ID, return `WP_Error` instead of arbitrarily updating user meta.
Adds unit test.

Props swissspidy, bilalcoder.
Fixes #28004.


git-svn-id: https://develop.svn.wordpress.org/trunk@35280 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-20 05:27:32 +00:00
Scott Taylor fdd8106001 Formatting: when making unique filenames in `wp_unique_filename()` by adding an incrementing number, prefix it with a dash to disambiguate from files that end in numbers.
Updates unit tests.

Props mikejolley, tyxla.
Fixes #21453.


git-svn-id: https://develop.svn.wordpress.org/trunk@35276 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-20 04:04:26 +00:00
Weston Ruter 42687da29c Widgets: Modify unit test assertion to be compatible with `widget_nav_menu` option being filtered by plugin to return `ArrayIterator`.
Modifies assertion added in [35100].

See #26876.
See #32474.


git-svn-id: https://develop.svn.wordpress.org/trunk@35272 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-19 21:26:24 +00:00
Drew Jaynes f03562b364 Tests: Add some more test coverage for `get_term_field()`.
See #33968.


git-svn-id: https://develop.svn.wordpress.org/trunk@35270 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-19 03:28:49 +00:00
Boone Gorges 990eebf373 Bust object term cache in `wp_remove_object_terms()`.
Props tszming.
Fixes #34338.

git-svn-id: https://develop.svn.wordpress.org/trunk@35268 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-19 01:52:22 +00:00
John Blackbourn 39c6a77617 Some cleanup that was missed in [35259].
See #33728, #24853


git-svn-id: https://develop.svn.wordpress.org/trunk@35260 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-18 06:25:25 +00:00
John Blackbourn 219b56a6a4 Some rewrite endpoint tests in preparation for new endpoint masks. More to come.
See #33728, #24853


git-svn-id: https://develop.svn.wordpress.org/trunk@35259 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-18 06:23:48 +00:00
John Blackbourn a314c6c234 Preserve the public and private query var properties on the global `WP` instance when using `WP_UnitTestCase::go_to()`. These properties apply to the application state, not the current request.
See #34346


git-svn-id: https://develop.svn.wordpress.org/trunk@35258 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-18 05:00:40 +00:00
John Blackbourn 9fbff7f63a Add `is_embed()` to `WP_UnitTestCase::assertQueryTrue()` and update the relevant embed tests.
See #32522


git-svn-id: https://develop.svn.wordpress.org/trunk@35257 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-18 04:50:15 +00:00
John Blackbourn 6845b3cd4a Move the `test_is_home_should_be_false_when_visiting_custom_endpoint_without_a_registered_query_var_and_page_on_front_is_set()` test into a more appropriate place.
See #25143


git-svn-id: https://develop.svn.wordpress.org/trunk@35256 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-18 01:34:29 +00:00
John Blackbourn ab43e7362d Correct a test after r35253.
See #34272


git-svn-id: https://develop.svn.wordpress.org/trunk@35255 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-18 00:55:16 +00:00
John Blackbourn d5b31e6ba2 Introduce `map_deep()`, a utility function that recursively maps a callable function to every item in an array or object. Works like `array_walk_recursive()` but works with objects too.
Updates `rawurlencode_deep()`, `urlencode_deep()`, and `stripslashes_deep()` to use `map_deep()`. Introduces `urldecode_deep()` for completeness.

Props wpmuguru, nbachiyski, boonebgorges, MikeHansenMe, chriscct7, realloc, johnbillion
Fixes #22300


git-svn-id: https://develop.svn.wordpress.org/trunk@35252 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-17 23:25:21 +00:00
Scott Taylor 768958f7a0 Unit Tests: better fixtures for `Tests_Meta_Slashes` and `Tests_WP_Customize_Section`.
See #30017, #33968.



git-svn-id: https://develop.svn.wordpress.org/trunk@35249 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-17 21:28:43 +00:00
Scott Taylor 80b732819b Unit Tests: better fixtures for `Tests_User_WpSetCurrentUser`.
See #30017, #33968.



git-svn-id: https://develop.svn.wordpress.org/trunk@35248 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-17 21:18:38 +00:00
Scott Taylor 721d4c5a77 Unit Tests: better fixtures for `Tests_User`.
See #30017, #33968.



git-svn-id: https://develop.svn.wordpress.org/trunk@35247 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-17 21:14:28 +00:00
Scott Taylor c173dc5595 Unit Tests: better fixtures for `Tests_AdminBar`. Don't force-delete some posts: some filter callbacks are no-ops on Multisite if the post is vanquished.
See #30017, #33968.



git-svn-id: https://develop.svn.wordpress.org/trunk@35246 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-17 20:48:33 +00:00
Scott Taylor 8506f48d6b Unit Tests: better fixtures for `Tests_Admin_Includes_Post`.
See #30017, #33968.



git-svn-id: https://develop.svn.wordpress.org/trunk@35245 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-17 19:47:07 +00:00
Scott Taylor 613e88fe86 Unit Tests: `WP_UnitTest_Generator_Sequence` needs a static incrementer - otherwise, it assumes every test class is a reset, which it no longer is (it is now static).
While we're at it, remove unnecessary `tearDown()` code.

See #30017, #33968.



git-svn-id: https://develop.svn.wordpress.org/trunk@35244 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-17 19:24:20 +00:00
Scott Taylor ae226d66b6 Unit Tests: after [35242], declare some missing instance props on individual test classes.
See #30017, #33968.



git-svn-id: https://develop.svn.wordpress.org/trunk@35243 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-17 18:29:32 +00:00
Scott Taylor b757b37551 Unit Tests: after [35225], make `factory` a method/getter on `WP_UnitTestCase` and add magic methods for BC for every plugin that is extending `WP_UnitTestCase` and accessing the `$factory` instance prop.
Props nerrad, wonderboymusic.
See #30017, #33968.



git-svn-id: https://develop.svn.wordpress.org/trunk@35242 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-17 18:02:16 +00:00
Weston Ruter 0e81f51cac Customizer: Add unit test for `WP_Customize_Widgets::is_panel_active()`.
See #33052.


git-svn-id: https://develop.svn.wordpress.org/trunk@35236 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-17 04:43:27 +00:00
Sergey Biryukov 9b591d6b09 Embeds: Rename files, functions, and hooks added in [34903] to make it more clear what is oEmbed-specific and what isn't.
See https://core.trac.wordpress.org/ticket/34272#comment:7 for full list of renamed functions and hooks.

Props swissspidy.
Fixes #34272.

git-svn-id: https://develop.svn.wordpress.org/trunk@35235 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-17 01:20:19 +00:00
Weston Ruter 370057b5d7 Customizer: Always show Widgets panel initially if sidebars are registered; show notice to users in panel if no widget areas are in current preview.
Widgets panel will not wait to display until the preview loads.

Also fixes problems with `margin-top` in panels where other panels' `active` states change, as well as ensuring sections of deactivated panel collapse before panel is hidden to prevent the pane from becoming empty of controls.

Fixes #33052.
Fixes #33567.


git-svn-id: https://develop.svn.wordpress.org/trunk@35231 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-16 23:47:56 +00:00
Boone Gorges f22ba848df Return `null` from `get_term()` on taxonomy mismatch.
[34997] caused `get_term()` to return an error object in the case when
`$taxonomy` did not match the taxonomy of the located term. This was an
inadvertant change from the previous behavior, when `get_term()` would return
null in these cases.

Props dlh.
See #14162. Fixes #34332.

git-svn-id: https://develop.svn.wordpress.org/trunk@35227 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-16 21:41:51 +00:00
Scott Taylor 61edcd5021 Unit Tests: PHP 5.2, I Hate You and You Are Bringing Me Down.
#YOLOFriday

See #30017, #33968.


git-svn-id: https://develop.svn.wordpress.org/trunk@35226 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-16 21:14:52 +00:00
Scott Taylor e70ebea219 Unit Tests: one `$factory` to rule them all, and it shall be `static`.
Using more than one instance of `WP_UnitTest_Factory` causes all kinds of craziness, due to out-of-sync internal generator sequences. Since we want to use `setUpBeforeClass`, we were creating ad hoc instances. To avoid that, we were injecting one `static` instance via Dependency Injection in `wpSetUpBeforeClass`. All tests should really use the `static` instance, so we will remove the instance prop `$factory`.

Replace `$this->factory` with `self::$factory` over 2000 times.
Rewrite all of the tests that were hard-coding dynamic values. 

#YOLOFriday



git-svn-id: https://develop.svn.wordpress.org/trunk@35225 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-16 21:04:12 +00:00
Scott Taylor 84272ff8cd Unit Tests: since [32953], we can just use `self::delete_user()` instead of using `if` logic for Multisite.
See #30017, #33968.


git-svn-id: https://develop.svn.wordpress.org/trunk@35224 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-16 19:51:32 +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
Dominik Schilling (ocean90) c6e2e6c1b5 Tests: Remove the `@runTestsInSeparateProcesses` annotation for Ajax tests.
They were added 3 years ago in [846/tests] because tests weren't excluded from the normal runs.

Reverts [35209] because it doesn't work with Xdebug.
`Tests_Ajax_Response::test_response_charset_in_header` is the only test which needs to run in a separate process, see [975/tests].

See #31491.

git-svn-id: https://develop.svn.wordpress.org/trunk@35211 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-15 21:30:52 +00:00
Dominik Schilling (ocean90) 666d07352e Tests: Don't preserve the global state for Ajax tests when using an external object cache.
Most of the Ajax tests are running in a separate PHP process, and thus PHPUnit attempts to preserve the global state from the parent process by serializing all globals. But this doesn't work for external object caches so we have to disable this "feature".

See #31491.

git-svn-id: https://develop.svn.wordpress.org/trunk@35209 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-15 20:34:08 +00:00
Boone Gorges 1b6a8019c3 Fix incorrect variable name introduced in [35197].
See #30017, #33968.

git-svn-id: https://develop.svn.wordpress.org/trunk@35206 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-15 18:47:11 +00:00
Scott Taylor 43d18b25b0 Unit Tests: add/upgrade the fixtures in `Tests_User_Query`.
See #30017, #33968.


git-svn-id: https://develop.svn.wordpress.org/trunk@35197 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-15 07:28:40 +00:00
Scott Taylor 32719bf251 Unit Tests: create fewer terms in `Tests_Term_getTerms::test_get_terms_parent_zero()`
See #30017, #33968.


git-svn-id: https://develop.svn.wordpress.org/trunk@35196 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-15 06:52:19 +00:00
Sergey Biryukov 65390cd9cf In `WP::parse_request()` and `url_to_postid()`, if a post slug clashes with a trashed page, return the post instead of the page.
Props kovshenin, SergeyBiryukov, igmoweb.
Fixes #21970.

git-svn-id: https://develop.svn.wordpress.org/trunk@35195 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-15 06:48:22 +00:00
Scott Taylor 0cf7a91d3a Unit Tests: upgrade the fixtures in `Tests_Post_Thumbnail_Template`.
See #30017, #33968.


git-svn-id: https://develop.svn.wordpress.org/trunk@35194 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-15 06:39:43 +00:00
Scott Taylor a65f390db6 Unit Tests: upgrade the fixtures in `Tests_Post_Revisions`.
See #30017, #33968.


git-svn-id: https://develop.svn.wordpress.org/trunk@35193 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-15 06:31:16 +00:00
Scott Taylor 5fc726c222 Unit Tests: in `Tests_Comment_Query::test_get_comments_for_post()`, create fewer comments (5, instead of 10).
See #30017, #33968.


git-svn-id: https://develop.svn.wordpress.org/trunk@35192 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-15 05:56:47 +00:00
Scott Taylor d424f690d2 Unit Tests: after [35186], "upgrade" the Canonical fixtures.
See #30017, #33968.


git-svn-id: https://develop.svn.wordpress.org/trunk@35191 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-15 05:50:40 +00:00
Sergey Biryukov e675e2ccf0 Users: Add `'illegal_user_logins'` filter to allow certain usernames to be blacklisted.
Props danielbachhuber, chriscct7, crazycoolcam, SergeyBiryukov.
Fixes #27317.

git-svn-id: https://develop.svn.wordpress.org/trunk@35189 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-15 05:42:05 +00:00
Scott Taylor 742082c042 Unit Tests: create more fixtures for `Tests_User`. When using a factory to create ad hoc users, use the inherited static prop `$static_factory` instead of the instance prop, `$factory`. If 2 factories are used out of sync, the generator sequences diverge and dupes can be created, causing an untold number of unforeseen errors. Yay.
See #30017, #33968.


git-svn-id: https://develop.svn.wordpress.org/trunk@35188 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-15 05:29:40 +00:00
Scott Taylor 16d98ebf73 Unit Tests: implement `setUpBeforeClass()` and `tearDownAfterClass()` on `WP_UnitTestCase`. Use late static binding (plus a gross fallback for PHP 5.2) to check if `wpSetUpBeforeClass()` or `wpTearDownAfterClass()` exist on the called class, and then call it and pass a static `WP_UnitTest_Factory` instance via Dependency Injection, if it exists.
This makes it way easier to add fixtures, and tear them down, without needing to instantiate `WP_UnitTest_Factory` in every class - removes the need to call `commit_transaction()` in each individual class.

See #30017, #33968.


git-svn-id: https://develop.svn.wordpress.org/trunk@35186 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-15 04:43:37 +00:00
Scott Taylor e1a09eff54 Unit Tests: in `Tests_Term`, create fixtures for posts.
See #30017, #33968.


git-svn-id: https://develop.svn.wordpress.org/trunk@35185 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-15 03:47:36 +00:00
Scott Taylor 8cc22363db Unit Tests: in `Tests_Post`, create fixtures for users.
See #30017, #33968.


git-svn-id: https://develop.svn.wordpress.org/trunk@35183 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-15 03:30:09 +00:00
Scott Taylor 3cc9adb890 Unit Tests: in `Tests_Media::test_wp_get_attachment_image_srcset_array_no_width()`, just toggle metadata, instead of creating a new attachment. Shaves 75ms off the test.
See #30017, #33968.


git-svn-id: https://develop.svn.wordpress.org/trunk@35181 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-15 02:54:20 +00:00
Scott Taylor 011c1a2e2c Unit Tests: make a fixture in `Tests_Media` to represent the large image, instead of creating it 10 times.
See #30017, #33968.


git-svn-id: https://develop.svn.wordpress.org/trunk@35179 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-15 01:42:27 +00:00
Scott Taylor 75e4de9671 Unit Tests: move some oEmbed tests that can trigger HTTP calls to `Tests_External_HTTP_OEmbed`.
See #30017, #33968.


git-svn-id: https://develop.svn.wordpress.org/trunk@35178 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-15 01:28:05 +00:00
Scott Taylor fc7efaf9b1 Unit Tests: `Tests_Canonical` doesn't need to call `wp_set_current_user()` or implement `tearDown` because its grandparent calls `wp_set_current_user( 0 )` in `tearDown()`.
See #30017, #33968.


git-svn-id: https://develop.svn.wordpress.org/trunk@35177 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-15 01:17:22 +00:00