 
  
   
  
   
  
   
  
   
  
   
  
   
  
  public function createClient()
{
    $client = parent::createClient();
    $client->setServerParameter('HTTP_HOST', 'symfony-test');
    return $client;
} 
  
  composer require 'sylius/registry:^1.2@beta'  'sylius/grid:^1.2@beta' 'sylius/grid-bundle:^1.2@beta' 
  
   
  
  <?php
namespace App\EventSubscriber;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;
use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException;
use Symfony\Component\HttpKernel\KernelEvents;
class ApiOptionsSubscriber implements EventSubscriberInterface
{
    public function onKernelException(GetResponseForExceptionEvent $event)
    {
        $exception = $event->getException();
        if (!$exception instanceof MethodNotAllowedHttpException) {
            return;
        }
        $request = $event->getRequest();
        if (!$request->isMethod('OPTIONS') && 0 !== strpos($request->getUri(), '/api/')) {
            return;
        }
        $allowedMethods = 'OPTIONS, '.$exception->getHeaders()['Allow'];
        $response = new Response();
        $response->headers->set('Access-Control-Allow-Methods', $allowedMethods);
        $event->setResponse($response);
        $event->allowCustomResponseCode();
    }
    public static function getSubscribedEvents()
    {
        return [
           KernelEvents::EXCEPTION => 'onKernelException',
        ];
    }
} 
  
  <?php
namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException;
class OptionsController extends AbstractController
{
    public function __invoke(Request $request, string $allowedMethods = ''): Response
    {
        if (!$request->isMethod('OPTIONS')) {
            throw new MethodNotAllowedHttpException();
        }
        $response = new Response();
        $response->headers->set('Allow', 'OPTIONS, '.$allowedMethods);
        return $response;
    }
}api_options:
    path: /api
    controller: App\Controller\OptionsController
    methods: OPTIONS
    defaults:
        allowedMethods: 'GET, POST'
api_blog_options:
    path: /api/blog
    controller: App\Controller\OptionsController
    methods: OPTIONS
    defaults:
        allowedMethods: 'GET, POST, PUT' 
  
  # Подписчик события может установить ответ приложения.
# В таком случае приложение завершает работу и возвращает заданный подписчиком ответ
function onKernelRequest(GetResponseEvent $event): void
{
    $event->setResponse(new RedirectResponse('/login'));
}<?php
require 'vendor/autoload.php';
use Symfony\Component\HttpFoundation\Response;
function getResponse(string $body = 'ok'): Response
{
    return new Response($body);
}
// Здесь отправка не происходит, мы просто получаем экземпляр
$response = getResponse();
// Отправка ответа в браузер
$response->send(); 
  
  
The size of an integer is platform-dependent, although a maximum value of about two billion is the usual value
 
  
  $form = $this->createForm(ChangePasswordType::class);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
    $newPassword = $form['password']->getData();
    $currentPassword = $form['currentPassword']->getData();
    if ($encoder->isPasswordValid($this->getUser(), $currentPassword)) {
        // OK, можно сохранять
    }
} 
  
   
  
  Если в документации об этом упоминается, значит это кому-нибудь нужно.
Все таки это больше похоже на модульное - тестируется, установлены ли нужные ограничения на сущность
У меня была мысть протестировать ограничение на уникальность как раз в функциональном тесте, а другие ограничения быстро прогнать в таком
 
  
   
  
   
  
  $form = $this->createForm(.., $data, [ 'request' => $request ]); 
  
  public function buildForm(FormBuilderInterface $builder, array $options)
{
        /** @var MyInput $data */
        $data = $builder->getData();
        $builder->add('country', 'entity', [
            'class' => Country::class,
            'choices' => $data->getAvailableCountries(),
            'required' => false,
        ]);
        $builder->addEvenListener( ..., function() {
            // Добавление динамических полей.
        });
}