Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
12 / 12
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
8declare(strict_types=1);
9
10use AppDemo\Loan\Domain\Exception\LoanNotOwnedByUserException;
11use Phexium\Domain\Id\TimestampId;
12
13it('throws exception with loan and user ID in message', function (): void {
14    $exception = LoanNotOwnedByUserException::forLoanAndUser(
15        TimestampId::from(123),
16        TimestampId::from(234)
17    );
18
19    expect($exception->getMessage())->toContain('ID 123')
20        ->and($exception->getMessage())->toContain('user 234')
21    ;
22
23    expect(fn () => throw $exception)
24        ->toThrow(LoanNotOwnedByUserException::class)
25    ;
26});