Skip to content

Tests: Refactor weak assertions in test-form-wc-order.php #334

@priethor

Description

@priethor

Summary

The test-form-wc-order.php file contains 5 tests with weak assertTrue(true) assertions that only verify code executes without throwing errors.

Location

tests/php/includes/forms/test-form-wc-order.php (introduced in #295)

Affected Tests

  1. test_add_meta_boxes_with_null_post (line 214)
  2. test_order_edit_form_top_outputs_form_data (line 276)
  3. test_render_meta_box_with_post_object (line 302)
  4. test_render_meta_box_with_order_object (line 328)
  5. test_save_order_returns_early_without_acf_data (line 346)

Suggested Approach

Refactor to use meaningful assertions similar to the pattern used in #333:

  • Use acf_get_validation_errors() where applicable
  • Check for specific output content with assertStringContainsString()
  • Verify action hooks are/aren't added with has_action()

Related

Follow-up to #333 which refactored similar weak assertions in other form type tests.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions