Add tests for Coolify app payload handling, e-conomic customer fields, and expand Coolify API client capabilities

This commit is contained in:
Jeppe Bundgaard
2026-05-19 16:55:45 +02:00
parent cbf3c2d2b9
commit c2263b8c98
11 changed files with 684 additions and 41 deletions
@@ -60,4 +60,40 @@ it('returns the raw upstream create response and preserves the requested payload
expect($probe->inner->lastPayload['customerNumber'])->toBe(42331123);
expect($probe->inner->lastPayload['corporateIdentificationNumber'])->toBe('37781258');
expect($probe->inner->lastPayload['phone'])->toBe(42331123);
expect($probe->inner->lastPayload['telephoneAndFaxNumber'])->toBe('42331123');
expect($probe->inner->lastPayload['mobilePhone'])->toBe('42331123');
});
it('adds supported CVR company fields to the e-conomic customer payload', function (): void {
$stubResponse = (object)[
'customerNumber' => 42331123,
'name' => 'Truckwash ApS',
];
$companyInformation = (object)[
'address' => 'Testvej 12',
'zipcode' => 2630,
'city' => 'Taastrup',
'website' => 'https://truckwash.test',
'industrycode' => 953190,
];
$probe = new EconomicCreateCustomerProbe($stubResponse);
$result = $probe->createCustomer(
42331123,
'Truckwash ApS',
37781258,
'invoice@truckwash.test',
42331123,
55667788,
$companyInformation,
);
expect($result)->toBe($stubResponse);
expect($probe->inner->lastPayload['address'])->toBe('Testvej 12');
expect($probe->inner->lastPayload['zip'])->toBe('2630');
expect($probe->inner->lastPayload['city'])->toBe('Taastrup');
expect($probe->inner->lastPayload['website'])->toBe('https://truckwash.test');
expect($probe->inner->lastPayload['telephoneAndFaxNumber'])->toBe('42331123');
expect($probe->inner->lastPayload['mobilePhone'])->toBe('55667788');
expect(array_key_exists('industrycode', $probe->inner->lastPayload))->toBeFalse();
});