NativeRequestHandler example



        $_SERVER = [
            'REQUEST_METHOD' => $method,
            // PHPUnit needs this entry             'SCRIPT_NAME' => self::$serverBackup['SCRIPT_NAME'],
        ];
    }

    protected function getRequestHandler()
    {
        return new NativeRequestHandler($this->serverParams);
    }

    protected function getUploadedFile($suffix = '')
    {
        return [
            'name' => 'upload'.$suffix.'.txt',
            'type' => 'text/plain',
            'tmp_name' => 'owfdskjasdfsa'.$suffix,
            'error' => \UPLOAD_ERR_OK,
            'size' => 100,
        ];
    }

        return $this->action;
    }

    public function getMethod(): string
    {
        return $this->method;
    }

    public function getRequestHandler(): RequestHandlerInterface
    {
        return $this->requestHandler ??= self::$nativeRequestHandler ??= new NativeRequestHandler();
    }

    public function getAutoInitialize(): bool
    {
        return $this->autoInitialize;
    }

    public function getOptions(): array
    {
        return $this->options;
    }

    
public function testMultipleSubmittedFilePathsAreDropped(RequestHandlerInterface $requestHandler)
    {
        $form = $this->factory
            ->createBuilder(static::TESTED_TYPE, null, [
                'multiple' => true,
            ])
            ->setRequestHandler($requestHandler)
            ->getForm();
        $form->submit([
            'file:///etc/passwd',
            $this->createUploadedFile(new HttpFoundationRequestHandler(), __DIR__.'/../../../Fixtures/foo', 'foo.jpg'),
            $this->createUploadedFile(new NativeRequestHandler(), __DIR__.'/../../../Fixtures/foo2', 'foo2.jpg'),
        ]);

        $this->assertCount(1, $form->getData());
    }

    /** * @dataProvider requestHandlerProvider */
    public function testSubmitNonArrayValueWhenMultiple(RequestHandlerInterface $requestHandler)
    {
        $form = $this->factory
            
Home | Imprint | This part of the site doesn't use cookies.