| Total Complexity | 6 |
| Total Lines | 33 |
| Duplicated Lines | 0 % |
| Changes | 26 | ||
| Bugs | 3 | Features | 1 |
| 1 | <?php |
||
| 11 | abstract class TestCase extends \PHPUnit\Framework\TestCase |
||
| 12 | { |
||
| 13 | abstract protected function createConnection(): ConnectionInterface; |
||
| 14 | |||
| 15 | protected function checkFixture(ConnectionInterface $db, string $tablename, bool $reset = false): void |
||
| 16 | { |
||
| 17 | $schema = $db->getSchema(); |
||
| 18 | $tableSchema = $schema->getTableSchema($tablename, true); |
||
| 19 | |||
| 20 | if ($tableSchema === null || $reset) { |
||
| 21 | DbHelper::loadFixture($db); |
||
| 22 | |||
| 23 | $schema->refresh(); |
||
| 24 | } |
||
| 25 | } |
||
| 26 | |||
| 27 | protected function db(): ConnectionInterface |
||
| 28 | { |
||
| 29 | return ConnectionProvider::get(); |
||
| 30 | } |
||
| 31 | |||
| 32 | protected function setUp(): void |
||
| 33 | { |
||
| 34 | parent::setUp(); |
||
| 35 | |||
| 36 | ConnectionProvider::set($this->createConnection()); |
||
| 37 | } |
||
| 38 | |||
| 39 | protected function tearDown(): void |
||
| 44 | } |
||
| 45 | } |
||
| 46 |