fix: visualizer getCSV method throwing constant errors#1263
fix: visualizer getCSV method throwing constant errors#1263HardeepAsrani wants to merge 3 commits intodevelopmentfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR aims to stop Visualizer’s CSV export (_getCSV) from repeatedly triggering runtime errors by adding additional safeguards around temporary file creation, and updates the test suite/tooling to support newer PHPUnit behavior.
Changes:
- Add a fallback/early-return guard in
Visualizer_Module::_getCSV()when a writable temp file handle can’t be created. - Refactor/export tests to reuse a helper for running the export AJAX action and add CSV response-structure assertions.
- Add Yoast PHPUnit Polyfills (and bootstrap loading) to improve PHPUnit cross-version compatibility; update
composer.lockaccordingly.
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
classes/Visualizer/Module.php |
Adds additional guard(s) when temp file creation fails during CSV generation. |
tests/test-export.php |
Adds a helper to run export AJAX, adds CSV structure test, adjusts invalid-chart expectations. |
tests/test-ajax.php |
Replaces deprecated PHPUnit assertions with property_exists() checks. |
tests/bootstrap.php |
Loads Yoast PHPUnit Polyfills autoloader early in the test bootstrap. |
composer.json |
Adds yoast/phpunit-polyfills to require-dev. |
composer.lock |
Locks new dev dependencies brought in by PHPUnit polyfills/tooling changes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Soare-Robert-Daniel
left a comment
There was a problem hiding this comment.
I think Copilot made some great points on the review.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 6 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
Adds safeguards to prevent the
_getCSVfrom throwing constant errors.Will affect visual aspect of the product
YES/NO
Screenshots
Test instructions
Check before Pull Request is ready:
Closes https://github.com/Codeinwp/visualizer-pro/issues/400.