Repository navigation
Make some 7.0 updates based on feedback #3568
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -29,8 +29,34 @@ class test_FrmAbilitiesContract extends FrmUnitTest { | |
| 'formidable-forms/list-forms', | ||
| 'formidable-forms/list-entries', | ||
| 'formidable-forms/list-styles', | ||
| 'formidable-forms/list-payments', | ||
| 'formidable-forms/list-subscriptions', | ||
| ); | ||
|
|
||
| /** | ||
| * @return void | ||
| */ | ||
| public function test_optional_input_abilities_accept_omitted_input() { | ||
| foreach ( self::$no_required_input_abilities as $name ) { | ||
| $this->assertNotWPError( wp_get_ability( $name )->execute(), $name . ' should accept omitted input.' ); | ||
| } | ||
| } | ||
|
|
||
| /** | ||
| * @return void | ||
| */ | ||
| public function test_required_input_abilities_reject_omitted_input() { | ||
| foreach ( $this->get_formidable_abilities() as $name => $ability ) { | ||
| $schema = $ability->get_input_schema(); | ||
|
|
||
| if ( empty( $schema['required'] ) ) { | ||
| continue; | ||
| } | ||
|
|
||
| $this->assertWPError( $ability->execute(), $name . ' should require its input.' ); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| } | ||
| } | ||
|
|
||
| /** | ||
| * @return void | ||
| */ | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -229,6 +229,36 @@ public function test_configuration_error_can_be_saved_with_actual_reason() { | |
| $this->assertStringContainsString( 'invalid-input-secret', $reason, 'The configuration error code should be stored.' ); | ||
| } | ||
|
|
||
| /** | ||
| * @return void | ||
| */ | ||
| public function test_hcaptcha_test_key_mismatch_keeps_configuration_message() { | ||
| $settings = FrmAppHelper::get_settings(); | ||
| $settings->active_captcha = 'hcaptcha'; | ||
| $settings->hcaptcha_pubkey = 'test-site-key'; | ||
| $settings->hcaptcha_privkey = 'test-secret-key'; | ||
| $_POST = array( 'h-captcha-response' => 'test-token' ); | ||
|
|
||
| foreach ( array( 'not-using-dummy-passcode', 'not-using-dummy-secret' ) as $code ) { | ||
| FrmSpamEntriesHelper::reset_flags(); | ||
| $settings->spam_handling['captcha'] = FrmSpamEntriesHelper::BLOCK; | ||
| $this->response = array( | ||
| 'body' => wp_json_encode( | ||
| array( | ||
| 'success' => false, | ||
| 'error-codes' => array( $code ), | ||
| ) | ||
| ), | ||
| ); | ||
| $errors = $this->validate_captcha(); | ||
| $this->assertStringContainsString( 'not set up correctly', $errors[ 'field' . $this->captcha->id ], $code ); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| $settings->spam_handling['captcha'] = FrmSpamEntriesHelper::SAVE; | ||
| $this->assertSame( array(), $this->validate_captcha() ); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| $reason = FrmSpamEntriesHelper::get_flagged_reason( array( 'form_id' => $this->captcha->form_id ) ); | ||
| $this->assertStringContainsString( 'matching pair', $reason, $code ); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| } | ||
| } | ||
|
|
||
| public function test_unknown_service_error_code_is_preserved() { | ||
| FrmAppHelper::get_settings()->spam_handling['captcha'] = FrmSpamEntriesHelper::SAVE; | ||
| $this->response = array( | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The method you are trying to call is not defined, which can result in a fatal error.