Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
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 | |
| 8 | declare(strict_types=1); |
| 9 | |
| 10 | use AppDemo\Library\Infrastructure\SqliteBookRepository; |
| 11 | use AppDemo\Loan\Infrastructure\SqliteLoanRepository; |
| 12 | use AppDemo\User\Infrastructure\SqliteUserRepository; |
| 13 | use Phexium\Plugin\IdGenerator\Adapter\TimestampIdGenerator; |
| 14 | use Phexium\Plugin\SqlDriver\Adapter\SqliteDriver; |
| 15 | use Tests\Phexium\Integration\Support\PdoRegistry; |
| 16 | |
| 17 | // @codeCoverageIgnoreStart |
| 18 | require_once __DIR__.'/BaseLoanRepositoryTests.php'; |
| 19 | registerBaseLoanRepositoryTests(); |
| 20 | |
| 21 | $dbName = null; |
| 22 | beforeAll(function () use (&$dbName): void { |
| 23 | $dbName = PdoRegistry::initializeSqlite(true); |
| 24 | }); |
| 25 | afterAll(function (): void { |
| 26 | PdoRegistry::cleanupSqlite(); |
| 27 | }); |
| 28 | // @codeCoverageIgnoreEnd |
| 29 | |
| 30 | beforeEach(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 | |
| 40 | afterEach(function (): void { |
| 41 | PdoRegistry::getConnection()->rollBack(); |
| 42 | }); |