Load lang on init hook#2144
Conversation
|
Caution Review failedThe pull request is closed. WalkthroughThe pull request modifies the Changes
Possibly related PRs
Warning Rate limit exceeded@Crabcyborg has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 17 minutes and 54 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (1)
tests/phpunit/misc/test_FrmMisc.php (1)
Line range hint
11-18: Consider adding timing-specific test cases.While the current test verifies the hook registration, it would be valuable to add test cases that specifically verify the timing dependency between language loading and form actions registration. This would help ensure the critical requirement that translations are loaded before form actions are registered.
Example test addition:
public function test_load_formidable_forms() { global $frm_vars; $this->assertNotEmpty( $frm_vars ); $this->assertTrue( isset( $frm_vars['load_css'] ) ); $this->assertTrue( isset( $frm_vars['pro_is_authorized'] ) ); $this->assertNotEmpty( has_action( 'init', 'FrmAppController::load_lang' ) ); + + // Verify load_lang runs before form actions registration + $lang_priority = has_action( 'init', 'FrmAppController::load_lang' ); + $actions_priority = has_action( 'init', 'FrmFormActionsController::register_post_types' ); + $this->assertNotFalse( $lang_priority ); + $this->assertNotFalse( $actions_priority ); + $this->assertLessThan( $actions_priority, $lang_priority ); }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (2)
classes/controllers/FrmHooksController.php(1 hunks)tests/phpunit/misc/test_FrmMisc.php(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- classes/controllers/FrmHooksController.php
🔇 Additional comments (1)
tests/phpunit/misc/test_FrmMisc.php (1)
17-17: LGTM! Test correctly validates the hook change.
The assertion has been properly updated to verify that the language loading is now hooked to 'init' instead of 'plugins_loaded', aligning with the architectural changes in the main implementation.
Related WP update https://make.wordpress.org/core/2024/10/21/i18n-improvements-6-7/
After reading into this, it sounds like
initis the right hook, notplugins_loaded, for loading translations.I used
0here because translations need to load before we register form actions.