Skip to:
Content

BuddyPress.org

Opened 8 weeks ago

Last modified 5 days ago

#9344 assigned enhancement

Test tool and unit test improvements for 15.0

Reported by: espellcaste Owned by: espellcaste
Priority: normal Milestone: 15.0.0
Component: Build/Test Tools Version:
Severity: normal Keywords:
Cc:

Description

This ticket is for various fixes and improvements in PHPUnit tests that don't have a more specific ticket.

Inspired by ​wp:#65819

Change History (42)

#1 @espellcaste
8 weeks ago

In 14312:

Tests: Remove redundant current-user resets.

Rely on WordPress test teardown to reset the current user after each test. Remove terminal resets and their now-unused saved-user variables.

This might have had some purpose in the past, but they are no longer necessary.

See #9344.

#2 @espellcaste
8 weeks ago

In 14313:

Tests: Use factories for ordinary fixture creation.

Replace direct object creation with test factories when arranging activity, friendship, notification, and xProfile fixtures.

See #9344.

#3 @espellcaste
7 weeks ago

In 14314:

Tests: Use assertWPError() for error assertions.

Replace generic WP_Error checks with the dedicated test assertion across activity and core tests.

See #9344.

#4 @espellcaste
7 weeks ago

In 14315:

Tests: Use specific assertions for counts and values.

Replace count comparisons with assertCount() and direct value comparisons with assertSame().

See #9344.

#5 @espellcaste
7 weeks ago

In 14316:

Tests: Use null coalescing in PHPUnit tests.

See #9344.

#6 @espellcaste
7 weeks ago

In 14317:

Tests: Consolidate PHPUnit group annotations.

Move, duplicate, shared @group annotations from test methods to their classes.

See #9344.

#7 @espellcaste
7 weeks ago

In 14318:

Fix warnings in friendship and group member classes.

Remove extra arguments from populate() and get_user_object() calls. Return null for unsupported properties in BP_Groups_Member::__get().

See #9344.

#8 @espellcaste
7 weeks ago

In 14319:

Tests: Remove unused current-user variables from blog tests.

Remove $old_user assignments that are never used to restore the current user.

See #9344.

#9 @espellcaste
7 weeks ago

In 14320:

Tests: Use multisite skip helpers in PHPUnit tests.

Replace manual is_multisite() skip checks with skipWithMultisite() and skipWithoutMultisite() across component tests.

See #9344.

#10 @espellcaste
7 weeks ago

In 14322:

Tests: Fix multisite REST API unit tests.

  • Use valid, unique usernames in the signup test.
  • Restore the Blogs component after the component deactivation test so it cannot affect later tests.
  • Add checks for the blog link and embedded data in the notification test.

See #9344.

#11 @espellcaste
5 weeks ago

In 14331:

Tests: Add missing REST response preparation and context coverage.

Replace five skipped placeholders with assertions for group and member avatar and cover responses, including edit-only additional fields.
See #9344.

#12 @espellcaste
5 weeks ago

In 14332:

REST API: Add response preparation coverage.

Replace six skipped tests for components, group invitations, memberships, membership requests, messages, and sitewide notices with response preparation assertions.

Include the schema-declared group_id in membership responses while retaining group for compatibility.

See #9344.

#13 @espellcaste
5 weeks ago

In 14334:

Tests: Add success coverage for avatar deletion and cover image operations.

Replace eight skipped REST tests for group and member images. Use factory fixtures and real files in isolated temporary storage to verify avatar deletion, cover retrieval and upload, generated image sizes, and file removal.

See #9344.

#14 @espellcaste
5 weeks ago

In 14335:

Groups: Fix searches for text stored with escaped quotes and backslashes.

Match both raw and WordPress-slashed search terms in prepared LIKE conditions. This restores apostrophe-prefixed name searches while supporting both storage formats without changing saved data or sanitization.

Enable the apostrophe regression and add strict assertions for quotes, backslashes, literal wildcard characters, pagination, totals, exclusions, and repeated queries.

See #9344.

#15 @espellcaste
5 weeks ago

In 14337:

Tests: Re-enable root-profile coverage for a nested Members directory.

The test used stale rewrite rules after changing the directory hierarchy. Correct the parent page fixture and rebuild routing before checking the nested directory and root-level profile URLs.

See #9344.

#16 @espellcaste
5 weeks ago

In 14338:

Tests: Cover Blogs and Blog Avatar REST response preparation.

Replace skipped placeholders with assertions for response data and context filtering. Verify blog response links and the latest-post fallback, and restore additional REST fields after each test.

See #9344.

#17 @espellcaste
5 weeks ago

In 14339:

Tests: Remove redundant current-user restoration handled by shared teardown.

The parent test case already resets the current user after each test.

See #9344.

#18 @espellcaste
5 weeks ago

In 14340:

Tests: Declare test methods explicitly public for consistency.

Add public visibility to the remaining 45 implicit-public methods across 13 test files. This makes test declarations consistent.

See #9344.

#19 @espellcaste
5 weeks ago

In 14341:

Tests: Reduce routing test duplication with shared setup and data providers.

Move permalink configuration into set_up() and consolidate repeated Activity, Messages and XProfile cases into named datasets.

See #9344.

#20 @espellcaste
5 weeks ago

In 14342:

Tests: Use wp_set_current_user() instead of the deprecated helper.

Replace eight internal calls to BP_UnitTestCase::set_current_user() with the WordPress function it wraps. The deprecated helper remains available for plugin authors, and it will be completely removed in the next BuddyPress major version.

See #9344.

#21 @espellcaste
5 weeks ago

In 14343:

Tests: Improve assertions in our test suite.

Use dedicated assertions for WordPress errors, types and null values. Name message datasets, remove the duplicate empty-string input, and correct provider documentation.

See #9344.

#22 @espellcaste
5 weeks ago

In 14345:

Tests: Make data providers static in preparation for PHPUnit 10.

PHPUnit 10 requires data providers to be static. Update 13 declarations across 10 test files without changing datasets or assertions.

See #9344.

#23 @espellcaste
5 weeks ago

In 14357:

Tests: Use specific PHPUnit assertions for clearer failure messages.

Replace indirect checks with dedicated assertions.

See #9344.

#24 @espellcaste
8 days ago

In 14397:

Tests: Restore signup object cache coverage.

Make the test discoverable and check the signup lookup separately from unrelated avatar queries.

See #9344 (trunk).

#25 @espellcaste
8 days ago

In 14398:

Tests: Avoid the PHP 8.5 reflection deprecation.

Call setAccessible() only before PHP 8.1, where private properties still require it. Use a readable PHP version comparison in the test installer.

See #9344 (trunk).

#26 @espellcaste
8 days ago

In 14399:

Tests: Fail on deprecations during PHPUnit tests.

Convert deprecations to exceptions in the single-site and multisite configurations so tests report them as errors.

See #9344 (trunk).

#27 @espellcaste
5 days ago

In 14403:

CI: Migrate PHP testing to action-test-php and expand WordPress coverage.

Share setup between single-site and multisite suites, test rolling and older WordPress releases, and keep known Core incompatibilities advisory.

Closes ​https://github.com/buddypress/buddypress/pull/449.
See #9344 (trunk).

#28 @espellcaste
5 days ago

In 14406:

Tests: Include blog REST tests in the single-site suite.

Remove the default exclusions and assert that multisite-only blog routes are absent on single-site. Environment skips remain for operations that need multisite.

See #9344 (trunk).

#29 @espellcaste
5 days ago

In 14407:

Tests: Verify unsupported avatar and cover update routes.

Assert PUT and PATCH return rest_no_route rather than permanently skipping unsupported operations. Preserve each endpoint limitation as a comment.

See #9344 (trunk).

#30 @espellcaste
5 days ago

In 14408:

Tests: Verify unsupported blog REST operations.

Replace five permanent skips with no-route assertions. These operations are unsupported, not unfinished features.

See #9344 (trunk).

#31 @espellcaste
5 days ago

In 14409:

Tests: Verify unsupported component REST routes.

Assert no single-item GET or collection DELETE route exists. POST remains supported for updates, so the create placeholder is deliberately unchanged.

See #9344 (trunk).

#32 @espellcaste
5 days ago

In 14410:

Tests: Verify components use table names provided by filters.

Check that BP_Component applies filtered table names to its global and metadata table registrations.

See #9344 (trunk).

#33 @espellcaste
5 days ago

In 14411:

Tests: Verify component REST routes respect controller selection.

Check that selected controllers register their routes, while disabled or unknown controllers do not.

See #9344 (trunk).

#34 @espellcaste
5 days ago

In 14412:

Tests: Verify component navigation defaults and custom settings.

Check that navigation items receive default rewrite IDs unless explicitly overridden or disabled, and that incomplete subnavigation items are ignored.

See #9344 (trunk).

#35 @espellcaste
5 days ago

In 14413:

Tests: Prevent group and directory state from leaking between tests.

Clear the current group, directory types and invitation loop state so later tests do not inherit filters or loop data from earlier requests.

See #9344 (trunk).

#36 @espellcaste
5 days ago

In 14414:

Tests: Isolate group template loops between tests.

Prevent group loops and the current group from affecting later tests. Restore the previous state even when the saved loop is null.

See #9344 (trunk).

#37 @espellcaste
5 days ago

In 14415:

Tests: Make group schema checks independent of test order.

Ensure the schema includes the group types created by the test, rather than reusing a schema cached before those types existed.

See #9344 (trunk).

#38 @espellcaste
5 days ago

In 14416:

Tests: Make xProfile REST schema checks independent of test order.

Prevent the test field foo_metadata_key from affecting later tests. Check the six built-in schema properties without relying on a field added by another test.

See #9344 (trunk).

#39 @espellcaste
5 days ago

In 14417:

Tests: Prevent signup settings from affecting later tests.

Restore the original users_can_register setting after signup tests in both single-site and multisite.

See #9344 (trunk).

#40 @espellcaste
5 days ago

In 14418:

Tests: Make registration page checks independent of test order.

Ensure missing-page, activation-notice and registration-change tests start with the page mappings and signup settings their scenarios require.

See #9344 (trunk).

#41 @espellcaste
5 days ago

In 14419:

Tests: Make theme compatibility checks independent of test order.

Prevent changes to BuddyPress theme support from affecting other compatibility checks or later tests.

See #9344 (trunk).

#42 @espellcaste
5 days ago

In 14420:

Tests: Organize PHPUnit groups by component.

Keep component and useful cross-cutting groups instead of narrow selectors. Preserve ticket references as @see links, intentionally removing ticket-based group selection.

See #9344 (trunk).

Note: See TracTickets for help on using tickets.