Skip to content

Commit 2ba7b59

Browse files
committed
moved from ControllerArgumentsEvent to ControllerEvent
1 parent 10124be commit 2ba7b59

File tree

2 files changed

+10
-13
lines changed

2 files changed

+10
-13
lines changed

src/lib/EventListener/PerformAccessCheckSubscriber.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
use Ibexa\Contracts\User\Controller\RestrictedControllerInterface;
1212
use Symfony\Component\DependencyInjection\Attribute\AutowireIterator;
1313
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
14-
use Symfony\Component\HttpKernel\Event\ControllerArgumentsEvent;
14+
use Symfony\Component\HttpKernel\Event\ControllerEvent;
1515

1616
final class PerformAccessCheckSubscriber implements EventSubscriberInterface
1717
{
@@ -24,7 +24,7 @@ public function __construct(
2424
) {
2525
}
2626

27-
public function onControllerArgumentsEvent(ControllerArgumentsEvent $event): void
27+
public function onControllerEvent(ControllerEvent $event): void
2828
{
2929
$controller = $event->getController();
3030
if (is_array($controller) && $controller[0] instanceof RestrictedControllerInterface) {
@@ -54,7 +54,7 @@ public function onControllerArgumentsEvent(ControllerArgumentsEvent $event): voi
5454
public static function getSubscribedEvents(): array
5555
{
5656
return [
57-
ControllerArgumentsEvent::class => 'onControllerArgumentsEvent',
57+
ControllerEvent::class => 'onControllerEvent',
5858
];
5959
}
6060
}

tests/lib/EventListener/PerformAccessCheckSubscriberTest.php

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
use Ibexa\User\EventListener\PerformAccessCheckSubscriber;
1313
use PHPUnit\Framework\TestCase;
1414
use Symfony\Component\HttpFoundation\Request;
15-
use Symfony\Component\HttpKernel\Event\ControllerArgumentsEvent;
15+
use Symfony\Component\HttpKernel\Event\ControllerEvent;
1616
use Symfony\Component\HttpKernel\HttpKernelInterface;
1717

1818
final class PerformAccessCheckSubscriberTest extends TestCase
@@ -33,31 +33,29 @@ protected function setUp(): void
3333
public function testArrayController(): void
3434
{
3535
$controller = new MockControllerInterface();
36-
$event = new ControllerArgumentsEvent(
36+
$event = new ControllerEvent(
3737
$this->kernel,
3838
[$controller, 'action'],
39-
[],
4039
$this->request,
4140
HttpKernelInterface::MAIN_REQUEST
4241
);
4342

44-
$this->subscriber->onControllerArgumentsEvent($event);
43+
$this->subscriber->onControllerEvent($event);
4544

4645
self::assertTrue($controller->wasCheckPerformed());
4746
}
4847

4948
public function testInvokableController(): void
5049
{
5150
$controller = new MockControllerInterface();
52-
$event = new ControllerArgumentsEvent(
51+
$event = new ControllerEvent(
5352
$this->kernel,
5453
$controller,
55-
[],
5654
$this->request,
5755
HttpKernelInterface::MAIN_REQUEST
5856
);
5957

60-
$this->subscriber->onControllerArgumentsEvent($event);
58+
$this->subscriber->onControllerEvent($event);
6159

6260
self::assertTrue($controller->wasCheckPerformed());
6361
}
@@ -67,15 +65,14 @@ public function testStringControllerWithServiceLookup(): void
6765
$controller = new MockControllerInterface();
6866
$this->subscriber = new PerformAccessCheckSubscriber([$controller]);
6967

70-
$event = new ControllerArgumentsEvent(
68+
$event = new ControllerEvent(
7169
$this->kernel,
7270
MockControllerInterface::class . '::staticAction',
73-
[],
7471
$this->request,
7572
HttpKernelInterface::MAIN_REQUEST
7673
);
7774

78-
$this->subscriber->onControllerArgumentsEvent($event);
75+
$this->subscriber->onControllerEvent($event);
7976

8077
self::assertTrue($controller->wasCheckPerformed());
8178
}

0 commit comments

Comments
 (0)