name)->toBe($name) ->and($input->address)->toBe($address) ->and($input->postcode)->toBe($postcode) ->and($input->city)->toBe($city) ->and($input->phone)->toBe($phone) ->and($input->coordinates)->toBe($coordinates) ->and($input->default)->toBeTrue(); }); test('it can be instantiated with null optional values', function () { // GIVEN & WHEN $input = new CreateShopInput( name: 'Boutique Lyon', address: '1 Place Bellecour', postcode: '69002', city: 'Lyon', phone: null, coordinates: null, default: false, ); // THEN expect($input->phone)->toBeNull() ->and($input->coordinates)->toBeNull() ->and($input->default)->toBeFalse(); }); test('it throws when name is empty', function () { // GIVEN & WHEN & THEN expect(fn () => new CreateShopInput( name: ' ', address: '1 rue de Paris', postcode: '75000', city: 'Paris', phone: null, coordinates: null, default: false, ))->toThrow(\InvalidArgumentException::class, 'Shop name cannot be empty.'); }); test('it throws when address is empty', function () { // GIVEN & WHEN & THEN expect(fn () => new CreateShopInput( name: 'Boutique', address: ' ', postcode: '75000', city: 'Paris', phone: null, coordinates: null, default: false, ))->toThrow(\InvalidArgumentException::class, 'Shop address cannot be empty.'); }); test('it throws when postcode is empty', function () { // GIVEN & WHEN & THEN expect(fn () => new CreateShopInput( name: 'Boutique', address: '1 rue de Paris', postcode: ' ', city: 'Paris', phone: null, coordinates: null, default: false, ))->toThrow(\InvalidArgumentException::class, 'Shop postcode cannot be empty.'); }); test('it throws when city is empty', function () { // GIVEN & WHEN & THEN expect(fn () => new CreateShopInput( name: 'Boutique', address: '1 rue de Paris', postcode: '75000', city: ' ', phone: null, coordinates: null, default: false, ))->toThrow(\InvalidArgumentException::class, 'Shop city cannot be empty.'); }); test('it throws when name exceeds 255 characters', function () { // GIVEN & WHEN & THEN expect(fn () => new CreateShopInput( name: str_repeat('a', 256), address: '1 rue de Paris', postcode: '75000', city: 'Paris', phone: null, coordinates: null, default: false, ))->toThrow(\InvalidArgumentException::class, 'Shop name cannot exceed 255 characters.'); }); });