|
@@ 412-420 (lines=9) @@
|
| 409 |
|
$this->assertDataSetsEqual($expectedDataSet, $dataSet); |
| 410 |
|
} |
| 411 |
|
|
| 412 |
|
public function testPrependToUpdateAnotherTree() |
| 413 |
|
{ |
| 414 |
|
$node = MultipleTreeNode::findOne(30); |
| 415 |
|
$this->assertTrue($node->prependTo(MultipleTreeNode::findOne(4))->save()); |
| 416 |
|
|
| 417 |
|
$dataSet = $this->getConnection()->createDataSet(['tree', 'multiple_tree']); |
| 418 |
|
$expectedDataSet = new ArrayDataSet(require(__DIR__ . '/data/test-prepend-to-update-another-tree.php')); |
| 419 |
|
$this->assertDataSetsEqual($expectedDataSet, $dataSet); |
| 420 |
|
} |
| 421 |
|
|
| 422 |
|
public function testPrependToUpdateSelf() |
| 423 |
|
{ |
|
@@ 655-663 (lines=9) @@
|
| 652 |
|
$this->assertDataSetsEqual($expectedDataSet, $dataSet); |
| 653 |
|
} |
| 654 |
|
|
| 655 |
|
public function testAppendToUpdateAnotherTree() |
| 656 |
|
{ |
| 657 |
|
$node = MultipleTreeNode::findOne(30); |
| 658 |
|
$this->assertTrue($node->appendTo(MultipleTreeNode::findOne(4))->save()); |
| 659 |
|
|
| 660 |
|
$dataSet = $this->getConnection()->createDataSet(['tree', 'multiple_tree']); |
| 661 |
|
$expectedDataSet = new ArrayDataSet(require(__DIR__ . '/data/test-append-to-update-another-tree.php')); |
| 662 |
|
$this->assertDataSetsEqual($expectedDataSet, $dataSet); |
| 663 |
|
} |
| 664 |
|
|
| 665 |
|
public function testAppendToUpdateSelf() |
| 666 |
|
{ |
|
@@ 785-793 (lines=9) @@
|
| 782 |
|
$this->assertDataSetsEqual($expectedDataSet, $dataSet); |
| 783 |
|
} |
| 784 |
|
|
| 785 |
|
public function testInsertBeforeUpdateAnotherTree() |
| 786 |
|
{ |
| 787 |
|
$node = MultipleTreeNode::findOne(26); |
| 788 |
|
$this->assertTrue($node->insertBefore(MultipleTreeNode::findOne(15))->save()); |
| 789 |
|
|
| 790 |
|
$dataSet = $this->getConnection()->createDataSet(['tree', 'multiple_tree']); |
| 791 |
|
$expectedDataSet = new ArrayDataSet(require(__DIR__ . '/data/test-insert-before-update-another-tree.php')); |
| 792 |
|
$this->assertDataSetsEqual($expectedDataSet, $dataSet); |
| 793 |
|
} |
| 794 |
|
|
| 795 |
|
/** |
| 796 |
|
* @expectedException \yii\base\Exception |
|
@@ 903-911 (lines=9) @@
|
| 900 |
|
$this->assertDataSetsEqual($expectedDataSet, $dataSet); |
| 901 |
|
} |
| 902 |
|
|
| 903 |
|
public function testInsertAfterUpdateAnotherTree() |
| 904 |
|
{ |
| 905 |
|
$node = MultipleTreeNode::findOne(26); |
| 906 |
|
$this->assertTrue($node->insertAfter(MultipleTreeNode::findOne(21))->save()); |
| 907 |
|
|
| 908 |
|
$dataSet = $this->getConnection()->createDataSet(['tree', 'multiple_tree']); |
| 909 |
|
$expectedDataSet = new ArrayDataSet(require(__DIR__ . '/data/test-insert-after-update-another-tree.php')); |
| 910 |
|
$this->assertDataSetsEqual($expectedDataSet, $dataSet); |
| 911 |
|
} |
| 912 |
|
|
| 913 |
|
/** |
| 914 |
|
* @expectedException \yii\base\Exception |
|
@@ 949-958 (lines=10) @@
|
| 946 |
|
$node->insertAfter(Node::findOne(23))->save(); |
| 947 |
|
} |
| 948 |
|
|
| 949 |
|
public function testDelete() |
| 950 |
|
{ |
| 951 |
|
$this->assertEquals(1, Node::findOne(2)->delete()); |
| 952 |
|
|
| 953 |
|
$this->assertEquals(1, MultipleTreeNode::findOne(30)->delete()); |
| 954 |
|
|
| 955 |
|
$dataSet = $this->getConnection()->createDataSet(['tree', 'multiple_tree']); |
| 956 |
|
$expectedDataSet = new ArrayDataSet(require(__DIR__ . '/data/test-delete.php')); |
| 957 |
|
$this->assertDataSetsEqual($expectedDataSet, $dataSet); |
| 958 |
|
} |
| 959 |
|
|
| 960 |
|
/** |
| 961 |
|
* @expectedException \yii\base\Exception |
|
@@ 977-986 (lines=10) @@
|
| 974 |
|
$node->delete(); |
| 975 |
|
} |
| 976 |
|
|
| 977 |
|
public function testDeleteWithChildren() |
| 978 |
|
{ |
| 979 |
|
$this->assertEquals(4, Node::findOne(6)->deleteWithChildren()); |
| 980 |
|
|
| 981 |
|
$this->assertEquals(1, MultipleTreeNode::findOne(28)->deleteWithChildren()); |
| 982 |
|
|
| 983 |
|
$dataSet = $this->getConnection()->createDataSet(['tree', 'multiple_tree']); |
| 984 |
|
$expectedDataSet = new ArrayDataSet(require(__DIR__ . '/data/test-delete-with-children.php')); |
| 985 |
|
$this->assertDataSetsEqual($expectedDataSet, $dataSet); |
| 986 |
|
} |
| 987 |
|
|
| 988 |
|
public function testDeleteWithChildrenRoot() |
| 989 |
|
{ |
|
@@ 988-997 (lines=10) @@
|
| 985 |
|
$this->assertDataSetsEqual($expectedDataSet, $dataSet); |
| 986 |
|
} |
| 987 |
|
|
| 988 |
|
public function testDeleteWithChildrenRoot() |
| 989 |
|
{ |
| 990 |
|
$this->assertEquals(25, Node::findOne(1)->deleteWithChildren()); |
| 991 |
|
|
| 992 |
|
$this->assertEquals(14, MultipleTreeNode::findOne(26)->deleteWithChildren()); |
| 993 |
|
|
| 994 |
|
$dataSet = $this->getConnection()->createDataSet(['tree', 'multiple_tree']); |
| 995 |
|
$expectedDataSet = new ArrayDataSet(require(__DIR__ . '/data/test-delete-with-children-root.php')); |
| 996 |
|
$this->assertDataSetsEqual($expectedDataSet, $dataSet); |
| 997 |
|
} |
| 998 |
|
|
| 999 |
|
/** |
| 1000 |
|
* @expectedException \yii\base\Exception |