2026-05-14 04:30:12 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
|
|
namespace App\Tests\Unit\Domain\Order;
|
|
|
|
|
|
|
|
|
|
use App\Domain\Order\Customer;
|
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
|
|
|
|
|
|
final class CustomerTest extends TestCase
|
|
|
|
|
{
|
2026-05-17 22:44:16 +00:00
|
|
|
public function testNewCustomerHasEmptyPlatformIds(): void
|
2026-05-14 04:30:12 +00:00
|
|
|
{
|
|
|
|
|
$customer = new Customer('Max Mustermann', 'max@example.com', []);
|
|
|
|
|
|
|
|
|
|
$this->assertSame([], $customer->getPlatformIds());
|
|
|
|
|
$this->assertNull($customer->getPlatformId('ebay'));
|
|
|
|
|
}
|
|
|
|
|
|
2026-05-17 22:44:16 +00:00
|
|
|
public function testAddPlatformId(): void
|
2026-05-14 04:30:12 +00:00
|
|
|
{
|
|
|
|
|
$customer = new Customer('Max Mustermann', 'max@example.com', []);
|
|
|
|
|
$customer->addPlatformId('ebay', 'ebay-user-123');
|
|
|
|
|
|
|
|
|
|
$this->assertSame('ebay-user-123', $customer->getPlatformId('ebay'));
|
|
|
|
|
}
|
|
|
|
|
|
2026-05-17 22:44:16 +00:00
|
|
|
public function testMatchingKeyIsLowercaseNormalized(): void
|
2026-05-14 04:30:12 +00:00
|
|
|
{
|
|
|
|
|
$customer = new Customer('Max Mustermann', 'max@example.com', [
|
|
|
|
|
'street' => 'Musterstraße 1',
|
|
|
|
|
'city' => 'Berlin',
|
|
|
|
|
'zip' => '10115',
|
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
$expected = 'max mustermann|musterstraße 1|berlin|10115';
|
|
|
|
|
$this->assertSame($expected, $customer->getMatchingKey());
|
|
|
|
|
}
|
|
|
|
|
}
|