Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
10 / 10
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
10pest()->group('integration');
11
12use AppDemo\Library\Infrastructure\Mapper\BookMapper;
13use AppDemo\Library\Infrastructure\MysqlBookRepository;
14use Phexium\Plugin\IdGenerator\Adapter\TimestampIdGenerator;
15use Phexium\Plugin\SqlDriver\Adapter\MysqlDriver;
16use Tests\Phexium\Component\Support\PdoRegistry;
17
18// @codeCoverageIgnoreStart
19require __DIR__.'/BaseBookRepositoryTests.php';
20
21$dbName = null;
22beforeAll(function () use (&$dbName): void {
23    $dbName = PdoRegistry::initializeMysql(true);
24});
25afterAll(function () use (&$dbName): void {
26    PdoRegistry::cleanupMysql($dbName);
27});
28// @codeCoverageIgnoreEnd
29
30beforeEach(function (): void {
31    PdoRegistry::getConnection()->beginTransaction();
32    $driver = new MysqlDriver(PdoRegistry::getConnection());
33    $mapper = new BookMapper(new TimestampIdGenerator());
34    $this->repository = new MysqlBookRepository($driver, $mapper);
35});
36
37afterEach(function (): void {
38    PdoRegistry::getConnection()->rollBack();
39});