public function testButtonClicked() { $form = $this->getStubForm(); $action = $form->buttonClicked(); $this->assertNull($action); $controller = new FormTest_Controller(); $form = $controller->Form(); $request = new HTTPRequest('POST', 'FormTest_Controller/Form', array(), array('Email' => '*****@*****.**', 'SomeRequiredField' => 1, 'action_doSubmit' => 1)); $form->httpSubmission($request); $button = $form->buttonClicked(); $this->assertInstanceOf('SilverStripe\\Forms\\FormAction', $button); $this->assertEquals('doSubmit', $button->actionName()); /** @skipUpgrade */ $form = new Form($controller, 'Form', new FieldList(new FormAction('doSubmit', 'Inline action')), new FieldList()); $form->disableSecurityToken(); $request = new HTTPRequest('POST', 'FormTest_Controller/Form', array(), array('action_doSubmit' => 1)); $form->httpSubmission($request); $button = $form->buttonClicked(); $this->assertInstanceOf('SilverStripe\\Forms\\FormAction', $button); $this->assertEquals('doSubmit', $button->actionName()); }