Skip to content

Commit 9ccb3e1

Browse files
abnegateclaude
andcommitted
fix: add remaining relationship guards, make Pool implement Features
- Guard 5 more test methods that use relationships on SQLite - Pool adapter now implements all Feature interfaces since it's a transparent proxy that delegates to the underlying adapter Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 25b1fe2 commit 9ccb3e1

3 files changed

Lines changed: 30 additions & 6 deletions

File tree

src/Database/Adapter/Pool.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,12 @@
2121

2222
/**
2323
* Connection pool adapter that delegates database operations to pooled adapter instances.
24+
*
25+
* Pool implements all Feature interfaces because it is a complete proxy — every method
26+
* call is delegated to the underlying pooled adapter. If the pooled adapter does not
27+
* actually support a feature, the delegated call will throw at runtime.
2428
*/
25-
class Pool extends Adapter
29+
class Pool extends Adapter implements Feature\ConnectionId, Feature\InternalCasting, Feature\Relationships, Feature\SchemaAttributes, Feature\Spatial, Feature\Timeouts, Feature\Upserts, Feature\UTCCasting
2630
{
2731
/**
2832
* @var UtopiaPool<covariant Adapter>

tests/e2e/Adapter/Scopes/PermissionTests.php

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,11 @@ protected function initCollectionUpdateFixture(): array
294294

295295
public function testCollectionPermissionsRelationships(): void
296296
{
297+
if (! ($this->getDatabase()->getAdapter() instanceof Feature\Relationships)) {
298+
$this->expectNotToPerformAssertions();
299+
return;
300+
}
301+
297302
/** @var Database $database */
298303
$database = $this->getDatabase();
299304

@@ -969,6 +974,11 @@ public function testCollectionPermissionsGetWorks(): void
969974

970975
public function testCollectionPermissionsRelationshipsCountWorks(): void
971976
{
977+
if (! ($this->getDatabase()->getAdapter() instanceof Feature\Relationships)) {
978+
$this->expectNotToPerformAssertions();
979+
return;
980+
}
981+
972982
$data = $this->initRelationshipPermissionFixture();
973983
$collectionId = $data['collectionId'];
974984

@@ -1138,6 +1148,11 @@ public function testCollectionPermissionsRelationshipsDeleteWorks(): void
11381148

11391149
public function testCollectionPermissionsRelationshipsFindWorks(): void
11401150
{
1151+
if (! ($this->getDatabase()->getAdapter() instanceof Feature\Relationships)) {
1152+
$this->expectNotToPerformAssertions();
1153+
return;
1154+
}
1155+
11411156
$data = $this->initRelationshipPermissionFixture();
11421157
$collectionId = $data['collectionId'];
11431158

@@ -1147,11 +1162,6 @@ public function testCollectionPermissionsRelationshipsFindWorks(): void
11471162
/** @var Database $database */
11481163
$database = $this->getDatabase();
11491164

1150-
if (!($database->getAdapter() instanceof Feature\Relationships)) {
1151-
$this->expectNotToPerformAssertions();
1152-
return;
1153-
}
1154-
11551165
$documents = $database->find(
11561166
$collectionId
11571167
);
@@ -1291,6 +1301,11 @@ public function testCollectionPermissionsRelationshipsUpdateThrowsException(): v
12911301

12921302
public function testCollectionPermissionsRelationshipsUpdateWorks(): void
12931303
{
1304+
if (! ($this->getDatabase()->getAdapter() instanceof Feature\Relationships)) {
1305+
$this->expectNotToPerformAssertions();
1306+
return;
1307+
}
1308+
12941309
$data = $this->initRelationshipPermissionFixture();
12951310
$collectionId = $data['collectionId'];
12961311
$docId = $data['docId'];

tests/e2e/Adapter/Scopes/RelationshipTests.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3611,6 +3611,11 @@ public function testCountAndSumWithRelationshipQueries(): void
36113611
*/
36123612
public function testOrderAndCursorWithRelationshipQueries(): void
36133613
{
3614+
if (! ($this->getDatabase()->getAdapter() instanceof Feature\Relationships)) {
3615+
$this->expectNotToPerformAssertions();
3616+
return;
3617+
}
3618+
36143619
/** @var Database $database */
36153620
$database = $this->getDatabase();
36163621

0 commit comments

Comments
 (0)