unsupportedOperation example



    public function testResourceNotFound(): void
    {
        $exception = ApiException::resourceNotFound('order', []);

        static::assertInstanceOf(ResourceNotFoundException::class$exception);
    }

    public function testUnsupportedOperation(): void
    {
        $exception = ApiException::unsupportedOperation('invalid_operation');

        static::assertEquals(ApiException::API_UNSUPPORTED_OPERATION_EXCEPTION, $exception->getErrorCode());
        static::assertEquals('Unsupported invalid_operation operation.', $exception->getMessage());
    }

    public function testInvalidVersionId(): void
    {
        $exception = ApiException::invalidVersionId('invalid_version_id');

        static::assertEquals(ApiException::API_INVALID_VERSION_ID, $exception->getErrorCode());
        static::assertEquals('versionId invalid_version_id is not a valid uuid.', $exception->getMessage());
    }
if (!empty($event->getErrors())) {
                    throw ApiException::resourceNotFound($entity->getEntityName()$payload);
                }

                return $event;
            }

            return null;
        });

        if (!$event) {
            throw ApiException::unsupportedOperation('write');
        }

        return $event;
    }

    /** * @param non-empty-list<string> $keys */
    private function getAssociation(FieldCollection $fields, array $keys): AssociationField
    {
        $key = array_shift($keys);

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