60 lines
2.1 KiB
PHP
60 lines
2.1 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Tests\Unit\App\Dto;
|
|
|
|
use App\Dto\ProductDto;
|
|
|
|
describe('ProductDto', function () {
|
|
test('it can be instantiated with all properties', function () {
|
|
// GIVEN
|
|
$id = '018f6c40-1234-7123-8123-123456789012';
|
|
$name = 'Poulet Fermier';
|
|
$slug = 'poulet-fermier';
|
|
|
|
// WHEN
|
|
$dto = new ProductDto(
|
|
id: $id,
|
|
name: $name,
|
|
slug: $slug,
|
|
);
|
|
|
|
// THEN
|
|
expect($dto->getRouteKey())->toBe($slug)
|
|
->and($dto->getRouteKeyName())->toBe('slug')
|
|
->and($dto->resolveRouteBinding('some-id'))->toBeNull()
|
|
->and($dto->resolveChildRouteBinding('child', 'some-id', 'field'))->toBeNull()
|
|
->and($dto->toArray())->toBe([
|
|
'id' => $id,
|
|
'name' => $name,
|
|
'slug' => $slug,
|
|
'brand' => null,
|
|
'inco' => null,
|
|
'picture' => null,
|
|
'picture_alt' => null,
|
|
'picture_title' => null,
|
|
'picture_large' => null,
|
|
'picture_large_alt' => null,
|
|
'picture_large_title' => null,
|
|
'price' => null,
|
|
'discount' => null,
|
|
'tax_rate' => null,
|
|
'invoicing_unit' => null,
|
|
'stock' => 0,
|
|
'sell_unit' => null,
|
|
'order_unit' => null,
|
|
'range' => null,
|
|
'tags' => [],
|
|
'order' => 0,
|
|
'product_weight' => null,
|
|
'weight_variable' => false,
|
|
'status' => false,
|
|
'star' => false,
|
|
'orderable_start' => null,
|
|
'orderable_end' => null,
|
|
'short_description' => null,
|
|
'description' => null,
|
|
]);
|
|
});
|
|
});
|