Skip to content

quality-debt: tests/WP_Ultimo/Models/Membership_Test.php — PR #1693 review feedback (high) #1696

Description

@superdav42

Unactioned Review Feedback

Source PR: #1693
File: tests/WP_Ultimo/Models/Membership_Test.php
Reviewers: coderabbit
Findings: 1
Max severity: high


HIGH: coderabbit (coderabbitai[bot])

File: tests/WP_Ultimo/Models/Membership_Test.php:1110
📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

Use wu_create_product() for the product fixture.

The test rules require wu_create_*() helpers for test data. Assert that the helper does not return WP_Error before creating the cart.

Proposed fix
-		$network_product = new Product(
-			[
+		$network_product = wu_create_product(
+			[
 				'name'          => 'Network Plan',
 				'slug'          => 'network-plan-' . wp_generate_password(6, false),
 				'description'   => 'A custom plan type registered by an addon',
@@
 				'active'        => true,
+				'skip_validation' => true,
 			]
 		);
-		$network_product->set_skip_validation(true);
-		$network_product->save();
+		$this->assertNotWPError($network_product);
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

		$network_product = wu_create_product(
			[
				'name'            => 'Network Plan',
				'slug'            => 'network-plan-' . wp_generate_password(6, false),
				'description'     => 'A custom plan type registered by an addon',
				'pricing_type'    => 'paid',
				'amount'          => 49.00,
				'currency'        => 'USD',
				'duration'        => 1,
				'duration_unit'   => 'month',
				'type'            => 'network',
				'recurring'       => true,
				'active'          => true,
				'skip_validation' => true,
			]
		);
		$this->assertNotWPError($network_product);
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/WP_Ultimo/Models/Membership_Test.php` around lines 1094 - 1110, Replace
the manual Product construction, skip-validation call, and save in the network
product fixture with the `wu_create_product()` helper, preserving the existing
network product attributes. Assert that the helper result is not a `WP_Error`
before using it to create the cart.

Source: Coding guidelines

View comment



Auto-generated by quality-feedback-helper.sh scan-merged. Review each finding and either fix the code or dismiss with a reason.


aidevops.sh v3.32.228 automated scan.

Metadata

Metadata

Assignees

No one assigned

    Labels

    auto-dispatchorigin:workerAuto-created by pulse labelless backfill (t2112)priority:highHigh severity — significant quality issuequality-debtUnactioned review feedback from merged PRssource:review-feedbackAuto-created by quality-feedback-helper.shstatus:availableTask is available for claimingtier:standardAuto-created by pulse labelless backfill (t2112)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions