Skip to content

Commit fd8dc00

Browse files
dinamicdkarlovi
authored andcommitted
~ changes to fix error message: Cannot mock Symfony\Component\Routing\Router::addExpressionLanguageProvider() because a class or interface used in the signature is not loaded
1 parent f1afabc commit fd8dc00

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

Controller/AuthorizeController.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
use Symfony\Component\HttpFoundation\Response;
2828
use Symfony\Component\HttpFoundation\Session\SessionInterface;
2929
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
30-
use Symfony\Component\Routing\Router;
30+
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
3131
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
3232
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
3333
use Symfony\Component\Security\Core\User\UserInterface;
@@ -85,7 +85,7 @@ class AuthorizeController implements ContainerAwareInterface
8585
private $tokenStorage;
8686

8787
/**
88-
* @var Router
88+
* @var UrlGeneratorInterface
8989
*/
9090
private $router;
9191

@@ -126,7 +126,7 @@ public function setContainer(ContainerInterface $container = null)
126126
* @param OAuth2 $oAuth2Server
127127
* @param EngineInterface $templating
128128
* @param TokenStorageInterface $tokenStorage
129-
* @param Router $router
129+
* @param UrlGeneratorInterface $router
130130
* @param ClientManagerInterface $clientManager
131131
* @param EventDispatcher $eventDispatcher
132132
* @param string $templateEngineType
@@ -139,7 +139,7 @@ public function __construct(
139139
OAuth2 $oAuth2Server,
140140
EngineInterface $templating,
141141
TokenStorageInterface $tokenStorage,
142-
Router $router,
142+
UrlGeneratorInterface $router,
143143
ClientManagerInterface $clientManager,
144144
EventDispatcher $eventDispatcher,
145145
$templateEngineType = 'twig'
@@ -259,7 +259,7 @@ protected function getClient()
259259

260260
if (null === $clientId = $request->get('client_id')) {
261261
$formData = $request->get($this->authorizeForm->getName(), []);
262-
$clientId = $formData['client_id'] ?? null;
262+
$clientId = isset($formData['client_id']) ? $formData['client_id'] : null;
263263
}
264264

265265
$this->client = $this->clientManager->findClientByPublicId($clientId);

Tests/Controller/AuthorizeControllerTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
use Symfony\Component\HttpFoundation\RequestStack;
1717
use Symfony\Component\HttpFoundation\Response;
1818
use Symfony\Component\HttpFoundation\Session\SessionInterface;
19-
use Symfony\Component\Routing\Router;
19+
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
2020
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
2121
use Symfony\Bundle\FrameworkBundle\Templating\EngineInterface;
2222
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
@@ -61,7 +61,7 @@ class AuthorizeControllerTest extends \PHPUnit_Framework_TestCase
6161
protected $tokenStorage;
6262

6363
/**
64-
* @var \PHPUnit_Framework_MockObject_MockObject|Router
64+
* @var \PHPUnit_Framework_MockObject_MockObject|UrlGeneratorInterface
6565
*/
6666
protected $router;
6767

@@ -119,7 +119,7 @@ public function setUp()
119119
$this->oAuth2Server = $this->createMock(OAuth2::class);
120120
$this->templateEngine = $this->createMock(EngineInterface::class);
121121
$this->tokenStorage = $this->createMock(TokenStorageInterface::class);
122-
$this->router = $this->createMock(Router::class);
122+
$this->router = $this->createMock(UrlGeneratorInterface::class);
123123
$this->clientManager = $this->createMock(ClientManagerInterface::class);
124124
$this->eventDispatcher = $this->createMock(EventDispatcher::class);
125125
$this->templateEngineType = 'twig';

0 commit comments

Comments
 (0)