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\Library\Infrastructure\SqliteBookRepository;
11use AppDemo\Loan\Infrastructure\SqliteLoanRepository;
12use AppDemo\User\Infrastructure\SqliteUserRepository;
13use Phexium\Plugin\IdGenerator\Adapter\TimestampIdGenerator;
14use Phexium\Plugin\SqlDriver\Adapter\SqliteDriver;
15use Tests\Phexium\Integration\Support\PdoRegistry;
16
17// @codeCoverageIgnoreStart
18require_once __DIR__.'/BaseLoanRepositoryTests.php';
19registerBaseLoanRepositoryTests();
20
21$dbName = null;
22beforeAll(function () use (&$dbName): void {
23    $dbName = PdoRegistry::initializeSqlite(true);
24});
25afterAll(function (): void {
26    PdoRegistry::cleanupSqlite();
27});
28// @codeCoverageIgnoreEnd
29
30beforeEach(function (): void {
31    PdoRegistry::getConnection()->beginTransaction();
32    $pdo = PdoRegistry::getConnection();
33    $idGenerator = new TimestampIdGenerator();
34    $driver = new SqliteDriver($pdo);
35    $this->bookRepository = new SqliteBookRepository($driver, $idGenerator);
36    $this->userRepository = new SqliteUserRepository($driver, $idGenerator);
37    $this->repository = new SqliteLoanRepository($driver, $pdo, $idGenerator);
38});
39
40afterEach(function (): void {
41    PdoRegistry::getConnection()->rollBack();
42});