picture = 'storage/modelfiles/slides/existing.jpg'; $title = 'Slide Modifié'; // WHEN $input = new UpdateSlideInput( slide: $slide, title: $title, ); // THEN expect($input->slide)->toBe($slide) ->and($input->title)->toBe($title) ->and($input->picture)->toBeNull(); }); it('creates a valid UpdateSlideInput instance with new text', function (): void { // GIVEN $slide = new Slide(); $title = 'Slide Modifié Texte'; $text = '
Nouveau texte
'; // WHEN $input = new UpdateSlideInput( slide: $slide, title: $title, text: $text, ); // THEN expect($input->slide)->toBe($slide) ->and($input->title)->toBe($title) ->and($input->text)->toBe($text); }); it('throws when title is empty', function (): void { // GIVEN $slide = new Slide(); // WHEN expect(fn () => new UpdateSlideInput(slide: $slide, title: ' ', text: 'Texte')) // THEN ->toThrow(\InvalidArgumentException::class); }); it('throws when neither new nor existing picture nor text exists', function (): void { // GIVEN $slide = new Slide(); // WHEN expect(fn () => new UpdateSlideInput(slide: $slide, title: 'Slide')) // THEN ->toThrow(\InvalidArgumentException::class, 'A slide must have either a picture or text.'); }); });