SuperSeller3000/tests/Unit/Domain/Order/CustomerTest.php

40 lines
1.1 KiB
PHP
Raw Permalink Normal View History

<?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 testNewCustomerHasEmptyPlatformIds(): void
{
$customer = new Customer('Max Mustermann', 'max@example.com', []);
$this->assertSame([], $customer->getPlatformIds());
$this->assertNull($customer->getPlatformId('ebay'));
}
public function testAddPlatformId(): 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 testMatchingKeyIsLowercaseNormalized(): 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());
}
}