diff --git a/tests/NestedSetsBehaviorTest.php b/tests/NestedSetsBehaviorTest.php index ae2ce2c..4cb97ac 100644 --- a/tests/NestedSetsBehaviorTest.php +++ b/tests/NestedSetsBehaviorTest.php @@ -2206,4 +2206,41 @@ public function testProtectedShiftLeftRightAttributeRemainsAccessibleToSubclasse '\'shiftLeftRightAttribute\' method should remain protected to allow subclass customization.', ); } + + public function testProtectedMoveNodeRemainsAccessibleToSubclasses(): void + { + $this->createDatabase(); + + $sourceNode = new ExtendableMultipleTree( + [ + 'name' => 'Source Node', + 'tree' => 4, + ], + ); + + $sourceNode->makeRoot(); + + $targetNode = new ExtendableMultipleTree( + [ + 'name' => 'Target Node', + 'tree' => 4, + ], + ); + + $targetNode->appendTo($sourceNode); + $sourceBehavior = $sourceNode->getBehavior('nestedSetsBehavior'); + + self::assertInstanceOf( + ExtendableNestedSetsBehavior::class, + $sourceBehavior, + '\'ExtendableMultipleTree\' should use \'ExtendableNestedSetsBehavior\'.', + ); + + $sourceBehavior->exposedMoveNode($targetNode, 5, 2); + + self::assertTrue( + $sourceBehavior->wasMethodCalled('moveNode'), + '\'moveNode\' method should remain protected to allow subclass customization.', + ); + } }