-
Notifications
You must be signed in to change notification settings - Fork 55
Add test for querying on related $id #738
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughAdds a new end-to-end test method that creates collections and relationships (MANY_TO_ONE, ONE_TO_ONE, MANY_TO_MANY), seeds documents, validates queries by related document IDs in both directions (including multi-ID filters), and cleans up test collections. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Test as Test Runner
participant S as Scope/Adapter
participant DB as Storage
rect rgb(240,248,255)
note over Test,S: Setup collections & relationships
Test->>S: create collections & define M2O/O2O/M2M
S->>DB: persist schemas
DB-->>S: schema IDs
Test->>S: insert sample documents
S->>DB: persist documents
DB-->>S: return document IDs
end
rect rgb(245,255,240)
note over Test,S: Relationship-ID queries
Test->>S: query parent by childId (M2O/O2O)
S->>DB: filter parent.relField == childId
DB-->>S: parent results
Test->>S: query child by parentId (inverse)
S->>DB: filter child.relField == parentId
DB-->>S: child results
Test->>S: multi-ID (IN) queries
S->>DB: apply IN filters on relationship fields
DB-->>S: matched documents
Note over S,DB: Repeat analogous steps for MANY_TO_MANY (joins/lookup)
end
rect rgb(255,248,240)
note over Test,S: Cleanup
Test->>S: drop test collections
S->>DB: delete schemas & data
DB-->>S: cleanup complete
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used🧬 Code graph analysis (1)tests/e2e/Adapter/Scopes/RelationshipTests.php (6)
🪛 PHPMD (2.15.0)tests/e2e/Adapter/Scopes/RelationshipTests.php3284-3284: Avoid unused local variables such as '$user1'. (undefined) (UnusedLocalVariable) 3293-3293: Avoid unused local variables such as '$user2'. (undefined) (UnusedLocalVariable) 3381-3381: Avoid unused local variables such as '$userOto1'. (undefined) (UnusedLocalVariable) 3434-3434: Avoid unused local variables such as '$dev1'. (undefined) (UnusedLocalVariable) 3443-3443: Avoid unused local variables such as '$dev2'. (undefined) (UnusedLocalVariable) ⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (11)
🔇 Additional comments (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
tests/e2e/Adapter/Scopes/RelationshipTests.php(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
tests/e2e/Adapter/Scopes/RelationshipTests.php (6)
src/Database/Database.php (4)
getAdapter(1199-1202)Database(37-8134)createRelationship(2656-2833)find(6695-6826)src/Database/Adapter.php (3)
getSupportForRelationships(992-992)createRelationship(615-615)find(802-802)src/Database/Adapter/Pool.php (3)
getSupportForRelationships(378-381)createRelationship(193-196)find(263-266)src/Database/Helpers/Permission.php (3)
Permission(9-264)read(186-195)update(220-229)src/Database/Helpers/Role.php (2)
Role(5-178)any(159-162)src/Database/Query.php (2)
Query(8-1116)equal(435-438)
🪛 PHPMD (2.15.0)
tests/e2e/Adapter/Scopes/RelationshipTests.php
3284-3284: Avoid unused local variables such as '$user1'. (undefined)
(UnusedLocalVariable)
3293-3293: Avoid unused local variables such as '$user2'. (undefined)
(UnusedLocalVariable)
3381-3381: Avoid unused local variables such as '$userOto1'. (undefined)
(UnusedLocalVariable)
3434-3434: Avoid unused local variables such as '$dev1'. (undefined)
(UnusedLocalVariable)
3443-3443: Avoid unused local variables such as '$dev2'. (undefined)
(UnusedLocalVariable)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Setup & Build Docker Image
| $user1 = $database->createDocument('usersRelId', new Document([ | ||
| '$id' => 'user1', | ||
| '$permissions' => [ | ||
| Permission::read(Role::any()), | ||
| Permission::update(Role::any()), | ||
| ], | ||
| 'name' => 'Alice', | ||
| ])); | ||
|
|
||
| $user2 = $database->createDocument('usersRelId', new Document([ | ||
| '$id' => 'user2', | ||
| '$permissions' => [ | ||
| Permission::read(Role::any()), | ||
| Permission::update(Role::any()), | ||
| ], | ||
| 'name' => 'Bob', | ||
| ])); | ||
|
|
||
| // Create posts related to users | ||
| $database->createDocument('postsRelId', new Document([ | ||
| '$id' => 'post1', | ||
| '$permissions' => [ | ||
| Permission::read(Role::any()), | ||
| Permission::update(Role::any()), | ||
| ], | ||
| 'title' => 'Alice Post 1', | ||
| 'user' => 'user1', | ||
| ])); | ||
|
|
||
| $database->createDocument('postsRelId', new Document([ | ||
| '$id' => 'post2', | ||
| '$permissions' => [ | ||
| Permission::read(Role::any()), | ||
| Permission::update(Role::any()), | ||
| ], | ||
| 'title' => 'Alice Post 2', | ||
| 'user' => 'user1', | ||
| ])); | ||
|
|
||
| $database->createDocument('postsRelId', new Document([ | ||
| '$id' => 'post3', | ||
| '$permissions' => [ | ||
| Permission::read(Role::any()), | ||
| Permission::update(Role::any()), | ||
| ], | ||
| 'title' => 'Bob Post', | ||
| 'user' => 'user2', | ||
| ])); | ||
|
|
||
| // Query posts by user.$id - this is the key test | ||
| $posts = $database->find('postsRelId', [ | ||
| Query::equal('user.$id', ['user1']), | ||
| ]); | ||
| $this->assertCount(2, $posts); | ||
| $this->assertEquals('post1', $posts[0]->getId()); | ||
| $this->assertEquals('post2', $posts[1]->getId()); | ||
|
|
||
| // Query posts by different user.$id | ||
| $posts = $database->find('postsRelId', [ | ||
| Query::equal('user.$id', ['user2']), | ||
| ]); | ||
| $this->assertCount(1, $posts); | ||
| $this->assertEquals('post3', $posts[0]->getId()); | ||
|
|
||
| // Query posts by multiple user.$id values | ||
| $posts = $database->find('postsRelId', [ | ||
| Query::equal('user.$id', ['user1', 'user2']), | ||
| ]); | ||
| $this->assertCount(3, $posts); | ||
|
|
||
| // Query users by posts.$id (inverse direction) | ||
| $users = $database->find('usersRelId', [ | ||
| Query::equal('posts.$id', ['post1']), | ||
| ]); | ||
| $this->assertCount(1, $users); | ||
| $this->assertEquals('user1', $users[0]->getId()); | ||
|
|
||
| // Clean up MANY_TO_ONE test | ||
| $database->deleteCollection('usersRelId'); | ||
| $database->deleteCollection('postsRelId'); | ||
|
|
||
| // Test ONE_TO_ONE relationship - query profile by user.$id | ||
| $database->createCollection('usersOtoId'); | ||
| $database->createCollection('profilesOtoId'); | ||
|
|
||
| $database->createAttribute('usersOtoId', 'username', Database::VAR_STRING, 255, true); | ||
| $database->createAttribute('profilesOtoId', 'bio', Database::VAR_STRING, 255, true); | ||
|
|
||
| $database->createRelationship( | ||
| collection: 'usersOtoId', | ||
| relatedCollection: 'profilesOtoId', | ||
| type: Database::RELATION_ONE_TO_ONE, | ||
| twoWay: true, | ||
| id: 'profile', | ||
| twoWayKey: 'user' | ||
| ); | ||
|
|
||
| $userOto1 = $database->createDocument('usersOtoId', new Document([ | ||
| '$id' => 'userOto1', | ||
| '$permissions' => [ | ||
| Permission::read(Role::any()), | ||
| Permission::update(Role::any()), | ||
| ], | ||
| 'username' => 'alice', | ||
| ])); | ||
|
|
||
| $database->createDocument('profilesOtoId', new Document([ | ||
| '$id' => 'profileOto1', | ||
| '$permissions' => [ | ||
| Permission::read(Role::any()), | ||
| Permission::update(Role::any()), | ||
| ], | ||
| 'bio' => 'Software Engineer', | ||
| 'user' => 'userOto1', | ||
| ])); | ||
|
|
||
| // Query profiles by user.$id | ||
| $profiles = $database->find('profilesOtoId', [ | ||
| Query::equal('user.$id', ['userOto1']), | ||
| ]); | ||
| $this->assertCount(1, $profiles); | ||
| $this->assertEquals('profileOto1', $profiles[0]->getId()); | ||
|
|
||
| // Query users by profile.$id (inverse) | ||
| $users = $database->find('usersOtoId', [ | ||
| Query::equal('profile.$id', ['profileOto1']), | ||
| ]); | ||
| $this->assertCount(1, $users); | ||
| $this->assertEquals('userOto1', $users[0]->getId()); | ||
|
|
||
| // Clean up ONE_TO_ONE test | ||
| $database->deleteCollection('usersOtoId'); | ||
| $database->deleteCollection('profilesOtoId'); | ||
|
|
||
| // Test MANY_TO_MANY relationship - query projects by developer.$id | ||
| $database->createCollection('developersMtmId'); | ||
| $database->createCollection('projectsMtmId'); | ||
|
|
||
| $database->createAttribute('developersMtmId', 'devName', Database::VAR_STRING, 255, true); | ||
| $database->createAttribute('projectsMtmId', 'projectName', Database::VAR_STRING, 255, true); | ||
|
|
||
| $database->createRelationship( | ||
| collection: 'developersMtmId', | ||
| relatedCollection: 'projectsMtmId', | ||
| type: Database::RELATION_MANY_TO_MANY, | ||
| twoWay: true, | ||
| id: 'projects', | ||
| twoWayKey: 'developers' | ||
| ); | ||
|
|
||
| $dev1 = $database->createDocument('developersMtmId', new Document([ | ||
| '$id' => 'dev1', | ||
| '$permissions' => [ | ||
| Permission::read(Role::any()), | ||
| Permission::update(Role::any()), | ||
| ], | ||
| 'devName' => 'Alice', | ||
| ])); | ||
|
|
||
| $dev2 = $database->createDocument('developersMtmId', new Document([ | ||
| '$id' => 'dev2', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion | 🟠 Major
Remove unused document variables to satisfy PHPMD
$user1, $user2, $userOto1, $dev1, and $dev2 are assigned but never read, which triggers PHPMD’s UnusedLocalVariable rule (see static-analysis hint). Dropping the assignments keeps the setup unchanged while clearing the warning.
- $user1 = $database->createDocument('usersRelId', new Document([
+ $database->createDocument('usersRelId', new Document([
@@
- $user2 = $database->createDocument('usersRelId', new Document([
+ $database->createDocument('usersRelId', new Document([
@@
- $userOto1 = $database->createDocument('usersOtoId', new Document([
+ $database->createDocument('usersOtoId', new Document([
@@
- $dev1 = $database->createDocument('developersMtmId', new Document([
+ $database->createDocument('developersMtmId', new Document([
@@
- $dev2 = $database->createDocument('developersMtmId', new Document([
+ $database->createDocument('developersMtmId', new Document([📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| $user1 = $database->createDocument('usersRelId', new Document([ | |
| '$id' => 'user1', | |
| '$permissions' => [ | |
| Permission::read(Role::any()), | |
| Permission::update(Role::any()), | |
| ], | |
| 'name' => 'Alice', | |
| ])); | |
| $user2 = $database->createDocument('usersRelId', new Document([ | |
| '$id' => 'user2', | |
| '$permissions' => [ | |
| Permission::read(Role::any()), | |
| Permission::update(Role::any()), | |
| ], | |
| 'name' => 'Bob', | |
| ])); | |
| // Create posts related to users | |
| $database->createDocument('postsRelId', new Document([ | |
| '$id' => 'post1', | |
| '$permissions' => [ | |
| Permission::read(Role::any()), | |
| Permission::update(Role::any()), | |
| ], | |
| 'title' => 'Alice Post 1', | |
| 'user' => 'user1', | |
| ])); | |
| $database->createDocument('postsRelId', new Document([ | |
| '$id' => 'post2', | |
| '$permissions' => [ | |
| Permission::read(Role::any()), | |
| Permission::update(Role::any()), | |
| ], | |
| 'title' => 'Alice Post 2', | |
| 'user' => 'user1', | |
| ])); | |
| $database->createDocument('postsRelId', new Document([ | |
| '$id' => 'post3', | |
| '$permissions' => [ | |
| Permission::read(Role::any()), | |
| Permission::update(Role::any()), | |
| ], | |
| 'title' => 'Bob Post', | |
| 'user' => 'user2', | |
| ])); | |
| // Query posts by user.$id - this is the key test | |
| $posts = $database->find('postsRelId', [ | |
| Query::equal('user.$id', ['user1']), | |
| ]); | |
| $this->assertCount(2, $posts); | |
| $this->assertEquals('post1', $posts[0]->getId()); | |
| $this->assertEquals('post2', $posts[1]->getId()); | |
| // Query posts by different user.$id | |
| $posts = $database->find('postsRelId', [ | |
| Query::equal('user.$id', ['user2']), | |
| ]); | |
| $this->assertCount(1, $posts); | |
| $this->assertEquals('post3', $posts[0]->getId()); | |
| // Query posts by multiple user.$id values | |
| $posts = $database->find('postsRelId', [ | |
| Query::equal('user.$id', ['user1', 'user2']), | |
| ]); | |
| $this->assertCount(3, $posts); | |
| // Query users by posts.$id (inverse direction) | |
| $users = $database->find('usersRelId', [ | |
| Query::equal('posts.$id', ['post1']), | |
| ]); | |
| $this->assertCount(1, $users); | |
| $this->assertEquals('user1', $users[0]->getId()); | |
| // Clean up MANY_TO_ONE test | |
| $database->deleteCollection('usersRelId'); | |
| $database->deleteCollection('postsRelId'); | |
| // Test ONE_TO_ONE relationship - query profile by user.$id | |
| $database->createCollection('usersOtoId'); | |
| $database->createCollection('profilesOtoId'); | |
| $database->createAttribute('usersOtoId', 'username', Database::VAR_STRING, 255, true); | |
| $database->createAttribute('profilesOtoId', 'bio', Database::VAR_STRING, 255, true); | |
| $database->createRelationship( | |
| collection: 'usersOtoId', | |
| relatedCollection: 'profilesOtoId', | |
| type: Database::RELATION_ONE_TO_ONE, | |
| twoWay: true, | |
| id: 'profile', | |
| twoWayKey: 'user' | |
| ); | |
| $userOto1 = $database->createDocument('usersOtoId', new Document([ | |
| '$id' => 'userOto1', | |
| '$permissions' => [ | |
| Permission::read(Role::any()), | |
| Permission::update(Role::any()), | |
| ], | |
| 'username' => 'alice', | |
| ])); | |
| $database->createDocument('profilesOtoId', new Document([ | |
| '$id' => 'profileOto1', | |
| '$permissions' => [ | |
| Permission::read(Role::any()), | |
| Permission::update(Role::any()), | |
| ], | |
| 'bio' => 'Software Engineer', | |
| 'user' => 'userOto1', | |
| ])); | |
| // Query profiles by user.$id | |
| $profiles = $database->find('profilesOtoId', [ | |
| Query::equal('user.$id', ['userOto1']), | |
| ]); | |
| $this->assertCount(1, $profiles); | |
| $this->assertEquals('profileOto1', $profiles[0]->getId()); | |
| // Query users by profile.$id (inverse) | |
| $users = $database->find('usersOtoId', [ | |
| Query::equal('profile.$id', ['profileOto1']), | |
| ]); | |
| $this->assertCount(1, $users); | |
| $this->assertEquals('userOto1', $users[0]->getId()); | |
| // Clean up ONE_TO_ONE test | |
| $database->deleteCollection('usersOtoId'); | |
| $database->deleteCollection('profilesOtoId'); | |
| // Test MANY_TO_MANY relationship - query projects by developer.$id | |
| $database->createCollection('developersMtmId'); | |
| $database->createCollection('projectsMtmId'); | |
| $database->createAttribute('developersMtmId', 'devName', Database::VAR_STRING, 255, true); | |
| $database->createAttribute('projectsMtmId', 'projectName', Database::VAR_STRING, 255, true); | |
| $database->createRelationship( | |
| collection: 'developersMtmId', | |
| relatedCollection: 'projectsMtmId', | |
| type: Database::RELATION_MANY_TO_MANY, | |
| twoWay: true, | |
| id: 'projects', | |
| twoWayKey: 'developers' | |
| ); | |
| $dev1 = $database->createDocument('developersMtmId', new Document([ | |
| '$id' => 'dev1', | |
| '$permissions' => [ | |
| Permission::read(Role::any()), | |
| Permission::update(Role::any()), | |
| ], | |
| 'devName' => 'Alice', | |
| ])); | |
| $dev2 = $database->createDocument('developersMtmId', new Document([ | |
| '$id' => 'dev2', | |
| $database->createDocument('usersRelId', new Document([ | |
| '$id' => 'user1', | |
| '$permissions' => [ | |
| Permission::read(Role::any()), | |
| Permission::update(Role::any()), | |
| ], | |
| 'name' => 'Alice', | |
| ])); | |
| $database->createDocument('usersRelId', new Document([ | |
| '$id' => 'user2', | |
| '$permissions' => [ | |
| Permission::read(Role::any()), | |
| Permission::update(Role::any()), | |
| ], | |
| 'name' => 'Bob', | |
| ])); | |
| // Create posts related to users | |
| $database->createDocument('postsRelId', new Document([ | |
| '$id' => 'post1', | |
| '$permissions' => [ | |
| Permission::read(Role::any()), | |
| Permission::update(Role::any()), | |
| ], | |
| 'title' => 'Alice Post 1', | |
| 'user' => 'user1', | |
| ])); | |
| $database->createDocument('postsRelId', new Document([ | |
| '$id' => 'post2', | |
| '$permissions' => [ | |
| Permission::read(Role::any()), | |
| Permission::update(Role::any()), | |
| ], | |
| 'title' => 'Alice Post 2', | |
| 'user' => 'user1', | |
| ])); | |
| $database->createDocument('postsRelId', new Document([ | |
| '$id' => 'post3', | |
| '$permissions' => [ | |
| Permission::read(Role::any()), | |
| Permission::update(Role::any()), | |
| ], | |
| 'title' => 'Bob Post', | |
| 'user' => 'user2', | |
| ])); | |
| // Query posts by user.$id - this is the key test | |
| $posts = $database->find('postsRelId', [ | |
| Query::equal('user.$id', ['user1']), | |
| ]); | |
| $this->assertCount(2, $posts); | |
| $this->assertEquals('post1', $posts[0]->getId()); | |
| $this->assertEquals('post2', $posts[1]->getId()); | |
| // Query posts by different user.$id | |
| $posts = $database->find('postsRelId', [ | |
| Query::equal('user.$id', ['user2']), | |
| ]); | |
| $this->assertCount(1, $posts); | |
| $this->assertEquals('post3', $posts[0]->getId()); | |
| // Query posts by multiple user.$id values | |
| $posts = $database->find('postsRelId', [ | |
| Query::equal('user.$id', ['user1', 'user2']), | |
| ]); | |
| $this->assertCount(3, $posts); | |
| // Query users by posts.$id (inverse direction) | |
| $users = $database->find('usersRelId', [ | |
| Query::equal('posts.$id', ['post1']), | |
| ]); | |
| $this->assertCount(1, $users); | |
| $this->assertEquals('user1', $users[0]->getId()); | |
| // Clean up MANY_TO_ONE test | |
| $database->deleteCollection('usersRelId'); | |
| $database->deleteCollection('postsRelId'); | |
| // Test ONE_TO_ONE relationship - query profile by user.$id | |
| $database->createCollection('usersOtoId'); | |
| $database->createCollection('profilesOtoId'); | |
| $database->createAttribute('usersOtoId', 'username', Database::VAR_STRING, 255, true); | |
| $database->createAttribute('profilesOtoId', 'bio', Database::VAR_STRING, 255, true); | |
| $database->createRelationship( | |
| collection: 'usersOtoId', | |
| relatedCollection: 'profilesOtoId', | |
| type: Database::RELATION_ONE_TO_ONE, | |
| twoWay: true, | |
| id: 'profile', | |
| twoWayKey: 'user' | |
| ); | |
| $database->createDocument('usersOtoId', new Document([ | |
| '$id' => 'userOto1', | |
| '$permissions' => [ | |
| Permission::read(Role::any()), | |
| Permission::update(Role::any()), | |
| ], | |
| 'username' => 'alice', | |
| ])); | |
| $database->createDocument('profilesOtoId', new Document([ | |
| '$id' => 'profileOto1', | |
| '$permissions' => [ | |
| Permission::read(Role::any()), | |
| Permission::update(Role::any()), | |
| ], | |
| 'bio' => 'Software Engineer', | |
| 'user' => 'userOto1', | |
| ])); | |
| // Query profiles by user.$id | |
| $profiles = $database->find('profilesOtoId', [ | |
| Query::equal('user.$id', ['userOto1']), | |
| ]); | |
| $this->assertCount(1, $profiles); | |
| $this->assertEquals('profileOto1', $profiles[0]->getId()); | |
| // Query users by profile.$id (inverse) | |
| $users = $database->find('usersOtoId', [ | |
| Query::equal('profile.$id', ['profileOto1']), | |
| ]); | |
| $this->assertCount(1, $users); | |
| $this->assertEquals('userOto1', $users[0]->getId()); | |
| // Clean up ONE_TO_ONE test | |
| $database->deleteCollection('usersOtoId'); | |
| $database->deleteCollection('profilesOtoId'); | |
| // Test MANY_TO_MANY relationship - query projects by developer.$id | |
| $database->createCollection('developersMtmId'); | |
| $database->createCollection('projectsMtmId'); | |
| $database->createAttribute('developersMtmId', 'devName', Database::VAR_STRING, 255, true); | |
| $database->createAttribute('projectsMtmId', 'projectName', Database::VAR_STRING, 255, true); | |
| $database->createRelationship( | |
| collection: 'developersMtmId', | |
| relatedCollection: 'projectsMtmId', | |
| type: Database::RELATION_MANY_TO_MANY, | |
| twoWay: true, | |
| id: 'projects', | |
| twoWayKey: 'developers' | |
| ); | |
| $database->createDocument('developersMtmId', new Document([ | |
| '$id' => 'dev1', | |
| '$permissions' => [ | |
| Permission::read(Role::any()), | |
| Permission::update(Role::any()), | |
| ], | |
| 'devName' => 'Alice', | |
| ])); | |
| $database->createDocument('developersMtmId', new Document([ | |
| '$id' => 'dev2', |
🧰 Tools
🪛 PHPMD (2.15.0)
3284-3284: Avoid unused local variables such as '$user1'. (undefined)
(UnusedLocalVariable)
3293-3293: Avoid unused local variables such as '$user2'. (undefined)
(UnusedLocalVariable)
3381-3381: Avoid unused local variables such as '$userOto1'. (undefined)
(UnusedLocalVariable)
3434-3434: Avoid unused local variables such as '$dev1'. (undefined)
(UnusedLocalVariable)
3443-3443: Avoid unused local variables such as '$dev2'. (undefined)
(UnusedLocalVariable)
🤖 Prompt for AI Agents
In tests/e2e/Adapter/Scopes/RelationshipTests.php around lines 3284 to 3444,
several Document creations assign their return values to unused local variables
($user1, $user2, $userOto1, $dev1, $dev2) which tripped PHPMD’s
UnusedLocalVariable rule; remove the unused assignments by calling
$database->createDocument(...) without assigning its result for those entries
(leave other variables that are actually used unchanged) so the setup behavior
is identical but the unused-variable warnings are eliminated.
Summary by CodeRabbit