Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
20 / 20 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
||
| 1 | <?php |
| 2 | |
| 3 | // ╔════════════════════════════════════════════════════════════╗ |
| 4 | // ║ MIT Licence (#Expat) - https://opensource.org/licenses/MIT ║ |
| 5 | // ║ Copyright 2026 Frederic Poeydomenge <dyno@phexium.com> ║ |
| 6 | // ╚════════════════════════════════════════════════════════════╝ |
| 7 | |
| 8 | declare(strict_types=1); |
| 9 | |
| 10 | pest()->group('unit'); |
| 11 | |
| 12 | use Phexium\Plugin\Mailer\Header; |
| 13 | |
| 14 | describe('Creation', function (): void { |
| 15 | it('creates with name and value', function (): void { |
| 16 | $header = new Header('X-Custom', 'custom-value'); |
| 17 | |
| 18 | expect($header->name)->toBe('X-Custom'); |
| 19 | expect($header->value)->toBe('custom-value'); |
| 20 | }); |
| 21 | }); |
| 22 | |
| 23 | describe('Validation', function (): void { |
| 24 | it('rejects empty name', function (): void { |
| 25 | expect(fn (): Header => new Header('', 'value')) |
| 26 | ->toThrow(InvalidArgumentException::class) |
| 27 | ; |
| 28 | }); |
| 29 | |
| 30 | it('rejects empty value', function (): void { |
| 31 | expect(fn (): Header => new Header('X-Custom', '')) |
| 32 | ->toThrow(InvalidArgumentException::class) |
| 33 | ; |
| 34 | }); |
| 35 | }); |