Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
15 / 15
100.00% covered (success)
100.00%
3 / 3
CRAP
100.00% covered (success)
100.00%
1 / 1
BookMother
100.00% covered (success)
100.00%
15 / 15
100.00% covered (success)
100.00%
3 / 3
3
100.00% covered (success)
100.00%
1 / 1
 available
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
1 / 1
1
 borrowed
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
1 / 1
1
 create
100.00% covered (success)
100.00%
7 / 7
100.00% covered (success)
100.00%
1 / 1
1
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
10namespace Tests\AppDemo\Fixture;
11
12use AppDemo\Library\Domain\Author;
13use AppDemo\Library\Domain\Book;
14use AppDemo\Library\Domain\BookStatus;
15use AppDemo\Library\Domain\ISBN;
16use AppDemo\Library\Domain\Title;
17use Phexium\Domain\Id\TimestampId;
18
19final class BookMother
20{
21    public static function available(int $id = 1): Book
22    {
23        return self::create(
24            id: $id,
25            status: BookStatus::Available
26        );
27    }
28
29    public static function borrowed(int $id = 1): Book
30    {
31        return self::create(
32            id: $id,
33            status: BookStatus::Borrowed
34        );
35    }
36
37    public static function create(
38        int $id = 1,
39        string $title = 'Clean Code',
40        string $author = 'Robert C. Martin',
41        string $isbn = '9780134494166',
42        BookStatus $status = BookStatus::Available
43    ): Book {
44        return new Book(
45            new TimestampId($id),
46            Title::fromString($title),
47            Author::fromString($author),
48            ISBN::fromString($isbn),
49            $status
50        );
51    }
52}