Skip to content

Conversation

@sbarbosa
Copy link
Contributor

@sbarbosa sbarbosa commented Jan 20, 2026

Part of ADS-626

Proposed changes:

This PR adds a coverage test for the Dashboard_REST_Controller. It should include the missing coverage from my last three PRs (#46642, #46623 and #46578)

The only noticeable change I made to the base class is allowing the connection manager to be sent in the constructor, so I can correctly test those controllers.

Other information:

  • Have you written new tests for your changes, if applicable?
  • Have you checked the E2E test CI results, and verified that your changes do not break them?
  • Have you tested your changes on WordPress.com, if applicable (if so, you'll see a generated comment below with a script to run)?

Jetpack product discussion

N/A

Does this pull request change what data or activity we track or use?

No

Testing instructions:

  • Go to Tools->Advertising
  • Check that the Blaze Dashboard loads fine and that you are able to create campaigns.

@sbarbosa sbarbosa self-assigned this Jan 20, 2026
Copilot AI review requested due to automatic review settings January 20, 2026 17:51
@sbarbosa sbarbosa added [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it [Status] Needs Review This PR is ready for review. [Package] Blaze labels Jan 20, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Jan 20, 2026

Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.

  • To test on WoA, go to the Plugins menu on a WoA dev site. Click on the "Upload" button and follow the upgrade flow to be able to upload, install, and activate the Jetpack Beta plugin. Once the plugin is active, go to Jetpack > Jetpack Beta, select your plugin (Jetpack or WordPress.com Site Helper), and enable the add/unit-tests-to-blaze-controllers branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack add/unit-tests-to-blaze-controllers
bin/jetpack-downloader test jetpack-mu-wpcom-plugin add/unit-tests-to-blaze-controllers

Interested in more tips and information?

  • In your local development environment, use the jetpack rsync command to sync your changes to a WoA dev blog.
  • Read more about our development workflow here: PCYsg-eg0-p2
  • Figure out when your changes will be shipped to customers here: PCYsg-eg5-p2

@github-actions
Copy link
Contributor

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ Add a "[Status]" label (In Progress, Needs Review, ...).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖


Follow this PR Review Process:

  1. Ensure all required checks appearing at the bottom of this PR are passing.
  2. Make sure to test your changes on all platforms that it applies to. You're responsible for the quality of the code you ship.
  3. You can use GitHub's Reviewers functionality to request a review.
  4. When it's reviewed and merged, you will be pinged in Slack to deploy the changes to WordPress.com simple once the build is done.

If you have questions about anything, reach out in #jetpack-developers for guidance!

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds comprehensive unit test coverage for the Dashboard_REST_Controller class in the Blaze package. The tests validate the functionality implemented in three previous PRs that handle local post data processing when Jetpack sync is not yet complete.

Changes:

  • Added extensive test suite with 1481 lines covering all Dashboard_REST_Controller endpoints
  • Introduced WooCommerce mocks to test product price functionality
  • Modified Dashboard_REST_Controller to accept Connection_Manager via constructor for better testability

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
projects/packages/blaze/tests/php/Dashboard_REST_Controller_Test.php Comprehensive test suite covering authentication, endpoint redirection, local post processing, and WooCommerce integration
projects/packages/blaze/tests/php/mocks/class-wc-product.php Mock WC_Product classes for testing product price functionality
projects/packages/blaze/tests/php/mocks/woocommerce-functions.php Mock WooCommerce functions for price formatting and product retrieval
projects/packages/blaze/tests/php/bootstrap.php Updated to load WooCommerce mocks before test environment initialization
projects/packages/blaze/src/class-dashboard-rest-controller.php Added constructor with optional Connection_Manager parameter for dependency injection
projects/packages/blaze/changelog/add-unit-tests-to-blaze-controllers Changelog entry documenting test coverage addition

@sbarbosa sbarbosa added [Status] In Progress and removed [Status] Needs Review This PR is ready for review. labels Jan 20, 2026
@jp-launch-control
Copy link

jp-launch-control bot commented Jan 20, 2026

Code Coverage Summary

Coverage changed in 1 file.

File Coverage Δ% Δ Uncovered
projects/packages/blaze/src/class-dashboard-rest-controller.php 695/772 (90.03%) 90.03% -696 💚

Full summary · PHP report · JS report

Copilot AI review requested due to automatic review settings January 21, 2026 15:12
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Copilot AI review requested due to automatic review settings January 21, 2026 18:48
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

@sbarbosa sbarbosa requested a review from therocket-gr January 22, 2026 19:47
Copy link
Contributor

@EkaterinaStancheva EkaterinaStancheva left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍 Thank you! I tested and it works as expected!

@sbarbosa sbarbosa merged commit 8d48263 into trunk Jan 23, 2026
71 checks passed
@sbarbosa sbarbosa deleted the add/unit-tests-to-blaze-controllers branch January 23, 2026 12:53
@github-actions github-actions bot removed the [Status] Needs Review This PR is ready for review. label Jan 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] Blaze [Tests] Includes Tests [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants