Skip to content

Commit 3b06b5c

Browse files
committed
better conflict test
1 parent 58bdc11 commit 3b06b5c

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

tests/TDBMAbstractServiceTest.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ private static function initSchema(Connection $connection): void
416416

417417
$db->table('artists')
418418
->column('id')->integer()->primaryKey()->autoIncrement()
419-
->column('children')->array()->null()
419+
->column('children')->array()->null() //used to test conflicts with autopivot
420420
->column('name')->string();
421421

422422
$db->table('albums')
@@ -438,11 +438,15 @@ private static function initSchema(Connection $connection): void
438438
->column('track_id')->references('tracks')
439439
->column('artist_id')->references('artists')->comment('@JsonKey("feat") @JsonInclude');
440440

441-
$db->table('artists_relations')
441+
$db->table('artists_relations') //used to test the auto pivot case
442442
->column('id')->integer()->primaryKey()->autoIncrement()
443443
->column('parent_id')->references('artists')
444444
->column('child_id')->references('artists');
445445

446+
$db->table('children') //used to test conflicts with autopivot
447+
->column('id')->integer()->primaryKey()->autoIncrement()
448+
->column('artist_id')->references('artists');
449+
446450
$db->junctionTable('person', 'boats');
447451

448452
$db->table('base_objects')

tests/TDBMDaoGeneratorTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2164,8 +2164,9 @@ public function testLazyStopRecursionOnCompositeForeignKey(): void
21642164
public function testMethodNameConflictsBetweenRegularAndAutoPivotProperties()
21652165
{
21662166
$artist = new ArtistBean('Super');
2167-
$artist->getChildren();
2168-
$artist->getChildrenByArtistsRelations();
2167+
$artist->getChildren(); // regular property
2168+
$artist->getChildrenByArtistId(); // one-to-may relationship
2169+
$artist->getChildrenByArtistsRelations(); // auto-pivot relationship
21692170
$this->assertEquals(1, 1);
21702171
}
21712172
}

0 commit comments

Comments
 (0)