Skip to content

Commit 7799a19

Browse files
committed
fix: tests
1 parent 3844d74 commit 7799a19

File tree

2 files changed

+14
-11
lines changed

2 files changed

+14
-11
lines changed

tests/e2e/Adapter/Scopes/RelationshipTests.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -670,7 +670,7 @@ public function testVirtualRelationsAttributes(): void
670670
]));
671671
$this->fail('Failed to throw exception');
672672
} catch (Exception $e) {
673-
$this->assertTrue($e instanceof RelationshipException);
673+
$this->assertTrue($e instanceof RelationshipException || $e instanceof StructureException);
674674
}
675675

676676
try {
@@ -684,7 +684,7 @@ public function testVirtualRelationsAttributes(): void
684684
]));
685685
$this->fail('Failed to throw exception');
686686
} catch (Exception $e) {
687-
$this->assertTrue($e instanceof RelationshipException);
687+
$this->assertTrue($e instanceof RelationshipException || $e instanceof StructureException);
688688
}
689689

690690
try {

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

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1079,15 +1079,18 @@ public function testIdenticalTwoWayKeyRelationship(): void
10791079
$this->assertEquals('Relationship already exists', $e->getMessage());
10801080
}
10811081

1082-
try {
1083-
$database->updateRelationship(
1084-
collection: 'parent',
1085-
id: 'children',
1086-
newTwoWayKey: 'parent'
1087-
);
1088-
$this->fail('Failed to throw Exception');
1089-
} catch (Exception $e) {
1090-
$this->assertEquals('Related attribute already exists', $e->getMessage());
1082+
$database->updateRelationship(
1083+
collection: 'parent',
1084+
id: 'children',
1085+
newTwoWayKey: 'parent'
1086+
);
1087+
1088+
$collection = $database->getCollection('parent');
1089+
$attributes = $collection->getAttribute('attributes', []);
1090+
foreach ($attributes as $attribute) {
1091+
if ($attribute['key'] === 'children') {
1092+
$this->assertEquals(null, $attribute['options']['twoWayKey']);
1093+
}
10911094
}
10921095
}
10931096

0 commit comments

Comments
 (0)