feat: bootstrap JOBcard CRM foundation

This commit is contained in:
Marco0300
2026-09-01 18:54:47 +02:00
commit 480494c5ed
31 changed files with 1300 additions and 0 deletions
+38
View File
@@ -0,0 +1,38 @@
<?php
declare(strict_types=1);
require_once __DIR__ . '/../app/Domain/Client/ClientContactValidator.php';
$invalid = validate_client_contact([
'name' => ' ',
'email' => 'not-an-email',
'phone' => str_repeat('1', 61),
'is_primary' => 'maybe',
]);
foreach (['name', 'email', 'phone', 'is_primary'] as $key) {
if (!isset($invalid['errors'][$key])) {
throw new RuntimeException("Expected validation error for {$key}");
}
}
$valid = validate_client_contact([
'name' => ' Jane Doe ',
'email' => ' JANE@example.com ',
'phone' => ' +27 11 555 0100 ',
'is_primary' => '1',
]);
if ($valid['errors'] !== []
|| $valid['name'] !== 'Jane Doe'
|| $valid['email'] !== 'jane@example.com'
|| $valid['phone'] !== '+27 11 555 0100'
|| $valid['is_primary'] !== true
) {
throw new RuntimeException('Expected contact input to be normalized');
}
$optional = normalize_client_contact(['name' => 'Sam']);
if ($optional !== ['name' => 'Sam', 'email' => null, 'phone' => null, 'is_primary' => false]) {
throw new RuntimeException('Expected optional contact fields to normalize to null/defaults');
}
printf("Client contact validator tests: 3 passed\n");