Skip to content

Commit a9e9aef

Browse files
committed
test update
1 parent e137d1c commit a9e9aef

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

tests/tree.phpt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -212,17 +212,17 @@ require_once __DIR__ . '/setup.php';
212212
$parent = new Node(null, children: $children);
213213
Assert::same($children, $parent->children()); // sanity check
214214

215-
// Attempting to add the same node under an existing (albeit same) key without duplicate node handling mechanism
216-
// results in a ChildKeyCollision exception.
217-
Assert::throws(function () use ($parent, $node1) {
218-
Tree::link($node1, $parent, 'one', handleDuplicateLinking: false);
219-
}, ChildKeyCollision::class);
215+
// Attempting to add the same node under the same key without the duplicate node handling mechanism still has no effect.
216+
// Also, attempting to add the same node under a different key without the duplicate node handling mechanism
217+
// still results in a ChildKeyCollision exception.
218+
Tree::link($node1, $parent, 'one', handleDuplicateLinking: false);
219+
Assert::same($children, $parent->children());
220220
Assert::throws(function () use ($parent, $node1) {
221221
Tree::link($node1, $parent, 'two', handleDuplicateLinking: false);
222222
}, ChildKeyCollision::class);
223223

224224
// Without the duplicate node handling mechanism, this call will allow adding the node as a duplicate child,
225-
// possibly causing issues in the tree structure.
225+
// possibly causing issues in the tree structure, but improving performance of a large number of subsequent calls.
226226
Tree::link($node1, $parent, 'three', handleDuplicateLinking: false);
227227
Assert::same(['one' => $node1, 'two' => $node2, 'three' => $node1], $parent->children());
228228
})();

0 commit comments

Comments
 (0)