shouldNotReceive('storeFileOntoDisk'); $action = new CreateSlide( $storage, new PublicS3Disk('https://cdn.test'), new ImageOptimizerService(new TemporaryFileFactory(), new NullLogger()), ); $start = new \DateTimeImmutable('2026-06-01 10:00:00'); $end = new \DateTimeImmutable('2026-06-30 20:00:00'); $period = new DatePeriod($start, $end); $input = new CreateSlideInput( title: 'Nouvelle Bannière', text: '

Contenu promo

', link: 'https://example.com/promo', linkLabel: 'En profiter', linkNewTab: true, connected: false, period: $period, ); // WHEN $slide = $action($input); // THEN expect($slide->id)->toBeGreaterThan(0) ->and($slide->title)->toBe('Nouvelle Bannière') ->and($slide->text)->toBe('

Contenu promo

') ->and($slide->link)->toBe('https://example.com/promo') ->and($slide->link_label)->toBe('En profiter') ->and($slide->link_new_tab)->toBeTrue() ->and($slide->connected)->toBeFalse(); $fresh = Slide::query()->find($slide->id); expect($fresh)->not->toBeNull() ->and($fresh?->title)->toBe('Nouvelle Bannière'); }); it('throws when an invalid input is passed', function (): void { // GIVEN $storage = \Mockery::mock(StorageService::class); $storage->shouldNotReceive('storeFileOntoDisk'); $action = new CreateSlide( $storage, new PublicS3Disk('https://cdn.test'), new ImageOptimizerService(new TemporaryFileFactory(), new NullLogger()), ); $invalidInput = new class () implements ActionInput { }; // WHEN expect( /** @phpstan-ignore argument.type */ fn () => $action($invalidInput) ) // THEN ->toThrow(\InvalidArgumentException::class); }); });