invalidApiCriteriaIds example

if (isset($payload['ids'])) {
            if (\is_string($payload['ids'])) {
                $ids = array_filter(explode('|', $payload['ids']));
            } else {
                $ids = $payload['ids'];
            }

            try {
                $criteria->setIds($ids);
            } catch (InvalidCriteriaIdsException $e) {
                throw DataAbstractionLayerException::invalidApiCriteriaIds($e);
            }

            $criteria->setLimit(null);
        } else {
            if (isset($payload['total-count-mode'])) {
                $this->addTotalCountMode((string) $payload['total-count-mode']$criteria);
            }

            if (isset($payload['limit'])) {
                $this->addLimit($payload$criteria$searchException$maxLimit);
            }

            
public function testInvalidCriteriaIds(): void
    {
        $e = DataAbstractionLayerException::invalidCriteriaIds(['foo'], 'bar');

        static::assertSame(Response::HTTP_INTERNAL_SERVER_ERROR, $e->getStatusCode());
        static::assertSame(DataAbstractionLayerException::INVALID_CRITERIA_IDS, $e->getErrorCode());
    }

    public function testInvalidApiCriteriaIds(): void
    {
        $e = DataAbstractionLayerException::invalidApiCriteriaIds(
            DataAbstractionLayerException::invalidCriteriaIds(['foo'], 'bar')
        );

        static::assertSame(Response::HTTP_BAD_REQUEST, $e->getStatusCode());
        static::assertSame(DataAbstractionLayerException::INVALID_API_CRITERIA_IDS, $e->getErrorCode());
    }

    public function testInvalidLanguageId(): void
    {
        $e = DataAbstractionLayerException::invalidLanguageId('foo');

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