40 lines
1.1 KiB
PHP
40 lines
1.1 KiB
PHP
|
|
<?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
|
||
|
|
{
|
||
|
|
public function test_new_customer_has_empty_platform_ids(): void
|
||
|
|
{
|
||
|
|
$customer = new Customer('Max Mustermann', 'max@example.com', []);
|
||
|
|
|
||
|
|
$this->assertSame([], $customer->getPlatformIds());
|
||
|
|
$this->assertNull($customer->getPlatformId('ebay'));
|
||
|
|
}
|
||
|
|
|
||
|
|
public function test_add_platform_id(): void
|
||
|
|
{
|
||
|
|
$customer = new Customer('Max Mustermann', 'max@example.com', []);
|
||
|
|
$customer->addPlatformId('ebay', 'ebay-user-123');
|
||
|
|
|
||
|
|
$this->assertSame('ebay-user-123', $customer->getPlatformId('ebay'));
|
||
|
|
}
|
||
|
|
|
||
|
|
public function test_matching_key_is_lowercase_normalized(): void
|
||
|
|
{
|
||
|
|
$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());
|
||
|
|
}
|
||
|
|
}
|