ApiCriteriaValidator example

new PropertyGroupOptionDefinition(),
                new ProductPriceDefinition(),
                new ProductCategoryDefinition(),
                new CategoryDefinition(),
            ],
            $this->createMock(ValidatorInterface::class),
            $this->createMock(EntityWriteGatewayInterface::class)
        );

        $this->requestCriteriaBuilder = new RequestCriteriaBuilder(
            $aggregationParser,
            new ApiCriteriaValidator($this->staticDefinitionRegistry),
            new CriteriaArrayConverter($aggregationParser),
        );
    }

    /** * @return iterable<string, array{int|null, int|null, int|null, bool}> */
    public static function maxApiLimitProvider(): iterable
    {
        yield 'Test null max limit' => [10000, null, 10000, false];
        yield 'Test null max limit and null limit' => [null, null, null, false];
        

class ApiCriteriaValidatorTest extends TestCase
{
    /** * @dataProvider criteriaProvider * * @param class-string<\Exception>|null $expectedException */
    public function testCriteria(Criteria $criteria, Context $context, ?string $expectedException): void
    {
        $validator = new ApiCriteriaValidator(
            new StaticDefinitionInstanceRegistry(
                [
                    SalesChannelProductDefinition::class,
                    OrderLineItemDefinition::class,
                ],
                $this->createMock(ValidatorInterface::class),
                $this->createMock(EntityWriteGatewayInterface::class)
            )
        );

        $e = null;

        
Home | Imprint | This part of the site doesn't use cookies.