Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/Doctrine/Common/Tests/CollectionPaginatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@

use ApiPlatform\Doctrine\Common\CollectionPaginator;
use Doctrine\Common\Collections\ArrayCollection;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;

class CollectionPaginatorTest extends TestCase
{
#[\PHPUnit\Framework\Attributes\DataProvider('initializeProvider')]
#[DataProvider('initializeProvider')]
public function testInitialize($results, $currentPage, $itemsPerPage, $totalItems, $lastPage, $currentItems): void
{
$results = new ArrayCollection($results);
Expand Down
3 changes: 2 additions & 1 deletion src/Doctrine/Common/Tests/SelectablePaginatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@

use ApiPlatform\Doctrine\Common\SelectablePaginator;
use Doctrine\Common\Collections\ArrayCollection;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;

class SelectablePaginatorTest extends TestCase
{
#[\PHPUnit\Framework\Attributes\DataProvider('initializeProvider')]
#[DataProvider('initializeProvider')]
public function testInitialize($results, $currentPage, $itemsPerPage, $totalItems, $lastPage, $currentItems): void
{
$results = new ArrayCollection($results);
Expand Down
3 changes: 2 additions & 1 deletion src/Doctrine/Common/Tests/SelectablePartialPaginatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@

use ApiPlatform\Doctrine\Common\SelectablePartialPaginator;
use Doctrine\Common\Collections\ArrayCollection;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;

class SelectablePartialPaginatorTest extends TestCase
{
#[\PHPUnit\Framework\Attributes\DataProvider('initializeProvider')]
#[DataProvider('initializeProvider')]
public function testInitialize($results, $currentPage, $itemsPerPage, $currentItems): void
{
$results = new ArrayCollection($results);
Expand Down
3 changes: 2 additions & 1 deletion src/Doctrine/Common/Tests/State/PersistProcessorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
use Doctrine\ORM\Mapping\ClassMetadata as ORMClassMetadata;
use Doctrine\Persistence\ManagerRegistry;
use Doctrine\Persistence\ObjectManager;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prediction\CallPrediction;
Expand Down Expand Up @@ -93,7 +94,7 @@ public static function getTrackingPolicyParameters(): array
];
}

#[\PHPUnit\Framework\Attributes\DataProvider('getTrackingPolicyParameters')]
#[DataProvider('getTrackingPolicyParameters')]
public function testTrackingPolicy(string $metadataClass, bool $deferredExplicit, bool $persisted): void
{
$dummy = new Dummy();
Expand Down
3 changes: 2 additions & 1 deletion src/Doctrine/Odm/Tests/DoctrineMongoDbOdmFilterTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use Doctrine\ODM\MongoDB\DocumentManager;
use Doctrine\ODM\MongoDB\Repository\DocumentRepository;
use Doctrine\Persistence\ManagerRegistry;
use PHPUnit\Framework\Attributes\DataProvider;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;

/**
Expand Down Expand Up @@ -45,7 +46,7 @@ protected function setUp(): void
$this->repository = $this->manager->getRepository($this->resourceClass);
}

#[\PHPUnit\Framework\Attributes\DataProvider('provideApplyTestData')]
#[DataProvider('provideApplyTestData')]
public function testApply(?array $properties, array $filterParameters, array $expectedPipeline, ?callable $factory = null, ?string $resourceClass = null): void
{
$this->doTestApply($properties, $filterParameters, $expectedPipeline, $factory, $resourceClass);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
use ApiPlatform\Metadata\Resource\ResourceMetadataCollection;
use Doctrine\ODM\MongoDB\DocumentManager;
use Doctrine\Persistence\ManagerRegistry;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;

Expand Down Expand Up @@ -70,7 +71,7 @@ public function testWithoutManager(): void
$this->assertNull($resourceMetadataCollection->getOperation('graphql_get')->getProvider());
}

#[\PHPUnit\Framework\Attributes\DataProvider('operationProvider')]
#[DataProvider('operationProvider')]
public function testWithProvider(HttpOperation $operation, ?string $expectedProvider = null, ?string $expectedProcessor = null): void
{
if (!class_exists(DocumentManager::class)) {
Expand Down
3 changes: 2 additions & 1 deletion src/Doctrine/Odm/Tests/PaginatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
use ApiPlatform\Metadata\Exception\RuntimeException;
use Doctrine\ODM\MongoDB\DocumentManager;
use Doctrine\ODM\MongoDB\Iterator\Iterator;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\TestWith;
use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;
Expand All @@ -26,7 +27,7 @@ class PaginatorTest extends TestCase
{
use ProphecyTrait;

#[\PHPUnit\Framework\Attributes\DataProvider('initializeProvider')]
#[DataProvider('initializeProvider')]
public function testInitialize(int $firstResult, int $maxResults, int $totalItems, int $currentPage, int $lastPage, bool $hasNextPage): void
{
$paginator = $this->getPaginator($firstResult, $maxResults, $totalItems);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
use Doctrine\Common\Collections\Collection;
use Doctrine\ODM\MongoDB\DocumentManager;
use Doctrine\ODM\MongoDB\Types\Type as MongoDbType;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\IgnoreDeprecations;
use PHPUnit\Framework\TestCase;
use Symfony\Component\PropertyInfo\Type as LegacyType;
Expand Down Expand Up @@ -84,7 +85,7 @@ public function testTestGetPropertiesWithEmbedded(): void
);
}

#[\PHPUnit\Framework\Attributes\DataProvider('typesProvider')]
#[DataProvider('typesProvider')]
public function testExtract(string $property, ?Type $type): void
{
$this->assertEquals($type, $this->createExtractor()->getType(DoctrineDummy::class, $property));
Expand Down
3 changes: 2 additions & 1 deletion src/Doctrine/Orm/Tests/DoctrineOrmFilterTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
use ApiPlatform\Doctrine\Orm\Util\QueryNameGenerator;
use Doctrine\ORM\EntityRepository;
use Doctrine\Persistence\ManagerRegistry;
use PHPUnit\Framework\Attributes\DataProvider;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;

/**
Expand Down Expand Up @@ -45,7 +46,7 @@ protected function setUp(): void
$this->repository = $this->managerRegistry->getManagerForClass(Dummy::class)->getRepository(Dummy::class);
}

#[\PHPUnit\Framework\Attributes\DataProvider('provideApplyTestData')]
#[DataProvider('provideApplyTestData')]
public function testApply(?array $properties, array $filterParameters, string $expectedDql, ?array $expectedParameters = null, ?callable $factory = null, ?string $resourceClass = null): void
{
$this->doTestApply($properties, $filterParameters, $expectedDql, $expectedParameters, $factory, $resourceClass);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
use Doctrine\ORM\Mapping\JoinColumn;
use Doctrine\ORM\Query\Expr\Join;
use Doctrine\ORM\QueryBuilder;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Prophecy\Argument;
use Prophecy\PhpUnit\ProphecyTrait;
Expand Down Expand Up @@ -1000,7 +1001,7 @@ public function testApplyToCollectionWithANonReadableButFetchEagerProperty(): vo
$eagerExtensionTest->applyToCollection($queryBuilder, new QueryNameGenerator(), Dummy::class, new GetCollection(normalizationContext: [AbstractNormalizer::GROUPS => 'foo']));
}

#[\PHPUnit\Framework\Attributes\DataProvider('provideExistingJoinCases')]
#[DataProvider('provideExistingJoinCases')]
public function testApplyToCollectionWithExistingJoin(string $joinType): void
{
$context = ['groups' => ['foo']];
Expand Down
5 changes: 3 additions & 2 deletions src/Doctrine/Orm/Tests/Extension/PaginationExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
use Doctrine\ORM\QueryBuilder;
use Doctrine\ORM\Tools\Pagination\CountWalker;
use Doctrine\Persistence\ManagerRegistry;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Prophecy\Argument;
use Prophecy\PhpUnit\ProphecyTrait;
Expand Down Expand Up @@ -355,7 +356,7 @@ public function testGetResultWithoutDistinct(): void
$this->assertFalse($query->getHint(CountWalker::HINT_DISTINCT));
}

#[\PHPUnit\Framework\Attributes\DataProvider('fetchJoinCollectionProvider')]
#[DataProvider('fetchJoinCollectionProvider')]
public function testGetResultWithFetchJoinCollection(bool $paginationFetchJoinCollection, array $context, bool $expected): void
{
$dummyMetadata = new ClassMetadata(Dummy::class);
Expand Down Expand Up @@ -403,7 +404,7 @@ public static function fetchJoinCollectionProvider(): array
];
}

#[\PHPUnit\Framework\Attributes\DataProvider('fetchUseOutputWalkersProvider')]
#[DataProvider('fetchUseOutputWalkersProvider')]
public function testGetResultWithUseOutputWalkers(bool $paginationUseOutputWalkers, array $context, bool $expected): void
{
$dummyMetadata = new ClassMetadata(Dummy::class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
use ApiPlatform\Metadata\Resource\ResourceMetadataCollection;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\Persistence\ManagerRegistry;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;

Expand Down Expand Up @@ -62,7 +63,7 @@ public function testWithoutManager(): void
$this->assertNull($resourceMetadataCollection->getOperation('graphql_get')->getProvider());
}

#[\PHPUnit\Framework\Attributes\DataProvider('operationProvider')]
#[DataProvider('operationProvider')]
public function testWithProvider(HttpOperation $operation, ?string $expectedProvider = null, ?string $expectedProcessor = null): void
{
$objectManager = $this->prophesize(EntityManagerInterface::class);
Expand Down
3 changes: 2 additions & 1 deletion src/Doctrine/Orm/Tests/PaginatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\Query;
use Doctrine\ORM\Tools\Pagination\Paginator as DoctrinePaginator;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Prophecy\Argument;
use Prophecy\PhpUnit\ProphecyTrait;
Expand All @@ -30,7 +31,7 @@ class PaginatorTest extends TestCase
{
use ProphecyTrait;

#[\PHPUnit\Framework\Attributes\DataProvider('initializeProvider')]
#[DataProvider('initializeProvider')]
public function testInitialize(int $firstResult, int $maxResults, int $totalItems, int $currentPage, int $lastPage, bool $hasNextPage): void
{
$paginator = $this->getPaginator($firstResult, $maxResults, $totalItems);
Expand Down
3 changes: 2 additions & 1 deletion src/Doctrine/Orm/Tests/Util/QueryBuilderHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
use Doctrine\ORM\Mapping\ClassMetadata;
use Doctrine\ORM\QueryBuilder;
use Doctrine\Persistence\ManagerRegistry;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Prophecy\Argument;
use Prophecy\PhpUnit\ProphecyTrait;
Expand All @@ -29,7 +30,7 @@ class QueryBuilderHelperTest extends TestCase
{
use ProphecyTrait;

#[\PHPUnit\Framework\Attributes\DataProvider('provideAddJoinOnce')]
#[DataProvider('provideAddJoinOnce')]
public function testAddJoinOnce(?string $originAliasForJoinOnce, string $expectedAlias): void
{
$queryBuilder = new QueryBuilder($this->prophesize(EntityManagerInterface::class)->reveal());
Expand Down
3 changes: 2 additions & 1 deletion src/GraphQl/Tests/Action/EntrypointActionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
use GraphQL\Error\Error;
use GraphQL\Executor\ExecutionResult;
use GraphQL\Type\Schema;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Prophecy\Argument;
use Prophecy\PhpUnit\ProphecyTrait;
Expand Down Expand Up @@ -91,7 +92,7 @@ public function testPostJsonAction(): void
$this->assertEqualsWithoutDateHeader(new JsonResponse(['GraphQL']), $mockedEntrypoint($request));
}

#[\PHPUnit\Framework\Attributes\DataProvider('multipartRequestProvider')]
#[DataProvider('multipartRequestProvider')]
public function testMultipartRequestAction(?string $operations, ?string $map, array $files, array $variables, Response $expectedResponse): void
{
$requestParams = [];
Expand Down
3 changes: 2 additions & 1 deletion src/GraphQl/Tests/Resolver/Factory/ResolverFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,12 @@
use ApiPlatform\State\ProcessorInterface;
use ApiPlatform\State\ProviderInterface;
use GraphQL\Type\Definition\ResolveInfo;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;

class ResolverFactoryTest extends TestCase
{
#[\PHPUnit\Framework\Attributes\DataProvider('graphQlQueries')]
#[DataProvider('graphQlQueries')]
public function testGraphQlResolver(?string $resourceClass = null, ?string $rootClass = null, ?Operation $operation = null, ?Operation $providedOperation = null, ?Operation $processedOperation = null): void
{
$returnValue = new \stdClass();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

use ApiPlatform\GraphQl\Serializer\Exception\HttpExceptionNormalizer;
use GraphQL\Error\Error;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
use Symfony\Component\HttpKernel\Exception\HttpException;
Expand All @@ -35,7 +36,7 @@ protected function setUp(): void
$this->httpExceptionNormalizer = new HttpExceptionNormalizer();
}

#[\PHPUnit\Framework\Attributes\DataProvider('exceptionProvider')]
#[DataProvider('exceptionProvider')]
public function testNormalize(HttpException $exception, string $expectedExceptionMessage, int $expectedStatus, string $expectedCategory): void
{
$error = new Error('test message', null, null, [], null, $exception);
Expand Down
5 changes: 3 additions & 2 deletions src/GraphQl/Tests/Serializer/SerializerContextBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
use ApiPlatform\Metadata\GraphQl\Query;
use ApiPlatform\Metadata\GraphQl\Subscription;
use GraphQL\Type\Definition\ResolveInfo;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Prophecy\Argument;
use Prophecy\PhpUnit\ProphecyTrait;
Expand Down Expand Up @@ -80,7 +81,7 @@ private function buildOperationFromContext(bool $isMutation, bool $isSubscriptio
return $operation;
}

#[\PHPUnit\Framework\Attributes\DataProvider('createNormalizationContextProvider')]
#[DataProvider('createNormalizationContextProvider')]
public function testCreateNormalizationContext(?string $resourceClass, string $operationName, array $fields, bool $isMutation, bool $isSubscription, bool $noInfo, array $expectedContext, ?callable $advancedNameConverter = null, ?string $expectedExceptionClass = null, ?string $expectedExceptionMessage = null): void
{
$resolverContext = [];
Expand Down Expand Up @@ -292,7 +293,7 @@ public static function createNormalizationContextProvider(): iterable
];
}

#[\PHPUnit\Framework\Attributes\DataProvider('createDenormalizationContextProvider')]
#[DataProvider('createDenormalizationContextProvider')]
public function testCreateDenormalizationContext(?string $resourceClass, string $operationName, array $expectedContext): void
{
$operation = $this->buildOperationFromContext(true, false, $expectedContext, false, $resourceClass);
Expand Down
5 changes: 3 additions & 2 deletions src/GraphQl/Tests/State/Processor/NormalizeProcessorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
use ApiPlatform\State\Pagination\Pagination;
use ApiPlatform\State\Pagination\PartialPaginatorInterface;
use GraphQL\Type\Definition\ResolveInfo;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\ObjectProphecy;
Expand All @@ -42,7 +43,7 @@ protected function setUp(): void
$this->resolveInfoProphecy = $this->prophesize(ResolveInfo::class);
}

#[\PHPUnit\Framework\Attributes\DataProvider('processItems')]
#[DataProvider('processItems')]
public function testProcess($body, $operation): void
{
$context = ['args' => []];
Expand All @@ -64,7 +65,7 @@ public static function processItems(): array
];
}

#[\PHPUnit\Framework\Attributes\DataProvider('processCollection')]
#[DataProvider('processCollection')]
public function testProcessCollection($collection, $operation, $args, ?array $expectedResult, array $getFieldSelection, ?string $expectedExceptionClass = null, ?string $expectedExceptionMessage = null): void
{
$this->resolveInfoProphecy->getFieldSelection(1)->willReturn($getFieldSelection);
Expand Down
13 changes: 7 additions & 6 deletions src/GraphQl/Tests/Type/FieldsBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
use GraphQL\Type\Definition\NonNull;
use GraphQL\Type\Definition\ObjectType;
use GraphQL\Type\Definition\Type as GraphQLType;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Prophecy\Argument;
use Prophecy\PhpUnit\ProphecyTrait;
Expand Down Expand Up @@ -114,7 +115,7 @@ public function testGetNodeQueryFields(): void
$this->assertSame($itemResolver, $nodeQueryFields['resolve']);
}

#[\PHPUnit\Framework\Attributes\DataProvider('itemQueryFieldsProvider')]
#[DataProvider('itemQueryFieldsProvider')]
public function testGetItemQueryFields(string $resourceClass, Operation $operation, array $configuration, ?GraphQLType $graphqlType, ?callable $resolver, array $expectedQueryFields): void
{
$this->resourceClassResolverProphecy->isResourceClass($resourceClass)->willReturn(true);
Expand Down Expand Up @@ -192,7 +193,7 @@ public static function itemQueryFieldsProvider(): array
];
}

#[\PHPUnit\Framework\Attributes\DataProvider('collectionQueryFieldsProvider')]
#[DataProvider('collectionQueryFieldsProvider')]
public function testGetCollectionQueryFields(string $resourceClass, Operation $operation, array $configuration, ?GraphQLType $graphqlType, ?callable $resolver, array $expectedQueryFields): void
{
$this->resourceClassResolverProphecy->isResourceClass($resourceClass)->willReturn(true);
Expand Down Expand Up @@ -342,7 +343,7 @@ public static function collectionQueryFieldsProvider(): array
];
}

#[\PHPUnit\Framework\Attributes\DataProvider('mutationFieldsProvider')]
#[DataProvider('mutationFieldsProvider')]
public function testGetMutationFields(string $resourceClass, Operation $operation, GraphQLType $graphqlType, GraphQLType $inputGraphqlType, ?callable $mutationResolver, array $expectedMutationFields): void
{
$this->resourceClassResolverProphecy->isResourceClass($resourceClass)->willReturn(true);
Expand Down Expand Up @@ -401,7 +402,7 @@ public static function mutationFieldsProvider(): array
];
}

#[\PHPUnit\Framework\Attributes\DataProvider('subscriptionFieldsProvider')]
#[DataProvider('subscriptionFieldsProvider')]
public function testGetSubscriptionFields(string $resourceClass, Operation $operation, GraphQLType $graphqlType, GraphQLType $inputGraphqlType, ?callable $subscriptionResolver, array $expectedSubscriptionFields): void
{
$this->resourceClassResolverProphecy->isResourceClass($resourceClass)->willReturn(true);
Expand Down Expand Up @@ -463,7 +464,7 @@ public static function subscriptionFieldsProvider(): array
];
}

#[\PHPUnit\Framework\Attributes\DataProvider('resourceObjectTypeFieldsProvider')]
#[DataProvider('resourceObjectTypeFieldsProvider')]
public function testGetResourceObjectTypeFields(string $resourceClass, Operation $operation, array $properties, bool $input, int $depth, ?array $ioMetadata, array $expectedResourceObjectTypeFields, ?callable $advancedNameConverterFactory = null): void
{
$resourceClassResolver = $this->createMock(ResourceClassResolverInterface::class);
Expand Down Expand Up @@ -920,7 +921,7 @@ public function testGetEnumFields(): void
], $enumFields);
}

#[\PHPUnit\Framework\Attributes\DataProvider('resolveResourceArgsProvider')]
#[DataProvider('resolveResourceArgsProvider')]
public function testResolveResourceArgs(array $args, array $expectedResolvedArgs, ?string $expectedExceptionMessage = null): void
{
if (null !== $expectedExceptionMessage) {
Expand Down
Loading
Loading