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