Fix Test form factories use the new interface

This commit is contained in:
Christopher Joe 2017-05-09 14:09:48 +12:00 committed by Sam Minnée
parent edcb220e4a
commit 17ddfab877
2 changed files with 5 additions and 5 deletions

View File

@ -2,7 +2,7 @@
namespace SilverStripe\Forms\Tests\FormFactoryTest; namespace SilverStripe\Forms\Tests\FormFactoryTest;
use SilverStripe\Control\Controller; use SilverStripe\Control\RequestHandler;
use SilverStripe\Forms\DefaultFormFactory; use SilverStripe\Forms\DefaultFormFactory;
use SilverStripe\Forms\FieldList; use SilverStripe\Forms\FieldList;
use SilverStripe\Forms\FormAction; use SilverStripe\Forms\FormAction;
@ -12,13 +12,13 @@ use SilverStripe\Forms\TextField;
/** /**
* Test factory * Test factory
*/ */
class EditFactory extends DefaultFormFactory class EditFormFactory extends DefaultFormFactory
{ {
private static $extensions = [ private static $extensions = [
ControllerExtension::class ControllerExtension::class
]; ];
protected function getFormFields(Controller $controller, $name, $context = []) protected function getFormFields(RequestHandler $controller = null, $name, $context = [])
{ {
$fields = new FieldList( $fields = new FieldList(
new HiddenField('ID'), new HiddenField('ID'),
@ -28,7 +28,7 @@ class EditFactory extends DefaultFormFactory
return $fields; return $fields;
} }
protected function getFormActions(Controller $controller, $name, $context = []) protected function getFormActions(RequestHandler $controller = null, $name, $context = [])
{ {
$actions = new FieldList( $actions = new FieldList(
new FormAction('save', 'Save') new FormAction('save', 'Save')

View File

@ -29,7 +29,7 @@ class TestController extends Controller
{ {
// Simple example; Just get the first draft record // Simple example; Just get the first draft record
$record = $this->getRecord(); $record = $this->getRecord();
$factory = new EditFactory(); $factory = new EditFormFactory();
return $factory->getForm($this, 'Form', ['Record' => $record]); return $factory->getForm($this, 'Form', ['Record' => $record]);
} }