Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Budget Recommendation data not populating on install #2732

Merged
merged 4 commits into from
Dec 17, 2024

Conversation

mikkamp
Copy link
Contributor

@mikkamp mikkamp commented Dec 17, 2024

Changes proposed in this Pull Request:

This PR fixes an issue that was introduced in PHP 8.4 compatibility code.

The budget recommendation was covered by unit testing, although it used mocked data, so it didn't catch the testing of actually installing the database table. Since we have database tables available during unit testing I added two types of tests:

  1. Trigger the DB install code to run with the unit test DB and confirm it doesn't generate any errors
  2. Query from the DB tables with pre-populated data (which expects the install / population process to have completed)

Closes #2730

Detailed test instructions:

  1. Install extension from scratch
  2. Check the database table wp_gla_budget_recommendations is created and contains rows of imported data

Alternative way to test:

  1. Drop / rename table wp_gla_budget_recommendations
  2. Use this filter to force running the install code add_filter( 'woocommerce_gla_force_run_install', '__return_true' );
  3. Ensure the DB table is recreated and populated

Changelog entry

  • Fix - Budget Recommendation data not populating on install.

@mikkamp mikkamp self-assigned this Dec 17, 2024
@github-actions github-actions bot added type: bug The issue is a confirmed bug. changelog: fix Took care of something that wasn't working. labels Dec 17, 2024
Copy link

codecov bot commented Dec 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 66.6%. Comparing base (e849de8) to head (03be696).
Report is 5 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##             develop   #2732     +/-   ##
===========================================
+ Coverage       66.2%   66.6%   +0.4%     
  Complexity      4691    4691             
===========================================
  Files            479     479             
  Lines          19608   19608             
===========================================
+ Hits           12983   13064     +81     
+ Misses          6625    6544     -81     
Flag Coverage Δ
php-unit-tests 66.6% <100.0%> (+0.4%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/DB/Table/BudgetRecommendationTable.php 96.4% <100.0%> (+48.2%) ⬆️

... and 2 files with indirect coverage changes

@mikkamp mikkamp requested a review from a team December 17, 2024 13:52
@tomalec tomalec self-requested a review December 17, 2024 14:12
Copy link
Member

@tomalec tomalec left a comment

Choose a reason for hiding this comment

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

Thank you for such a quick fitx @mikkamp !
I reviewed the code & tested locally, LGTM

image

@mikkamp mikkamp merged commit 79fcca7 into develop Dec 17, 2024
12 checks passed
@mikkamp mikkamp deleted the fix/2730-budget-recommendations-data branch December 17, 2024 14:23
@eason9487 eason9487 mentioned this pull request Dec 18, 2024
22 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog: fix Took care of something that wasn't working. type: bug The issue is a confirmed bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Budget recommendations are broken for fresh installs
2 participants