Wordpress/tests/phpunit/tests/term
Boone Gorges 5fef526cca Taxonomy: Better error handling when fetching object terms from cache.
Since [37573], `get_object_term_cache()` has expected term IDs to be
stored in the taxonomy relationship cache. The function would then
reach directly into the 'terms' cache to fetch the data corresponding
to a given term, before returning a `WP_Term` object. This caused
problems when, for one reason or another, term data was cached
inconsistently:

* If the 'terms' cache is empty for a given term ID, despite the earlier call to `_prime_term_caches()`, `get_term()` would return an error object.
* If the array of cached term IDs contains an invalid ID, `get_term()` would return an error object.

We avoid these errors by no longer touching the 'terms' cache directly,
but running term IDs through `get_term()` and allowing that function to
reference the cache (and database, as needed). If `get_term()` returns
an error object for any of the cached term IDs, `get_object_term_cache()`
will return that error object alone. This change ensures that upstream
functions, like `get_the_terms()`, return `WP_Error` objects in a
predictable fashion.

Props dd32, michalzuber.
Fixes #37291.

git-svn-id: https://develop.svn.wordpress.org/trunk@38776 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-11 01:55:58 +00:00
..
cache.php Taxonomy: Better error handling when fetching object terms from cache. 2016-10-11 01:55:58 +00:00
categoryExists.php 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. 2015-10-17 18:02:16 +00:00
getEditTermLink.php Fix test related to cap check in get_edit_term_link(). 2016-03-14 01:51:12 +00:00
getTerm.php Make get_term() behave more consistently in the context of shared terms. 2015-11-05 16:44:59 +00:00
getTermBy.php Taxonomy: Use WP_Term_Query in get_term_by(). 2016-09-29 22:35:32 +00:00
getTermField.php Tests: Add some more test coverage for get_term_field(). 2015-10-19 03:28:49 +00:00
getTermLink.php 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. 2015-10-17 18:02:16 +00:00
getTerms.php Build/Test Tools: Remove many unnecessary calls to rand_str() which can, in theory, fail at random. Static strings are much more appropriate. 2016-08-26 20:21:30 +00:00
getTheTerms.php Unit Tests: 2016-08-27 08:35:16 +00:00
isObjectInTerm.php In is_object_in_term(), return error object rather than caching it. 2016-08-18 19:14:52 +00:00
meta.php Allow term meta lazy-loading to be selectively disabled in WP_Query. 2016-05-28 03:09:09 +00:00
query.php Taxonomy: Use WP_Term_Query when querying for object terms. 2016-09-28 03:54:36 +00:00
slashes.php 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). 2015-10-17 19:24:20 +00:00
splitSharedTerm.php
taxQuery.php Tests: Move WP_Tax_Query tests to a more appropriate file. 2016-06-11 03:26:07 +00:00
termExists.php 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. 2015-10-17 18:02:16 +00:00
wpDeleteObjectTermRelationships.php 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. 2015-10-17 18:02:16 +00:00
wpDeleteTerm.php Taxonomy: Pass object ids to delete_* actions. 2015-12-23 23:43:03 +00:00
wpGenerateTagCloud.php Better focus in tag cloud tests. 2015-12-17 17:11:07 +00:00
wpGetObjectTerms.php Taxonomy: Use WP_Term_Query when querying for object terms. 2016-09-28 03:54:36 +00:00
wpInsertTerm.php Build/Test Tools: Remove many unnecessary calls to rand_str() which can, in theory, fail at random. Static strings are much more appropriate. 2016-08-26 20:21:30 +00:00
wpRemoveObjectTerms.php Bust object term cache in wp_remove_object_terms(). 2015-10-19 01:52:22 +00:00
wpSetObjectTerms.php Taxonomy: Use WP_Term_Query when querying for object terms. 2016-09-28 03:54:36 +00:00
wpTaxonomy.php Taxonomy: Introduce WP_Taxonomy and use it in register_taxonomy() and unregister_taxonomy(). 2016-10-07 17:11:02 +00:00
wpTerm.php Unit Tests: 2016-08-27 08:35:16 +00:00
wpUniqueTermSlug.php 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. 2015-10-17 18:02:16 +00:00
wpUpdateTerm.php Don't clear object relationship caches on term update. 2016-05-30 04:10:16 +00:00