Skip to content

Commit

Permalink
[SF7] Add Symfony 7 support for Admin bundle
Browse files Browse the repository at this point in the history
  • Loading branch information
loic425 committed Aug 28, 2024
1 parent 7f32e83 commit 95c8381
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 19 deletions.
5 changes: 4 additions & 1 deletion src/Sylius/Bundle/AdminBundle/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"twig/twig": "~3.8.0"
},
"require-dev": {
"matthiasnoback/symfony-dependency-injection-test": "^4.2",
"matthiasnoback/symfony-dependency-injection-test": "^5.1",
"php-http/message-factory": "^1.0",
"phpspec/phpspec": "^7.2",
"phpspec/prophecy-phpunit": "^2.0",
Expand All @@ -61,6 +61,9 @@
"extra": {
"branch-alias": {
"dev-main": "2.0-dev"
},
"symfony": {
"require": "7.0.*"
}
},
"autoload": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
use Sylius\Bundle\AdminBundle\Form\Model\PasswordResetRequest;
use Sylius\Bundle\AdminBundle\Form\RequestPasswordResetType;
use Sylius\Bundle\CoreBundle\Command\Admin\Account\RequestResetPasswordEmail;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
use Symfony\Component\Form\FormFactoryInterface;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\FormView;
use Symfony\Component\HttpFoundation\ParameterBag;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\RequestStack;
Expand Down Expand Up @@ -57,7 +57,7 @@ public function it_sends_reset_password_request_to_message_bus(
RouterInterface $router,
FormInterface $form,
Request $request,
ParameterBagInterface $attributesBag,
ParameterBag $attributesBag,
): void {
$formFactory
->create(RequestPasswordResetType::class)
Expand Down Expand Up @@ -100,7 +100,7 @@ public function it_is_able_to_send_reset_password_request_when_sylius_redirect_p
RouterInterface $router,
FormInterface $form,
Request $request,
ParameterBagInterface $attributesBag,
ParameterBag $attributesBag,
): void {
$formFactory->create(RequestPasswordResetType::class)->willReturn($form);

Expand Down Expand Up @@ -142,7 +142,7 @@ public function it_redirects_to_default_route_if_custom_one_is_not_defined(
RouterInterface $router,
FormInterface $form,
Request $request,
ParameterBagInterface $attributesBag,
ParameterBag $attributesBag,
): void {
$formFactory->create(RequestPasswordResetType::class)->willReturn($form);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
use Sylius\Bundle\UiBundle\Storage\FilterStorageInterface;
use Symfony\Component\HttpFoundation\InputBag;
use Symfony\Component\HttpFoundation\ParameterBag;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Event\RequestEvent;
Expand All @@ -37,7 +38,6 @@ function it_adds_filter_to_filter_storage(
RequestEvent $event,
Request $request,
ParameterBag $attributes,
ParameterBag $query,
FilterStorageInterface $filterStorage,
): void {
$event->isMainRequest()->willReturn(true);
Expand All @@ -48,7 +48,7 @@ function it_adds_filter_to_filter_storage(
$attributes->get('_controller')->willReturn('Sylius\Bundle\AdminBundle\Controller\ProductController::indexAction');
$request->attributes = $attributes;

$query->all()->willReturn(['filter' => 'foo']);
$query = new InputBag(['filter' => 'foo']);
$request->query = $query;

$filterStorage->all()->willReturn([]);
Expand Down Expand Up @@ -76,7 +76,6 @@ function it_does_not_add_filter_to_filter_storage_if_request_format_is_not_html(
RequestEvent $event,
Request $request,
ParameterBag $attributes,
ParameterBag $query,
FilterStorageInterface $filterStorage,
): void {
$event->isMainRequest()->willReturn(true);
Expand All @@ -87,7 +86,7 @@ function it_does_not_add_filter_to_filter_storage_if_request_format_is_not_html(
$attributes->get('_controller')->willReturn('Sylius\Bundle\AdminBundle\Controller\ProductController::indexAction');
$request->attributes = $attributes;

$query->all()->willReturn(['filter' => 'foo']);
$query = new InputBag(['filter' => 'foo']);
$request->query = $query;

$filterStorage->all()->willReturn([]);
Expand All @@ -103,7 +102,6 @@ function it_does_not_add_filter_to_filter_storage_if_it_is_not_an_admin_section(
RequestEvent $event,
Request $request,
ParameterBag $attributes,
ParameterBag $query,
FilterStorageInterface $filterStorage,
): void {
$event->isMainRequest()->willReturn(true);
Expand All @@ -114,7 +112,7 @@ function it_does_not_add_filter_to_filter_storage_if_it_is_not_an_admin_section(
$attributes->get('_controller')->willReturn('Sylius\Bundle\AdminBundle\Controller\ProductController::indexAction');
$request->attributes = $attributes;

$query->all()->willReturn(['filter' => 'foo']);
$query = new InputBag(['filter' => 'foo']);
$request->query = $query;

$filterStorage->all()->willReturn([]);
Expand All @@ -130,7 +128,6 @@ function it_does_not_add_filter_to_filter_storage_if_controller_is_null(
RequestEvent $event,
Request $request,
ParameterBag $attributes,
ParameterBag $query,
FilterStorageInterface $filterStorage,
): void {
$event->isMainRequest()->willReturn(true);
Expand All @@ -141,7 +138,7 @@ function it_does_not_add_filter_to_filter_storage_if_controller_is_null(
$attributes->get('_controller')->willReturn(null);
$request->attributes = $attributes;

$query->all()->willReturn(['filter' => 'foo']);
$query = new InputBag(['filter' => 'foo']);
$request->query = $query;

$filterStorage->all()->willReturn([]);
Expand All @@ -157,7 +154,6 @@ function it_does_not_add_filter_to_filter_storage_if_route_is_missing(
RequestEvent $event,
Request $request,
ParameterBag $attributes,
ParameterBag $query,
FilterStorageInterface $filterStorage,
): void {
$event->isMainRequest()->willReturn(true);
Expand All @@ -168,7 +164,7 @@ function it_does_not_add_filter_to_filter_storage_if_route_is_missing(
$attributes->get('_controller')->willReturn('Sylius\Bundle\AdminBundle\Controller\ProductController::indexAction');
$request->attributes = $attributes;

$query->all()->willReturn(['filter' => 'foo']);
$query = new InputBag(['filter' => 'foo']);
$request->query = $query;

$filterStorage->all()->willReturn([]);
Expand All @@ -184,7 +180,6 @@ function it_does_not_add_filter_to_filter_storage_if_it_is_not_a_index_resource_
RequestEvent $event,
Request $request,
ParameterBag $attributes,
ParameterBag $query,
FilterStorageInterface $filterStorage,
): void {
$event->isMainRequest()->willReturn(true);
Expand All @@ -195,7 +190,7 @@ function it_does_not_add_filter_to_filter_storage_if_it_is_not_a_index_resource_
$attributes->get('_controller')->willReturn('Sylius\Bundle\AdminBundle\Controller\ProductController::indexAction');
$request->attributes = $attributes;

$query->all()->willReturn(['filter' => 'foo']);
$query = new InputBag(['filter' => 'foo']);
$request->query = $query;

$filterStorage->all()->willReturn([]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ function it_adds_cache_control_directives_to_admin_requests(
$event = new ResponseEvent(
$kernel->getWrappedObject(),
$request->getWrappedObject(),
KernelInterface::MASTER_REQUEST,
KernelInterface::MAIN_REQUEST,
$response->getWrappedObject(),
);

Expand All @@ -79,7 +79,7 @@ function it_does_nothing_if_section_is_different_than_admin(
$event = new ResponseEvent(
$kernel->getWrappedObject(),
$request->getWrappedObject(),
KernelInterface::MASTER_REQUEST,
KernelInterface::MAIN_REQUEST,
$response->getWrappedObject(),
);

Expand Down

0 comments on commit 95c8381

Please sign in to comment.