Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

FunctionalTest SimpleForm double submission bug #2874

Open
willmorgan opened this Issue · 1 comment

3 participants

@willmorgan
Collaborator

When using a standalone Controller, If I run FunctionalTest->submitForm() twice, the second call will erroneously return a 404 because of a malformed form action attribute.

Rough test code:

    // Test a double signup can't happen
    $this->get('MemberModuleTest');
    // $response gives you a SS_HTTPResponse with a form with an action pointing to MemberModuleTestController/LoginGatewayForm
    $response = $this->submitForm('LoginGatewayForm_LoginGatewayForm', 'action_checkEmailAction', array(
        'Email' => $nonExistentEmail,
    ));
    // $response gives you a SS_HTTPResponse with a 404 body
    $response = $this->submitForm('LoginGatewayForm_LoginGatewayForm', 'action_registerAction', array(
        'Email' => $signupEmail,
        'Password' => $signupPassword,
    ));

My custom form doesn't do anything weird with the FormAction attribute, and for now I have worked around the issue by making the MemberModuleTestController provide an absolute Link function return.

As far as I can see there's a problem with the thirdparty SimpleURL->asString method which mangles the URL slightly.

Thanks to @dhensby who worked with me in the role of "rubber duck". :smiling_imp:

@dhensby
Collaborator

Yep, it looks like the simpleform tester assumes that relative links are absolute so parses them incorrectly and returns them with a leading "http://".

So, it sees a form with action "controller/Form" and returns "http://controller/Form" as the URL.

@Sixfifty Sixfifty referenced this issue from a commit
Commit has since been removed from the repository and is no longer available.
@dhensby dhensby referenced this issue from a commit
Commit has since been removed from the repository and is no longer available.
@simonwelsh simonwelsh added the 3.1 label
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.