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 unit tests on GravityForms 2.9 #2212

Merged
merged 2 commits into from
Nov 20, 2024
Merged

Fix unit tests on GravityForms 2.9 #2212

merged 2 commits into from
Nov 20, 2024

Conversation

doekenorg
Copy link
Contributor

@doekenorg doekenorg commented Nov 20, 2024

Gravity Forms added a caching mechanism, and since we test multiple states in the same test, instead of separate tests with a data provider it hits this cache. This PR clears that cache for every _emulate_render call.

Also removed any lingering GFFormsModel::is_html5_enabled calls as that is deprecated; and has been returning true for a while now.

💾 Build file (290e52f).

@doekenorg doekenorg requested a review from mrcasual November 20, 2024 08:24
@@ -476,6 +476,11 @@ private function _reset_context() {
* and second item the render instance, and third item is the reloaded entry.
*/
private function _emulate_render( $form, $view, $entry ) {
// Get clean form every test.
if ( method_exists( GFFormDisplay::class, 'flush_cached_forms' ) ) {
GFFormDisplay::flush_cached_forms();
Copy link
Collaborator

Choose a reason for hiding this comment

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

@doekenorg 👍

@mrcasual mrcasual merged commit 7e4ebe3 into develop Nov 20, 2024
2 checks passed
@doekenorg doekenorg deleted the hotfix/unit-tests branch November 20, 2024 13:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants