diff --git a/UPGRADE-3.0.md b/UPGRADE-3.0.md index b88370679b33c..9daabfdb65267 100644 --- a/UPGRADE-3.0.md +++ b/UPGRADE-3.0.md @@ -22,7 +22,7 @@ UPGRADE FROM 2.x to 3.0 * Passing a `Symfony\Component\HttpFoundation\Request` instance to `FormInterface::bind()` was disabled. You should use - `FormInterface::process()` instead. + `FormInterface::handleRequest()` instead. Before: @@ -39,7 +39,9 @@ UPGRADE FROM 2.x to 3.0 After: ``` - if ($form->process($request)->isValid()) { + $form->handleRequest(); + + if ($form->isValid()) { // ... } ``` @@ -48,7 +50,9 @@ UPGRADE FROM 2.x to 3.0 the method `isBound()`: ``` - if ($form->process($request)->isBound()) { + $form->handleRequest(); + + if ($form->isBound()) { // ... if ($form->isValid()) { diff --git a/src/Symfony/Component/Form/Button.php b/src/Symfony/Component/Form/Button.php index d98ef87844e7d..55606d24dafcb 100644 --- a/src/Symfony/Component/Form/Button.php +++ b/src/Symfony/Component/Form/Button.php @@ -350,7 +350,7 @@ public function isSynchronized() * * @throws BadMethodCallException */ - public function process($request = null) + public function handleRequest($request = null) { throw new BadMethodCallException('Buttons cannot be processed. Call process() on the root form instead.'); } diff --git a/src/Symfony/Component/Form/ButtonBuilder.php b/src/Symfony/Component/Form/ButtonBuilder.php index 47892d8e1c721..3d6b840299443 100644 --- a/src/Symfony/Component/Form/ButtonBuilder.php +++ b/src/Symfony/Component/Form/ButtonBuilder.php @@ -483,11 +483,11 @@ public function setMethod($method) /** * Unsupported method. * - * @param FormProcessorInterface $formProcessor + * @param RequestHandlerInterface $requestHandler * * @throws BadMethodCallException */ - public function setFormProcessor(FormProcessorInterface $formProcessor) + public function setRequestHandler(RequestHandlerInterface $requestHandler) { throw new BadMethodCallException('Buttons do not support form processors.'); } @@ -766,7 +766,7 @@ public function getMethod() * * @return null Always returns null. */ - public function getFormProcessor() + public function getRequestHandler() { return null; } diff --git a/src/Symfony/Component/Form/CHANGELOG.md b/src/Symfony/Component/Form/CHANGELOG.md index ed966f03f13d3..0263c09b79206 100644 --- a/src/Symfony/Component/Form/CHANGELOG.md +++ b/src/Symfony/Component/Form/CHANGELOG.md @@ -8,7 +8,7 @@ CHANGELOG * deprecated FormPerformanceTestCase and FormIntegrationTestCase in the Symfony\Component\Form\Tests namespace and moved them to the Symfony\Component\Form\Test namespace * deprecated TypeTestCase in the Symfony\Component\Form\Tests\Extension\Core\Type namespace and moved it to the Symfony\Component\Form\Test namespace * changed FormRenderer::humanize() to humanize also camel cased field name - * added FormProcessorInterface and FormInterface::process() + * added RequestHandlerInterface and FormInterface::handleRequest() * deprecated passing a Request instance to FormInterface::bind() * added options "method" and "action" to FormType * deprecated option "virtual" in favor "inherit_data" diff --git a/src/Symfony/Component/Form/Extension/HttpFoundation/RequestFormProcessor.php b/src/Symfony/Component/Form/Extension/HttpFoundation/HttpFoundationRequestHandler.php similarity index 89% rename from src/Symfony/Component/Form/Extension/HttpFoundation/RequestFormProcessor.php rename to src/Symfony/Component/Form/Extension/HttpFoundation/HttpFoundationRequestHandler.php index c2f0b4de2c6f7..e33cdf6b414e7 100644 --- a/src/Symfony/Component/Form/Extension/HttpFoundation/RequestFormProcessor.php +++ b/src/Symfony/Component/Form/Extension/HttpFoundation/HttpFoundationRequestHandler.php @@ -14,21 +14,21 @@ use Symfony\Component\Form\Exception\InvalidArgumentException; use Symfony\Component\Form\Exception\UnexpectedTypeException; use Symfony\Component\Form\FormInterface; -use Symfony\Component\Form\FormProcessorInterface; +use Symfony\Component\Form\RequestHandlerInterface; use Symfony\Component\HttpFoundation\Request; /** - * A form processor using the {@link Request} class of the HttpFoundation + * A request processor using the {@link Request} class of the HttpFoundation * component. * * @author Bernhard Schussek */ -class RequestFormProcessor implements FormProcessorInterface +class HttpFoundationRequestHandler implements RequestHandlerInterface { /** * {@inheritdoc} */ - public function processForm(FormInterface $form, $request = null) + public function handleRequest(FormInterface $form, $request = null) { if (!$request instanceof Request) { throw new UnexpectedTypeException($request, 'Symfony\Component\HttpFoundation\Request'); diff --git a/src/Symfony/Component/Form/Extension/HttpFoundation/Type/FormTypeHttpFoundationExtension.php b/src/Symfony/Component/Form/Extension/HttpFoundation/Type/FormTypeHttpFoundationExtension.php index 28e6e7c8162e9..9b09b05c39918 100644 --- a/src/Symfony/Component/Form/Extension/HttpFoundation/Type/FormTypeHttpFoundationExtension.php +++ b/src/Symfony/Component/Form/Extension/HttpFoundation/Type/FormTypeHttpFoundationExtension.php @@ -13,7 +13,7 @@ use Symfony\Component\Form\AbstractTypeExtension; use Symfony\Component\Form\Extension\HttpFoundation\EventListener\BindRequestListener; -use Symfony\Component\Form\Extension\HttpFoundation\RequestFormProcessor; +use Symfony\Component\Form\Extension\HttpFoundation\HttpFoundationRequestHandler; use Symfony\Component\Form\FormBuilderInterface; /** @@ -27,14 +27,14 @@ class FormTypeHttpFoundationExtension extends AbstractTypeExtension private $listener; /** - * @var RequestFormProcessor + * @var HttpFoundationRequestHandler */ - private $processor; + private $requestHandler; public function __construct() { $this->listener = new BindRequestListener(); - $this->processor = new RequestFormProcessor(); + $this->requestHandler = new HttpFoundationRequestHandler(); } /** @@ -43,7 +43,7 @@ public function __construct() public function buildForm(FormBuilderInterface $builder, array $options) { $builder->addEventSubscriber($this->listener); - $builder->setFormProcessor($this->processor); + $builder->setRequestHandler($this->requestHandler); } /** diff --git a/src/Symfony/Component/Form/Form.php b/src/Symfony/Component/Form/Form.php index 4600fd043a856..a7a057dd09bc8 100644 --- a/src/Symfony/Component/Form/Form.php +++ b/src/Symfony/Component/Form/Form.php @@ -454,9 +454,9 @@ public function getExtraData() /** * {@inheritdoc} */ - public function process($request = null) + public function handleRequest($request = null) { - $this->config->getFormProcessor()->processForm($this, $request); + $this->config->getRequestHandler()->handleRequest($this, $request); return $this; } diff --git a/src/Symfony/Component/Form/FormConfigBuilder.php b/src/Symfony/Component/Form/FormConfigBuilder.php index b839fa1065991..b6e57f6201d34 100644 --- a/src/Symfony/Component/Form/FormConfigBuilder.php +++ b/src/Symfony/Component/Form/FormConfigBuilder.php @@ -28,11 +28,11 @@ class FormConfigBuilder implements FormConfigBuilderInterface { /** - * Caches a globally unique {@link NativeFormProcessor} instance. + * Caches a globally unique {@link NativeRequestHandler} instance. * - * @var NativeFormProcessor + * @var NativeRequestHandler */ - private static $nativeFormProcessor; + private static $nativeRequestProcessor; /** * The accepted request methods. @@ -168,9 +168,9 @@ class FormConfigBuilder implements FormConfigBuilderInterface private $method = 'POST'; /** - * @var FormProcessorInterface + * @var RequestHandlerInterface */ - private $formProcessor; + private $requestHandler; /** * @var array @@ -509,16 +509,16 @@ public function getMethod() /** * {@inheritdoc} */ - public function getFormProcessor() + public function getRequestHandler() { - if (null === $this->formProcessor) { - if (null === self::$nativeFormProcessor) { - self::$nativeFormProcessor = new NativeFormProcessor(); + if (null === $this->requestHandler) { + if (null === self::$nativeRequestProcessor) { + self::$nativeRequestProcessor = new NativeRequestHandler(); } - $this->formProcessor = self::$nativeFormProcessor; + $this->requestHandler = self::$nativeRequestProcessor; } - return $this->formProcessor; + return $this->requestHandler; } /** @@ -832,13 +832,13 @@ public function setMethod($method) /** * {@inheritdoc} */ - public function setFormProcessor(FormProcessorInterface $formProcessor) + public function setRequestHandler(RequestHandlerInterface $requestHandler) { if ($this->locked) { throw new BadMethodCallException('The config builder cannot be modified anymore.'); } - $this->formProcessor = $formProcessor; + $this->requestHandler = $requestHandler; return $this; } diff --git a/src/Symfony/Component/Form/FormConfigBuilderInterface.php b/src/Symfony/Component/Form/FormConfigBuilderInterface.php index a35be27db2759..45fa4275e4350 100644 --- a/src/Symfony/Component/Form/FormConfigBuilderInterface.php +++ b/src/Symfony/Component/Form/FormConfigBuilderInterface.php @@ -256,11 +256,11 @@ public function setAction($action); public function setMethod($method); /** - * @param FormProcessorInterface $formProcessor + * @param RequestHandlerInterface $requestHandler * * @return self The configuration object. */ - public function setFormProcessor(FormProcessorInterface $formProcessor); + public function setRequestHandler(RequestHandlerInterface $requestHandler); /** * Builds and returns the form configuration. diff --git a/src/Symfony/Component/Form/FormConfigInterface.php b/src/Symfony/Component/Form/FormConfigInterface.php index 3aa00d4dbdd2e..a3e80263144b0 100644 --- a/src/Symfony/Component/Form/FormConfigInterface.php +++ b/src/Symfony/Component/Form/FormConfigInterface.php @@ -201,9 +201,9 @@ public function getAction(); public function getMethod(); /** - * @return FormProcessorInterface The form processor. + * @return RequestHandlerInterface The form processor. */ - public function getFormProcessor(); + public function getRequestHandler(); /** * Returns all options passed during the construction of the form. diff --git a/src/Symfony/Component/Form/FormInterface.php b/src/Symfony/Component/Form/FormInterface.php index 00512f0833892..e1a64e626a060 100644 --- a/src/Symfony/Component/Form/FormInterface.php +++ b/src/Symfony/Component/Form/FormInterface.php @@ -229,7 +229,7 @@ public function isSynchronized(); /** * Processes the given request and binds the form if it was submitted. * - * Internally, the request is forwarded to a {@link FormProcessorInterface} + * Internally, the request is forwarded to a {@link RequestHandlerInterface} * instance. This instance determines the allowed value of the * $request parameter. * @@ -237,7 +237,7 @@ public function isSynchronized(); * * @return FormInterface The form instance. */ - public function process($request = null); + public function handleRequest($request = null); /** * Binds data to the form, transforms and validates it. diff --git a/src/Symfony/Component/Form/NativeFormProcessor.php b/src/Symfony/Component/Form/NativeRequestHandler.php similarity index 95% rename from src/Symfony/Component/Form/NativeFormProcessor.php rename to src/Symfony/Component/Form/NativeRequestHandler.php index 7494c84eaf77a..ac343c4898450 100644 --- a/src/Symfony/Component/Form/NativeFormProcessor.php +++ b/src/Symfony/Component/Form/NativeRequestHandler.php @@ -13,14 +13,14 @@ use Symfony\Component\Form\Exception\UnexpectedTypeException; use Symfony\Component\Form\FormInterface; -use Symfony\Component\Form\FormProcessorInterface; +use Symfony\Component\Form\RequestHandlerInterface; /** - * A form processor using PHP's super globals $_GET, $_POST and $_SERVER. + * A request handler using PHP's super globals $_GET, $_POST and $_SERVER. * * @author Bernhard Schussek */ -class NativeFormProcessor implements FormProcessorInterface +class NativeRequestHandler implements RequestHandlerInterface { /** * The allowed keys of the $_FILES array. @@ -38,7 +38,7 @@ class NativeFormProcessor implements FormProcessorInterface /** * {@inheritdoc} */ - public function processForm(FormInterface $form, $request = null) + public function handleRequest(FormInterface $form, $request = null) { if (null !== $request) { throw new UnexpectedTypeException($request, 'null'); diff --git a/src/Symfony/Component/Form/FormProcessorInterface.php b/src/Symfony/Component/Form/RequestHandlerInterface.php similarity index 84% rename from src/Symfony/Component/Form/FormProcessorInterface.php rename to src/Symfony/Component/Form/RequestHandlerInterface.php index 3634524b8d463..d62b950a9c56a 100644 --- a/src/Symfony/Component/Form/FormProcessorInterface.php +++ b/src/Symfony/Component/Form/RequestHandlerInterface.php @@ -16,7 +16,7 @@ * * @author Bernhard Schussek */ -interface FormProcessorInterface +interface RequestHandlerInterface { /** * Binds a form from a request if it was submitted. @@ -24,5 +24,5 @@ interface FormProcessorInterface * @param FormInterface $form The form to bind. * @param mixed $request The current request. */ - public function processForm(FormInterface $form, $request = null); + public function handleRequest(FormInterface $form, $request = null); } diff --git a/src/Symfony/Component/Form/Tests/AbstractFormProcessorTest.php b/src/Symfony/Component/Form/Tests/AbstractRequestHandlerTest.php similarity index 87% rename from src/Symfony/Component/Form/Tests/AbstractFormProcessorTest.php rename to src/Symfony/Component/Form/Tests/AbstractRequestHandlerTest.php index 40270b2c0eb6f..d9f693622cce7 100644 --- a/src/Symfony/Component/Form/Tests/AbstractFormProcessorTest.php +++ b/src/Symfony/Component/Form/Tests/AbstractRequestHandlerTest.php @@ -14,18 +14,18 @@ /** * @author Bernhard Schussek */ -abstract class AbstractFormProcessorTest extends \PHPUnit_Framework_TestCase +abstract class AbstractRequestHandlerTest extends \PHPUnit_Framework_TestCase { /** - * @var \Symfony\Component\Form\FormProcessorInterface + * @var \Symfony\Component\Form\RequestHandlerInterface */ - protected $processor; + protected $requestHandler; protected $request; protected function setUp() { - $this->processor = $this->getFormProcessor(); + $this->requestHandler = $this->getRequestHandler(); $this->request = null; } @@ -61,7 +61,7 @@ public function testBindIfNameInRequest($method) ->method('bind') ->with('DATA'); - $this->processor->processForm($form, $this->request); + $this->requestHandler->handleRequest($form, $this->request); } /** @@ -80,7 +80,7 @@ public function testDoNotBindIfWrongRequestMethod($method) $form->expects($this->never()) ->method('bind'); - $this->processor->processForm($form, $this->request); + $this->requestHandler->handleRequest($form, $this->request); } /** @@ -98,7 +98,7 @@ public function testBindSimpleFormWithNullIfNameNotInRequestAndNotGetRequest($me ->method('bind') ->with($this->identicalTo(null)); - $this->processor->processForm($form, $this->request); + $this->requestHandler->handleRequest($form, $this->request); } /** @@ -116,7 +116,7 @@ public function testBindCompoundFormWithArrayIfNameNotInRequestAndNotGetRequest( ->method('bind') ->with($this->identicalTo(array())); - $this->processor->processForm($form, $this->request); + $this->requestHandler->handleRequest($form, $this->request); } public function testDoNotBindIfNameNotInRequestAndGetRequest() @@ -130,7 +130,7 @@ public function testDoNotBindIfNameNotInRequestAndGetRequest() $form->expects($this->never()) ->method('bind'); - $this->processor->processForm($form, $this->request); + $this->requestHandler->handleRequest($form, $this->request); } /** @@ -155,7 +155,7 @@ public function testBindFormWithEmptyNameIfAtLeastOneFieldInRequest($method) ->method('bind') ->with($requestData); - $this->processor->processForm($form, $this->request); + $this->requestHandler->handleRequest($form, $this->request); } /** @@ -178,7 +178,7 @@ public function testDoNotBindFormWithEmptyNameIfNoFieldInRequest($method) $form->expects($this->never()) ->method('bind'); - $this->processor->processForm($form, $this->request); + $this->requestHandler->handleRequest($form, $this->request); } /** @@ -206,7 +206,7 @@ public function testMergeParamsAndFiles($method) 'field2' => $file, )); - $this->processor->processForm($form, $this->request); + $this->requestHandler->handleRequest($form, $this->request); } /** @@ -227,7 +227,7 @@ public function testParamTakesPrecedenceOverFile($method) ->method('bind') ->with('DATA'); - $this->processor->processForm($form, $this->request); + $this->requestHandler->handleRequest($form, $this->request); } /** @@ -248,12 +248,12 @@ public function testBindFileIfNoParam($method) ->method('bind') ->with($file); - $this->processor->processForm($form, $this->request); + $this->requestHandler->handleRequest($form, $this->request); } abstract protected function setRequestData($method, $data, $files = array()); - abstract protected function getFormProcessor(); + abstract protected function getRequestHandler(); abstract protected function getMockFile(); diff --git a/src/Symfony/Component/Form/Tests/CompoundFormTest.php b/src/Symfony/Component/Form/Tests/CompoundFormTest.php index fc3b5a6d6d12f..95fdd4632ef40 100644 --- a/src/Symfony/Component/Form/Tests/CompoundFormTest.php +++ b/src/Symfony/Component/Form/Tests/CompoundFormTest.php @@ -11,7 +11,7 @@ namespace Symfony\Component\Form\Tests; -use Symfony\Component\Form\Extension\HttpFoundation\RequestFormProcessor; +use Symfony\Component\Form\Extension\HttpFoundation\HttpFoundationRequestHandler; use Symfony\Component\Form\FormError; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\File\UploadedFile; @@ -481,12 +481,12 @@ public function testBindPostOrPutRequest($method) ->setMethod($method) ->setCompound(true) ->setDataMapper($this->getDataMapper()) - ->setFormProcessor(new RequestFormProcessor()) + ->setRequestHandler(new HttpFoundationRequestHandler()) ->getForm(); $form->add($this->getBuilder('name')->getForm()); $form->add($this->getBuilder('image')->getForm()); - $form->process($request); + $form->handleRequest($request); $file = new UploadedFile($path, 'upload.png', 'image/png', 123, UPLOAD_ERR_OK); @@ -531,12 +531,12 @@ public function testBindPostOrPutRequestWithEmptyRootFormName($method) ->setMethod($method) ->setCompound(true) ->setDataMapper($this->getDataMapper()) - ->setFormProcessor(new RequestFormProcessor()) + ->setRequestHandler(new HttpFoundationRequestHandler()) ->getForm(); $form->add($this->getBuilder('name')->getForm()); $form->add($this->getBuilder('image')->getForm()); - $form->process($request); + $form->handleRequest($request); $file = new UploadedFile($path, 'upload.png', 'image/png', 123, UPLOAD_ERR_OK); @@ -575,10 +575,10 @@ public function testBindPostOrPutRequestWithSingleChildForm($method) $form = $this->getBuilder('image') ->setMethod($method) - ->setFormProcessor(new RequestFormProcessor()) + ->setRequestHandler(new HttpFoundationRequestHandler()) ->getForm(); - $form->process($request); + $form->handleRequest($request); $file = new UploadedFile($path, 'upload.png', 'image/png', 123, UPLOAD_ERR_OK); @@ -609,10 +609,10 @@ public function testBindPostOrPutRequestWithSingleChildFormUploadedFile($method) $form = $this->getBuilder('name') ->setMethod($method) - ->setFormProcessor(new RequestFormProcessor()) + ->setRequestHandler(new HttpFoundationRequestHandler()) ->getForm(); - $form->process($request); + $form->handleRequest($request); $this->assertEquals('Bernhard', $form->getData()); @@ -640,12 +640,12 @@ public function testBindGetRequest() ->setMethod('GET') ->setCompound(true) ->setDataMapper($this->getDataMapper()) - ->setFormProcessor(new RequestFormProcessor()) + ->setRequestHandler(new HttpFoundationRequestHandler()) ->getForm(); $form->add($this->getBuilder('firstName')->getForm()); $form->add($this->getBuilder('lastName')->getForm()); - $form->process($request); + $form->handleRequest($request); $this->assertEquals('Bernhard', $form['firstName']->getData()); $this->assertEquals('Schussek', $form['lastName']->getData()); @@ -671,12 +671,12 @@ public function testBindGetRequestWithEmptyRootFormName() ->setMethod('GET') ->setCompound(true) ->setDataMapper($this->getDataMapper()) - ->setFormProcessor(new RequestFormProcessor()) + ->setRequestHandler(new HttpFoundationRequestHandler()) ->getForm(); $form->add($this->getBuilder('firstName')->getForm()); $form->add($this->getBuilder('lastName')->getForm()); - $form->process($request); + $form->handleRequest($request); $this->assertEquals('Bernhard', $form['firstName']->getData()); $this->assertEquals('Schussek', $form['lastName']->getData()); diff --git a/src/Symfony/Component/Form/Tests/Extension/HttpFoundation/RequestFormProcessorTest.php b/src/Symfony/Component/Form/Tests/Extension/HttpFoundation/HttpFoundationRequestHandlerTest.php similarity index 70% rename from src/Symfony/Component/Form/Tests/Extension/HttpFoundation/RequestFormProcessorTest.php rename to src/Symfony/Component/Form/Tests/Extension/HttpFoundation/HttpFoundationRequestHandlerTest.php index 95e522c474326..2d5cf7764bc28 100644 --- a/src/Symfony/Component/Form/Tests/Extension/HttpFoundation/RequestFormProcessorTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/HttpFoundation/HttpFoundationRequestHandlerTest.php @@ -11,28 +11,28 @@ namespace Symfony\Component\Form\Tests\Extension\HttpFoundation; -use Symfony\Component\Form\Extension\HttpFoundation\RequestFormProcessor; -use Symfony\Component\Form\Tests\AbstractFormProcessorTest; +use Symfony\Component\Form\Extension\HttpFoundation\HttpFoundationRequestHandler; +use Symfony\Component\Form\Tests\AbstractRequestHandlerTest; use Symfony\Component\HttpFoundation\Request; /** * @author Bernhard Schussek */ -class RequestFormProcessorTest extends AbstractFormProcessorTest +class HttpFoundationRequestHandlerTest extends AbstractRequestHandlerTest { /** * @expectedException \Symfony\Component\Form\Exception\UnexpectedTypeException */ public function testRequestShouldNotBeNull() { - $this->processor->processForm($this->getMockForm('name', 'GET')); + $this->requestHandler->handleRequest($this->getMockForm('name', 'GET')); } /** * @expectedException \Symfony\Component\Form\Exception\UnexpectedTypeException */ public function testRequestShouldBeInstanceOfRequest() { - $this->processor->processForm($this->getMockForm('name', 'GET'), new \stdClass()); + $this->requestHandler->handleRequest($this->getMockForm('name', 'GET'), new \stdClass()); } protected function setRequestData($method, $data, $files = array()) @@ -40,9 +40,9 @@ protected function setRequestData($method, $data, $files = array()) $this->request = Request::create('http://localhost', $method, $data, array(), $files); } - protected function getFormProcessor() + protected function getRequestHandler() { - return new RequestFormProcessor(); + return new HttpFoundationRequestHandler(); } protected function getMockFile() diff --git a/src/Symfony/Component/Form/Tests/FormConfigTest.php b/src/Symfony/Component/Form/Tests/FormConfigTest.php index 90c882f1f1826..961dfd3367fdb 100644 --- a/src/Symfony/Component/Form/Tests/FormConfigTest.php +++ b/src/Symfony/Component/Form/Tests/FormConfigTest.php @@ -91,19 +91,19 @@ public function testNameAcceptsOnlyNamesValidAsIdsInHtml4($name, $accepted) } } - public function testGetFormProcessorCreatesNativeFormProcessorIfNotSet() + public function testGetRequestHandlerCreatesNativeRequestHandlerIfNotSet() { $config = $this->getConfigBuilder()->getFormConfig(); - $this->assertInstanceOf('Symfony\Component\Form\NativeFormProcessor', $config->getFormProcessor()); + $this->assertInstanceOf('Symfony\Component\Form\NativeRequestHandler', $config->getRequestHandler()); } - public function testGetFormProcessorReusesNativeFormProcessorInstance() + public function testGetRequestHandlerReusesNativeRequestHandlerInstance() { $config1 = $this->getConfigBuilder()->getFormConfig(); $config2 = $this->getConfigBuilder()->getFormConfig(); - $this->assertSame($config1->getFormProcessor(), $config2->getFormProcessor()); + $this->assertSame($config1->getRequestHandler(), $config2->getRequestHandler()); } public function testSetMethodAllowsGet() diff --git a/src/Symfony/Component/Form/Tests/NativeFormProcessorTest.php b/src/Symfony/Component/Form/Tests/NativeRequestHandlerTest.php similarity index 89% rename from src/Symfony/Component/Form/Tests/NativeFormProcessorTest.php rename to src/Symfony/Component/Form/Tests/NativeRequestHandlerTest.php index 4e90e5276c9c8..1a7bb0f9e41f0 100644 --- a/src/Symfony/Component/Form/Tests/NativeFormProcessorTest.php +++ b/src/Symfony/Component/Form/Tests/NativeRequestHandlerTest.php @@ -11,12 +11,12 @@ namespace Symfony\Component\Form\Tests; -use Symfony\Component\Form\NativeFormProcessor; +use Symfony\Component\Form\NativeRequestHandler; /** * @author Bernhard Schussek */ -class NativeFormProcessorTest extends AbstractFormProcessorTest +class NativeRequestHandlerTest extends AbstractRequestHandlerTest { private static $serverBackup; @@ -53,7 +53,7 @@ protected function tearDown() */ public function testRequestShouldBeNull() { - $this->processor->processForm($this->getMockForm('name', 'GET'), 'request'); + $this->requestHandler->handleRequest($this->getMockForm('name', 'GET'), 'request'); } public function testMethodOverrideHeaderTakesPrecedenceIfPost() @@ -70,7 +70,7 @@ public function testMethodOverrideHeaderTakesPrecedenceIfPost() ->method('bind') ->with('DATA'); - $this->processor->processForm($form, $this->request); + $this->requestHandler->handleRequest($form, $this->request); } public function testConvertEmptyUploadedFilesToNull() @@ -89,7 +89,7 @@ public function testConvertEmptyUploadedFilesToNull() ->method('bind') ->with($this->identicalTo(null)); - $this->processor->processForm($form, $this->request); + $this->requestHandler->handleRequest($form, $this->request); } public function testFixBuggyFilesArray() @@ -126,7 +126,7 @@ public function testFixBuggyFilesArray() ), )); - $this->processor->processForm($form, $this->request); + $this->requestHandler->handleRequest($form, $this->request); } public function testFixBuggyNestedFilesArray() @@ -165,7 +165,7 @@ public function testFixBuggyNestedFilesArray() ), )); - $this->processor->processForm($form, $this->request); + $this->requestHandler->handleRequest($form, $this->request); } public function testMethodOverrideHeaderIgnoredIfNotPost() @@ -181,7 +181,7 @@ public function testMethodOverrideHeaderIgnoredIfNotPost() $form->expects($this->never()) ->method('bind'); - $this->processor->processForm($form, $this->request); + $this->requestHandler->handleRequest($form, $this->request); } protected function setRequestData($method, $data, $files = array()) @@ -201,9 +201,9 @@ protected function setRequestData($method, $data, $files = array()) ); } - protected function getFormProcessor() + protected function getRequestHandler() { - return new NativeFormProcessor(); + return new NativeRequestHandler(); } protected function getMockFile() diff --git a/src/Symfony/Component/Form/Tests/SimpleFormTest.php b/src/Symfony/Component/Form/Tests/SimpleFormTest.php index 01c0a947d08e4..09dea71d250cb 100644 --- a/src/Symfony/Component/Form/Tests/SimpleFormTest.php +++ b/src/Symfony/Component/Form/Tests/SimpleFormTest.php @@ -878,19 +878,19 @@ public function testBindingWrongDataIsIgnored() $parent->bind('not-an-array'); } - public function testProcessForwardsToFormProcessor() + public function testHandleRequestForwardsToRequestHandler() { - $processor = $this->getMock('Symfony\Component\Form\FormProcessorInterface'); + $processor = $this->getMock('Symfony\Component\Form\RequestHandlerInterface'); $form = $this->getBuilder() - ->setFormProcessor($processor) + ->setRequestHandler($processor) ->getForm(); $processor->expects($this->once()) - ->method('processForm') + ->method('handleRequest') ->with($this->identicalTo($form), 'REQUEST'); - $this->assertSame($form, $form->process('REQUEST')); + $this->assertSame($form, $form->handleRequest('REQUEST')); } public function testFormInheritsParentData() pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy