Skip to content

Commit 84ed291

Browse files
committed
add test
1 parent aa4355a commit 84ed291

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

tests/e2e/Adapter/Scopes/Relationships/OneToOneTests.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1041,6 +1041,20 @@ public function testIdenticalTwoWayKeyRelationship(): void
10411041
);
10421042
$this->assertTrue($result);
10431043

1044+
try {
1045+
$database->createRelationship(
1046+
collection: 'parent',
1047+
relatedCollection: 'child',
1048+
type: Database::RELATION_ONE_TO_MANY,
1049+
twoWay: true,
1050+
id: 'twoWayChildren',
1051+
twoWayKey: 'parent_id'
1052+
);
1053+
$this->fail('Failed to throw Exception');
1054+
} catch (Exception $e) {
1055+
$this->assertEquals('Related attribute already exists', $e->getMessage());
1056+
}
1057+
10441058
$collection = $database->getCollection('parent');
10451059
$attributes = $collection->getAttribute('attributes', []);
10461060
foreach ($attributes as $attribute) {

0 commit comments

Comments
 (0)