Add customer mass import service with API route, test coverage, and e-conomic integration

This commit is contained in:
Jeppe Bundgaard
2026-04-23 21:07:21 +02:00
parent 4420d76cd2
commit 0813bfc0f0
27 changed files with 2801 additions and 238 deletions
@@ -92,6 +92,7 @@ it('prefers EDGE_PUBLIC_API_URL when explicitly configured', function (): void {
with_edge_gateway_server_state([
'HTTP_HOST' => 'localhost',
'HTTP_X_FORWARDED_PROTO' => 'http',
'HTTP_X_FORWARDED_PREFIX' => '/api',
], function (): void {
putenv('EDGE_PUBLIC_API_URL=https://edge.example.test/api');
@@ -118,3 +119,37 @@ it('builds websocket broker urls on the traefik broker path', function (): void
->toBe('wss://api.truckwash.io:4433/edge-broker/ws/browser-shell');
});
});
it('builds localhost websocket broker urls on the local traefik api prefix', function (): void {
with_edge_gateway_server_state([
'HTTP_HOST' => 'localhost',
'HTTP_X_FORWARDED_PROTO' => 'http',
'HTTP_X_FORWARDED_PREFIX' => '/api',
], function (): void {
$manager = new EdgeGatewayManagerUrlHarness();
expect($manager->getApiBaseUrl())
->toBe('http://localhost/api');
expect(invoke_edge_gateway_private($manager, 'buildBrokerPublicUrl'))
->toBe('http://localhost/api/edge-broker');
expect(invoke_edge_gateway_private($manager, 'buildBrokerPublicWebSocketUrl', '/ws/browser-gateway-stream'))
->toBe('ws://localhost/api/edge-broker/ws/browser-gateway-stream');
expect(invoke_edge_gateway_private($manager, 'buildBrokerPublicWebSocketUrl', '/ws/browser-shell'))
->toBe('ws://localhost/api/edge-broker/ws/browser-shell');
});
});
it('keeps root-host api urls unprefixed when the request is not under the local api alias', function (): void {
with_edge_gateway_server_state([
'HTTP_HOST' => 'localhost',
'HTTP_X_FORWARDED_PROTO' => 'http',
'REQUEST_URI' => '/edge-gateways/84/stream-session',
], function (): void {
$manager = new EdgeGatewayManagerUrlHarness();
expect($manager->getApiBaseUrl())
->toBe('http://localhost');
expect(invoke_edge_gateway_private($manager, 'buildBrokerPublicUrl'))
->toBe('http://localhost/edge-broker');
});
});