Skip to content

Commit 2b6134a

Browse files
committed
Improving test coverage
1 parent 5023e80 commit 2b6134a

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

tests/TDBMAbstractServiceTest.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -421,8 +421,10 @@ private static function initSchema(Connection $connection): void
421421
$connection->exec('CREATE TABLE `players` (
422422
`id` INT UNSIGNED AUTO_INCREMENT NOT NULL,
423423
`player_and_games` JSON NOT NULL,
424-
`names_virtual` VARCHAR(20) GENERATED ALWAYS AS (`player_and_games` ->> \'$.name\') NOT NULL COMMENT \'@Generated\',
425-
PRIMARY KEY (`id`)
424+
`names_virtual` VARCHAR(20) GENERATED ALWAYS AS (`player_and_games` ->> \'$.name\') NOT NULL COMMENT \'@Generated\',
425+
`animal_id` INT COMMENT \'@Generated\',
426+
PRIMARY KEY (`id`),
427+
FOREIGN KEY (animal_id) REFERENCES animal(id)
426428
);
427429
');
428430
}

tests/TDBMDaoGeneratorTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@
9292
use TheCodingMachine\TDBM\Utils\PathFinder\PathFinder;
9393
use TheCodingMachine\TDBM\Utils\TDBMDaoGenerator;
9494
use Symfony\Component\Process\Process;
95+
use function get_class;
9596

9697
class TDBMDaoGeneratorTest extends TDBMAbstractServiceTest
9798
{
@@ -2282,7 +2283,7 @@ public function testFindFromRawSQLOnInheritance(): void
22822283

22832284
public function testGeneratedColumnsAreNotPartOfTheConstructor(): void
22842285
{
2285-
if ($this->tdbmService->getConnection()->getDatabasePlatform() instanceof MySqlPlatform && !self::isMariaDb($this->tdbmService->getConnection())) {
2286+
if (!$this->tdbmService->getConnection()->getDatabasePlatform() instanceof MySqlPlatform || self::isMariaDb($this->tdbmService->getConnection())) {
22862287
$this->markTestSkipped('ReadOnly column is only tested with MySQL');
22872288
}
22882289

@@ -2318,7 +2319,7 @@ public function testGeneratedColumnsAreNotPartOfTheConstructor(): void
23182319

23192320
public function testCanReadVirtualColumn(): void
23202321
{
2321-
if ($this->tdbmService->getConnection()->getDatabasePlatform() instanceof MySqlPlatform && !self::isMariaDb($this->tdbmService->getConnection())) {
2322+
if (!$this->tdbmService->getConnection()->getDatabasePlatform() instanceof MySqlPlatform || self::isMariaDb($this->tdbmService->getConnection())) {
23222323
$this->markTestSkipped('ReadOnly column is only tested with MySQL');
23232324
}
23242325

0 commit comments

Comments
 (0)