| @@ 16-29 (lines=14) @@ | ||
| 13 | ||
| 14 | class FormRequestHandlerTest extends SapphireTest |
|
| 15 | { |
|
| 16 | public function testCallsActionOnFormHandler() |
|
| 17 | { |
|
| 18 | $form = new TestForm( |
|
| 19 | new Controller(), |
|
| 20 | 'Form', |
|
| 21 | new FieldList(), |
|
| 22 | new FieldList(new FormAction('mySubmitOnFormHandler')) |
|
| 23 | ); |
|
| 24 | $form->disableSecurityToken(); |
|
| 25 | $handler = new TestFormRequestHandler($form); |
|
| 26 | $request = new HTTPRequest('POST', '/', null, ['action_mySubmitOnFormHandler' => 1]); |
|
| 27 | $response = $handler->httpSubmission($request); |
|
| 28 | $this->assertFalse($response->isError()); |
|
| 29 | } |
|
| 30 | ||
| 31 | public function testCallsActionOnForm() |
|
| 32 | { |
|
| @@ 31-44 (lines=14) @@ | ||
| 28 | $this->assertFalse($response->isError()); |
|
| 29 | } |
|
| 30 | ||
| 31 | public function testCallsActionOnForm() |
|
| 32 | { |
|
| 33 | $form = new TestForm( |
|
| 34 | new Controller(), |
|
| 35 | 'Form', |
|
| 36 | new FieldList(), |
|
| 37 | new FieldList(new FormAction('mySubmitOnForm')) |
|
| 38 | ); |
|
| 39 | $form->disableSecurityToken(); |
|
| 40 | $handler = new FormRequestHandler($form); |
|
| 41 | $request = new HTTPRequest('POST', '/', null, ['action_mySubmitOnForm' => 1]); |
|
| 42 | $response = $handler->httpSubmission($request); |
|
| 43 | $this->assertFalse($response->isError()); |
|
| 44 | } |
|
| 45 | } |
|
| 46 | ||