55namespace yii2 \extensions \nestedsets \tests \mysql ;
66
77use PHPUnit \Framework \Attributes \Group ;
8+ use yii \db \Exception ;
89use yii2 \extensions \nestedsets \tests \support \DatabaseConnection ;
910use yii2 \extensions \nestedsets \tests \support \model \MultipleTree ;
1011use yii2 \extensions \nestedsets \tests \TestCase ;
1112
13+ /**
14+ * Test suite for mutation operations in nested sets tree behaviors using MySQL.
15+ *
16+ * Verifies correct handling of leaf node ordering and left attribute consistency in multiple tree models on MySQL.
17+ *
18+ * Ensures that the `leaves()` method returns nodes in the expected order after direct manipulation of left and right
19+ * attributes, maintaining data integrity and predictable query results.
20+ *
21+ * Key features.
22+ * - Ensures consistent results from the `leaves()` method.
23+ * - MySQL-specific configuration for database connection and credentials.
24+ * - Uses the multiple tree model for mutation scenarios.
25+ * - Validates leaf node detection and ordering after manual updates.
26+ *
27+ * @copyright Copyright (C) 2023 Terabytesoftw.
28+ * @license https://opensource.org/license/bsd-3-clause BSD 3-Clause License.
29+ */
1230#[Group('mutation ' )]
1331final class MutationTest extends TestCase
1432{
@@ -19,6 +37,9 @@ protected function setUp(): void
1937 parent ::setUp ();
2038 }
2139
40+ /**
41+ * @throws Exception if an unexpected error occurs during execution.
42+ */
2243 public function testLeavesMethodRequiresLeftAttributeOrderingForConsistentResults (): void
2344 {
2445 $ this ->createDatabase ();
@@ -51,7 +72,7 @@ public function testLeavesMethodRequiresLeftAttributeOrderingForConsistentResult
5172
5273 $ leaves = MultipleTree::find ()->leaves ()->all ();
5374
54- /** @phpstan-var array<array{name: string, lft: int}> */
75+ /** @phpstan-var array<array{name: string, lft: int}> $expectedLeaves */
5576 $ expectedLeaves = [
5677 ['name ' => 'Leaf B ' , 'lft ' => 3 ],
5778 ['name ' => 'Leaf A ' , 'lft ' => 5 ],
0 commit comments