Skip to content

Commit 01a11a4

Browse files
committed
fix tests
1 parent 3af3e93 commit 01a11a4

18 files changed

+116
-291
lines changed

phpstan.neon.dist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ parameters:
5656
-
5757
message: '#expects ApiPlatform\\Metadata\\GraphQl\\Operation\|null, ApiPlatform\\Metadata\\Operation given#'
5858
paths:
59-
- tests/GraphQl/Resolver/Factory/
59+
- src/GraphQl/Tests/Resolver/Factory/
6060
- '#Access to an undefined property Prophecy\\Prophecy\\ObjectProphecy<(\\?[a-zA-Z0-9_]+)+>::\$[a-zA-Z0-9_]+#'
6161
# https://github.com/willdurand/Negotiation/issues/89#issuecomment-513283286
6262
-
@@ -65,7 +65,7 @@ parameters:
6565
# https://github.com/phpstan/phpstan-symfony/issues/76
6666
-
6767
message: '#Service "test" is not registered in the container\.#'
68-
path: tests/GraphQl/Type/TypesContainerTest.php
68+
path: src/GraphQl/Tests/Type/TypesContainerTest.php
6969

7070
# Expected, due to optional interfaces
7171
- '#Method Symfony\\Component\\Serializer\\NameConverter\\NameConverterInterface::denormalize\(\) invoked with (2|3|4) parameters, 1 required\.#'

src/Api/CompositeIdentifierParser.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
* Normalizes a composite identifier.
1818
*
1919
* @author Antoine Bluchet <[email protected]>
20+
* @deprecated
2021
*/
2122
final class CompositeIdentifierParser
2223
{

src/Api/ResourceClassResolverInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
class_exists(\ApiPlatform\Metadata\ResourceClassResolverInterface::class);
1717

18-
if (false) {
18+
if (false) { // @phpstan-ignore-line
1919
interface ResourceClassResolverInterface extends \ApiPlatform\Metadata\ResourceClassResolverInterface
2020
{
2121
}

src/Exception/InvalidArgumentException.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,11 @@
1313

1414
namespace ApiPlatform\Exception;
1515

16-
use ApiPlatform\Metadata\Exception\InvalidArgumentException as MetadataInvalidArgumentException;
17-
1816
/**
1917
* Invalid argument exception.
2018
*
2119
* @author Kévin Dunglas <[email protected]>
22-
*
23-
* @deprecated use \ApiPlatform\Metadata\Exception\InvalidArgumentException
2420
*/
25-
class InvalidArgumentException extends MetadataInvalidArgumentException
21+
class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
2622
{
2723
}

src/Exception/InvalidIdentifierException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@
1818
*
1919
* @author Antoine Bluchet <[email protected]>
2020
*/
21-
final class InvalidIdentifierException extends \Exception implements ExceptionInterface
21+
class InvalidIdentifierException extends \Exception implements ExceptionInterface
2222
{
2323
}

src/Exception/InvalidUriVariableException.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717
* Identifier is not valid exception.
1818
*
1919
* @author Antoine Bluchet <[email protected]>
20-
*
21-
* @final
2220
*/
2321
class InvalidUriVariableException extends \Exception implements ExceptionInterface
2422
{

src/GraphQl/.php-cs-fixer.dist.php

Lines changed: 0 additions & 120 deletions
This file was deleted.

src/GraphQl/Tests/Fixtures/ApiResource/Dummy.php

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@
1414
namespace ApiPlatform\GraphQl\Tests\Fixtures\ApiResource;
1515

1616
use ApiPlatform\Metadata\ApiProperty;
17-
use ApiPlatform\Tests\Fixtures\TestBundle\Entity\RelatedDummy;
18-
use ApiPlatform\Tests\Fixtures\TestBundle\Entity\RelatedOwnedDummy;
19-
use ApiPlatform\Tests\Fixtures\TestBundle\Entity\RelatedOwningDummy;
20-
use Doctrine\Common\Collections\Collection;
2117

2218
/**
2319
* Dummy.
@@ -194,44 +190,6 @@ public function getArrayData()
194190
return $this->arrayData;
195191
}
196192

197-
public function getRelatedDummy(): ?RelatedDummy
198-
{
199-
return $this->relatedDummy;
200-
}
201-
202-
public function setRelatedDummy(RelatedDummy $relatedDummy): void
203-
{
204-
$this->relatedDummy = $relatedDummy;
205-
}
206-
207-
public function addRelatedDummy(RelatedDummy $relatedDummy): void
208-
{
209-
$this->relatedDummies->add($relatedDummy);
210-
}
211-
212-
public function getRelatedOwnedDummy()
213-
{
214-
return $this->relatedOwnedDummy;
215-
}
216-
217-
public function setRelatedOwnedDummy(RelatedOwnedDummy $relatedOwnedDummy): void
218-
{
219-
$this->relatedOwnedDummy = $relatedOwnedDummy;
220-
if ($this !== $this->relatedOwnedDummy->getOwningDummy()) {
221-
$this->relatedOwnedDummy->setOwningDummy($this);
222-
}
223-
}
224-
225-
public function getRelatedOwningDummy()
226-
{
227-
return $this->relatedOwningDummy;
228-
}
229-
230-
public function setRelatedOwningDummy(RelatedOwningDummy $relatedOwningDummy): void
231-
{
232-
$this->relatedOwningDummy = $relatedOwningDummy;
233-
}
234-
235193
public function isDummyBoolean(): ?bool
236194
{
237195
return $this->dummyBoolean;
@@ -254,9 +212,4 @@ public function getDummy()
254212
{
255213
return $this->dummy;
256214
}
257-
258-
public function getRelatedDummies(): Collection|iterable
259-
{
260-
return $this->relatedDummies;
261-
}
262215
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the API Platform project.
5+
*
6+
* (c) Kévin Dunglas <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
declare(strict_types=1);
13+
14+
namespace ApiPlatform\Metadata\Exception;
15+
16+
use ApiPlatform\Exception\InvalidIdentifierException as LegacyInvalidIdentifierException;
17+
18+
if (class_exists(LegacyInvalidIdentifierException::class)) {
19+
class InvalidIdentifierException extends LegacyInvalidIdentifierException
20+
{
21+
}
22+
} else {
23+
/**
24+
* Identifier is not valid exception.
25+
*
26+
* @author Antoine Bluchet <[email protected]>
27+
*/
28+
final class InvalidIdentifierException extends \Exception implements ExceptionInterface
29+
{
30+
}
31+
}

src/Metadata/IdentifiersExtractor.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,13 @@
1313

1414
namespace ApiPlatform\Metadata;
1515

16+
use ApiPlatform\Api\ResourceClassResolverInterface as LegacyResourceClassResolverInterface;
1617
use ApiPlatform\Metadata\Exception\RuntimeException;
1718
use ApiPlatform\Metadata\GraphQl\Operation as GraphQlOperation;
1819
use ApiPlatform\Metadata\Property\Factory\PropertyMetadataFactoryInterface;
1920
use ApiPlatform\Metadata\Property\Factory\PropertyNameCollectionFactoryInterface;
2021
use ApiPlatform\Metadata\Resource\Factory\ResourceMetadataCollectionFactoryInterface;
22+
use ApiPlatform\Metadata\Util\CompositeIdentifierParser;
2123
use ApiPlatform\Metadata\Util\ResourceClassInfoTrait;
2224
use Symfony\Component\PropertyAccess\Exception\NoSuchPropertyException;
2325
use Symfony\Component\PropertyAccess\PropertyAccess;

0 commit comments

Comments
 (0)