wordpress-develop/tests/phpunit/tests/post
Sergey Biryukov dfb4737c43 Code Modernization: Explicitly declare all properties in various tests.
Dynamic (non-explicitly declared) properties are deprecated as of PHP 8.2 and are expected to become a fatal error in PHP 9.0.

In each of the cases included in this commit, one or more individual tests set a property to allow a filter or action access to certain information.

This commit:
* Explicitly declares these properties and documents in which tests they are being used.
* Adds a reset to the default value of the property to a pre-existing `tear_down()` method or adds that method specifically for that purpose. This ensures that tests do not accidentally “taint” each other.

As these properties are being declared on test classes, they are marked as private. Even though the original dynamic property was public, this should not be considered a backward compatibility break as this only involves test classes.

Includes:
* In the `Tests_Post_Query` class, there were two tests assigning a value to an undeclared `$post_id` property, but subsequently not using the property, so those assignments should have been to a local variable (if they should be assignments at all).
* In the `Test_User_Capabilities` class, the property name had a leading `_` underscore. This is an outdated PHP 4 practice to indicate a private property. As PHP 4 is no longer supported, the leading underscore is removed from the property name.
* In the `Tests_User_Capabilities` class, an unused `$_role_test_wp_roles_role` property was declared somewhere in the middle of the class. That property is now removed in favor of `$_role_test_wp_roles_init`, which appears to be the intended name, previously misspelled.

Follow-up to [27294], [36277], [36750], [37712], [38571], [39082], [40290], [43049], [44628], [48328], [53557], [53558], [53850], [53851], [53852], [53853], [53854], [53856], [53916], [53935], [53936], [53937], [53938].

Props jrf.
See #56033.

