Skip to content

Commit

Permalink
feat(graphql): update symfony dependencies to 4.4.*|^5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
SofLesc committed Aug 17, 2021
1 parent 0970d2f commit 24e126b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
"php": "7.4.*",
"ext-json": "*",
"doctrine/annotations": "^1.10.0",
"symfony/config": "4.4.*",
"symfony/dependency-injection": "4.4.*",
"symfony/event-dispatcher": "4.4.*",
"symfony/http-foundation": "4.4.*",
"symfony/http-kernel": "4.4.*",
"symfony/config": "4.4.*|^5.0",
"symfony/dependency-injection": "4.4.*|^5.0",
"symfony/event-dispatcher": "4.4.*|^5.0",
"symfony/http-foundation": "4.4.*|^5.0",
"symfony/http-kernel": "4.4.*|^5.0",
"symfony/options-resolver": "^5.0"
},
"require-dev": {
Expand Down
3 changes: 2 additions & 1 deletion src/EventListener/ReadGraphQLRateLmitAnnotationListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,11 @@ public static function getSubscribedEvents(): array
}

/**
* @param Source|string $query
* @param string|int|float|bool|null $query
*/
public function extractQueryName($query): string
{
/** @var Source $query */
$parsedQuery = Parser::parse($query);
/** @var OperationDefinitionNode $item */
foreach ($parsedQuery->definitions->getIterator() as $item) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\InputBag;
use Symfony\Component\HttpFoundation\ParameterBag;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Event\ControllerEvent;
Expand Down Expand Up @@ -64,7 +65,7 @@ public function testItSetsGraphQLRateLimitIfAnnotationProvidedWithDefaultValue()
$this->createGraphQLReadRateLimitAnnotationListener();
$request = $this->createMock(Request::class);
$request->attributes = new ParameterBag();
$request->request = new ParameterBag();
$request->request = new InputBag();
$event = $this->createEventWithGraphQLAnnotation($request, false);

$this->container->expects($this->never())
Expand Down Expand Up @@ -94,7 +95,7 @@ public function testItSetsGraphQLRateLimitIfAnnotationProvidedWithCustomValue():
$this->createGraphQLReadRateLimitAnnotationListener();
$request = $this->createMock(Request::class);
$request->attributes = new ParameterBag();
$request->request = new ParameterBag();
$request->request = new InputBag();
$event = $this->createEventWithGraphQLAnnotation($request, true);

$this->container->expects($this->never())
Expand Down Expand Up @@ -124,7 +125,7 @@ public function testIttDoesNotSetRateLimitIfGraphQLAnnotationAndEndpointNotConfi
$this->createGraphQLReadRateLimitAnnotationListener();
$request = $this->createMock(Request::class);
$request->attributes = new ParameterBag();
$request->request = new ParameterBag();
$request->request = new InputBag();
$event = $this->createEventWithGraphQLAnnotation($request, false);

$this->container->expects($this->never())
Expand All @@ -147,7 +148,7 @@ public function testItSetsGraphQLRateLimitIfPackageNotInstalled(): void
$this->createGraphQLReadRateLimitAnnotationListener();
$request = $this->createMock(Request::class);
$request->attributes = new ParameterBag();
$request->request = new ParameterBag();
$request->request = new InputBag();
$event = $this->createEventWithGraphQLAnnotation($request, false);

$this->annotationReader->expects($this->once())->method('getMethodAnnotation')->willReturn(new GraphQLRateLimitAnnotation(['endpoints' => [['endpoint' => 'GetObject']]]));
Expand Down

0 comments on commit 24e126b

Please sign in to comment.