40 lines
1.3 KiB
PHP
40 lines
1.3 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use App\Dto\ShopDto;
|
|
|
|
describe('ShopDto', function () {
|
|
test('it can be instantiated directly and converts to array', function () {
|
|
// GIVEN & WHEN
|
|
$dto = new ShopDto(
|
|
id: '018f4a2b-3c4d-7e8f-9a0b-1c2d3e4f5a6b',
|
|
name: 'Boutique Principale',
|
|
address: '1 rue de Paris',
|
|
postcode: '75001',
|
|
city: 'Paris',
|
|
phone: '+33102030405',
|
|
latitude: '48.8566',
|
|
longitude: '2.3522',
|
|
default: true,
|
|
);
|
|
|
|
// THEN
|
|
expect($dto->id)->toBe('018f4a2b-3c4d-7e8f-9a0b-1c2d3e4f5a6b')
|
|
->and($dto->name)->toBe('Boutique Principale')
|
|
->and($dto->getRouteKey())->toBe('018f4a2b-3c4d-7e8f-9a0b-1c2d3e4f5a6b')
|
|
->and($dto->getRouteKeyName())->toBe('id')
|
|
->and($dto->default)->toBeTrue()
|
|
->and($dto->toArray())->toBe([
|
|
'id' => '018f4a2b-3c4d-7e8f-9a0b-1c2d3e4f5a6b',
|
|
'name' => 'Boutique Principale',
|
|
'address' => '1 rue de Paris',
|
|
'postcode' => '75001',
|
|
'city' => 'Paris',
|
|
'phone' => '+33102030405',
|
|
'latitude' => '48.8566',
|
|
'longitude' => '2.3522',
|
|
'default' => true,
|
|
]);
|
|
});
|
|
});
|