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 | pest()->group('integration'); |
| 11 | |
| 12 | use AppDemo\User\Infrastructure\Mapper\UserMapper; |
| 13 | use AppDemo\User\Infrastructure\MysqlUserRepository; |
| 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__.'/BaseUserRepositoryTests.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 | $mapper = new UserMapper(new TimestampIdGenerator()); |
| 33 | $this->repository = new MysqlUserRepository( |
| 34 | new MysqlDriver(PdoRegistry::getConnection()), |
| 35 | $mapper |
| 36 | ); |
| 37 | }); |
| 38 | |
| 39 | afterEach(function (): void { |
| 40 | PdoRegistry::getConnection()->rollBack(); |
| 41 | }); |