Unactioned Review Feedback
Source PR: #825
File: tests/WP_Ultimo/Helpers/Site_Duplicator_Test.php
Reviewers: coderabbit
Findings: 1
Max severity: medium
MEDIUM: coderabbit (coderabbitai[bot])
File: tests/WP_Ultimo/Helpers/Site_Duplicator_Test.php:615
⚠️ Potential issue | 🟡 Minor
Make this test fail when it can't reach the payload assertions.
If duplicate_site() returns WP_Error, this test silently skips every assertion about wu_duplicate_site. That turns an environment or duplication failure into a false positive for the new contract.
✅ Tighten the assertion path
$result = Site_Duplicator::duplicate_site($this->template_site_id, 'Action Test Site', $args);
-
- if ( ! is_wp_error($result)) {
- $this->assertIsArray($captured);
- $this->assertArrayHasKey('from_site_id', $captured);
- $this->assertArrayHasKey('site_id', $captured);
- $this->assertEquals($this->template_site_id, $captured['from_site_id']);
- $this->assertEquals($result, $captured['site_id']);
-
- wpmu_delete_blog($result, true);
- }
+ if (is_wp_error($result)) {
+ $this->fail('Site duplication failed: ' . $result->get_error_message());
+ }
+
+ $this->assertIsArray($captured);
+ $this->assertArrayHasKey('from_site_id', $captured);
+ $this->assertArrayHasKey('site_id', $captured);
+ $this->assertEquals($this->template_site_id, $captured['from_site_id']);
+ $this->assertEquals($result, $captured['site_id']);
+
+ wpmu_delete_blog($result, true);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@tests/WP_Ultimo/Helpers/Site_Duplicator_Test.php` around lines 604 - 615,
Change the test so it fails immediately when Site_Duplicator::duplicate_site
returns a WP_Error instead of silently skipping assertions: after calling
Site_Duplicator::duplicate_site($this->template_site_id, 'Action Test Site',
$args) check the result with an assertion that it is not a WP_Error (e.g.
assertFalse(is_wp_error($result)) or assertNotInstanceOf(WP_Error::class,
$result)) and include the WP_Error message for context; then proceed to assert
against $captured and call wpmu_delete_blog($result, true) only when that
assertion passes.
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.8.22 automated scan.
Unactioned Review Feedback
Source PR: #825
File:
tests/WP_Ultimo/Helpers/Site_Duplicator_Test.phpReviewers: coderabbit
Findings: 1
Max severity: medium
MEDIUM: coderabbit (coderabbitai[bot])
File:
⚠️ Potential issue | 🟡 Minor
tests/WP_Ultimo/Helpers/Site_Duplicator_Test.php:615Make this test fail when it can't reach the payload assertions.
If
duplicate_site()returnsWP_Error, this test silently skips every assertion aboutwu_duplicate_site. That turns an environment or duplication failure into a false positive for the new contract.✅ Tighten the assertion path
🤖 Prompt for AI Agents
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.8.22 automated scan.