Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions classes/views/frm-settings/form.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

<?php require FrmAppHelper::plugin_path() . '/classes/views/shared/errors.php'; ?>
<input type="hidden" name="frm_action" value="process-form"/>
<input type="hidden" name="action" value="process-form"/>
<?php wp_nonce_field( 'process_form_nonce', 'process_form' ); ?>

<?php
Expand Down
2 changes: 2 additions & 0 deletions tests/cypress/e2e/admin-html-validation.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ describe( 'Run some HTML validation', function() {
cy.visit( '/wp-admin/admin.php?page=formidable-settings' );
cy.get( '#wpbody-content' ).htmlvalidate( {
rules: {
// The hidden `action` field and the MCP buttons' `action` share a name on purpose.
'form-dup-name': 'off',
'element-permitted-content': 'off',
'valid-id': 'off',
'prefer-button': 'off',
Expand Down
25 changes: 25 additions & 0 deletions tests/phpunit/settings/test_FrmSettingsController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

/**
* @group settings
*/
#[\PHPUnit\Framework\Attributes\Group( 'settings' )]
class test_FrmSettingsController extends FrmUnitTest {

/**
* Add-ons read `action` (not `frm_action`) in their Global Settings routes.
* Without it, they re-render the form instead of saving.
*
* @covers FrmSettingsController::display_form
*/
public function test_display_form_includes_action_field_for_add_ons() {
wp_set_current_user( $this->factory->user->create( array( 'role' => 'administrator' ) ) );

ob_start();
FrmSettingsController::display_form();
$html = ob_get_clean();

$this->assertStringContainsString( '<input type="hidden" name="frm_action" value="process-form"/>', $html );

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Call to an undefined method test_FrmSettingsController::assertStringContainsString()


The method you are trying to call is not defined, which can result in a fatal error.

$this->assertStringContainsString( '<input type="hidden" name="action" value="process-form"/>', $html );

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Call to an undefined method test_FrmSettingsController::assertStringContainsString()


The method you are trying to call is not defined, which can result in a fatal error.

}
}
Loading