41 lines
1.3 KiB
PHP
41 lines
1.3 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
declare(strict_types=1);
|
||
|
|
|
||
|
|
use App\Dto\RangeDto;
|
||
|
|
|
||
|
|
describe('RangeDto', function () {
|
||
|
|
test('it can be instantiated directly and converts to array', function () {
|
||
|
|
// GIVEN & WHEN
|
||
|
|
$dto = new RangeDto(
|
||
|
|
id: 1,
|
||
|
|
name: 'Gamme Découverte',
|
||
|
|
slug: 'gamme-decouverte',
|
||
|
|
description: '<p>Description</p>',
|
||
|
|
picture: 'ranges/pic.jpg',
|
||
|
|
picture_alt: 'Alt text',
|
||
|
|
picture_title: 'Title text',
|
||
|
|
order: 2,
|
||
|
|
status: true,
|
||
|
|
);
|
||
|
|
|
||
|
|
// THEN
|
||
|
|
expect($dto->id)->toBe(1)
|
||
|
|
->and($dto->name)->toBe('Gamme Découverte')
|
||
|
|
->and($dto->slug)->toBe('gamme-decouverte')
|
||
|
|
->and($dto->getRouteKey())->toBe('gamme-decouverte')
|
||
|
|
->and($dto->getRouteKeyName())->toBe('slug')
|
||
|
|
->and($dto->toArray())->toBe([
|
||
|
|
'id' => 1,
|
||
|
|
'name' => 'Gamme Découverte',
|
||
|
|
'slug' => 'gamme-decouverte',
|
||
|
|
'description' => '<p>Description</p>',
|
||
|
|
'picture' => 'ranges/pic.jpg',
|
||
|
|
'picture_alt' => 'Alt text',
|
||
|
|
'picture_title' => 'Title text',
|
||
|
|
'order' => 2,
|
||
|
|
'status' => true,
|
||
|
|
]);
|
||
|
|
});
|
||
|
|
});
|