git-svn-id: https://develop.svn.wordpress.org/trunk@53942 602fd350-edb4-49c9-b593-d223f7449a82
2022-08-25 15:34:24 +00:00
..
attachments.php Build/Test Tools: Reduce the use of unnecessary randomness in tests. 2021-12-19 13:42:37 +00:00
bodyClass.php Build/Test Tools: Implement use of the void solution. 2021-08-07 10:29:41 +00:00
filtering.php Coding Standards: Add visibility to methods in tests/phpunit/tests/. 2021-11-04 15:22:47 +00:00
formats.php Coding Standards: Add visibility to methods in tests/phpunit/tests/. 2021-11-04 15:22:47 +00:00
getAttachedFile.php Media: Account for Windows when normalizing file paths. 2022-08-23 19:57:17 +00:00
getBodyClass.php Build/Test Tools: Implement use of the void solution. 2021-08-07 10:29:41 +00:00
getLastPostDate.php Tests: First pass at using assertSame() instead of assertEquals() in most of the unit tests. 2020-09-02 00:35:36 +00:00
getLastPostModified.php Tests: First pass at using assertSame() instead of assertEquals() in most of the unit tests. 2020-09-02 00:35:36 +00:00
getPageByPath.php Build/Test Tools: Replace assertInternalType() usage in unit tests. 2021-07-05 17:21:53 +00:00
getPageChildren.php Build/Test Tools: Implement use of the void solution. 2021-08-07 10:29:41 +00:00
getPages.php Coding Standards: Add visibility to methods in tests/phpunit/tests/. 2021-11-04 15:22:47 +00:00
getPageUri.php Coding Standards: Add visibility to methods in tests/phpunit/tests/. 2021-11-04 15:22:47 +00:00
getPostClass.php Build/Test Tools: Implement use of the void solution. 2021-08-07 10:29:41 +00:00
getPosts.php Code is Poetry. 2017-11-30 23:09:33 +00:00
getPostsByAuthorSql.php Tests: Replace assertNotRegExp() with assertDoesNotMatchRegularExpression(). 2021-08-06 21:55:31 +00:00
getPostStatus.php Code Modernization: Replace strftime() and gmstrftime() usage in unit tests. 2021-08-09 19:08:09 +00:00
getPostTypeLabels.php Build/Test Tools: Replace assertInternalType() usage in unit tests. 2021-07-05 17:21:53 +00:00
getTheContent.php Tests: Replace assertContains() with assertStringContainsString() when used with strings. 2021-07-19 14:00:11 +00:00
getTheExcerpt.php Posts: Prevent an empty excerpt when groups and nested column blocks are present. 2021-07-06 15:31:48 +00:00
isPostPubliclyViewable.php Code Modernization: Replace strftime() and gmstrftime() usage in unit tests. 2021-08-09 19:08:09 +00:00
isPostStatusViewable.php Coding Standards: Add visibility to methods in tests/phpunit/tests/. 2021-11-04 15:22:47 +00:00
isPostTypeViewable.php Coding Standards: Upgrade WPCS to 1.0.0 2018-08-17 01:50:26 +00:00
meta.php Build/Test Tools: Reduce the use of unnecessary randomness in tests. 2021-12-19 13:42:37 +00:00
nav-menu.php Tests: Use assertSameSets() in some newly introduced tests. 2022-06-15 14:42:58 +00:00
objects.php Coding Standards: Add visibility to methods in tests/phpunit/tests/. 2021-11-04 15:22:47 +00:00
output.php Administration: Replace contracted verb forms for better consistency. 2022-03-22 16:23:32 +00:00
pings.php Tests: Rename some files and classes in phpunit/tests/post/ per the naming conventions. 2020-10-27 16:07:21 +00:00
postClass.php Build/Test Tools: Implement use of the void solution. 2021-08-07 10:29:41 +00:00
query.php Code Modernization: Explicitly declare all properties in various tests. 2022-08-25 15:34:24 +00:00
revisions.php Code Modernization: Remove dynamic properties in Tests_Post_Revisions. 2022-08-07 14:41:04 +00:00
slashes.php Code Modernization: Remove dynamic properties in Tests_*_Slashes. 2022-06-23 14:24:08 +00:00
template.php Coding Standards: Add visibility to methods in tests/phpunit/tests/. 2021-11-04 15:22:47 +00:00
thumbnails.php Tests: Consistently pass the $force_delete parameter to wp_delete_attachment(). 2022-06-04 13:39:17 +00:00
types.php Posts, Post Types/Taxonomies: Add object type specific registration filters. 2022-04-11 05:09:53 +00:00
updatePostAuthorCaches.php Query: Some documentation and test improvements for update_post_author_caches(): 2022-06-10 15:15:07 +00:00
updatePostCache.php Query: Some documentation and test improvements for update_post_author_caches(): 2022-06-10 15:15:07 +00:00
walkerPage.php Coding Standards: Use static closures when not using $this. 2021-08-26 12:57:08 +00:00
wpAfterInsertPost.php Coding Standards: Add visibility to methods in tests/phpunit/tests/. 2021-11-04 15:22:47 +00:00
wpGetPostParentId.php Posts, Post Types: Use global post as the default for wp_get_post_parent_id(). 2021-11-17 03:23:40 +00:00
wpInsertPost.php Posts, Post Types: Prevent categories from being overwritten when updating a post using wp_insert_post(). 2022-08-11 19:58:21 +00:00
wpListPages.php Coding Standards: Add visibility to methods in tests/phpunit/tests/. 2021-11-04 15:22:47 +00:00
wpPost.php Build/Test Tools: Standardise the name, signature, and usage of the wpSetUpBeforeClass() method that's used in test classes. 2020-11-15 13:59:32 +00:00
wpPostType.php Posts, Post Types/Taxonomies: Add object type specific registration filters. 2022-04-11 05:09:53 +00:00
wpPublishPost.php Tests: Move wp_publish_post() tests to their own file. 2022-07-26 14:28:57 +00:00
wpUniquePostSlug.php Coding Standards: Add visibility to methods in tests/phpunit/tests/. 2021-11-04 15:22:47 +00:00