@@ 808-819 (lines=12) @@ | ||
805 | $node->insertAfter(Node::findOne(24))->save(); |
|
806 | } |
|
807 | ||
808 | public function testDelete() |
|
809 | { |
|
810 | $this->assertEquals(1, Node::findOne(3)->delete()); |
|
811 | ||
812 | $this->assertEquals(1, AttributeModeNode::findOne(3)->delete()); |
|
813 | ||
814 | $this->assertEquals(1, MultipleTreeNode::findOne(3)->delete()); |
|
815 | ||
816 | $dataSet = $this->getConnection()->createDataSet(['tree', 'attribute_mode_tree', 'multiple_tree']); |
|
817 | $expectedDataSet = new ArrayDataSet(require(__DIR__ . '/data/test-delete.php')); |
|
818 | $this->assertDataSetsEqual($expectedDataSet, $dataSet); |
|
819 | } |
|
820 | ||
821 | /** |
|
822 | * @expectedException \yii\base\Exception |
|
@@ 838-849 (lines=12) @@ | ||
835 | $node->delete(); |
|
836 | } |
|
837 | ||
838 | public function testDeleteWithChildren() |
|
839 | { |
|
840 | $this->assertEquals(4, Node::findOne(3)->deleteWithChildren()); |
|
841 | ||
842 | $this->assertEquals(4, AttributeModeNode::findOne(3)->deleteWithChildren()); |
|
843 | ||
844 | $this->assertEquals(4, MultipleTreeNode::findOne(3)->deleteWithChildren()); |
|
845 | ||
846 | $dataSet = $this->getConnection()->createDataSet(['tree', 'attribute_mode_tree', 'multiple_tree']); |
|
847 | $expectedDataSet = new ArrayDataSet(require(__DIR__ . '/data/test-delete-with-children.php')); |
|
848 | $this->assertDataSetsEqual($expectedDataSet, $dataSet); |
|
849 | } |
|
850 | ||
851 | public function testDeleteWithChildrenRoot() |
|
852 | { |
|
@@ 851-862 (lines=12) @@ | ||
848 | $this->assertDataSetsEqual($expectedDataSet, $dataSet); |
|
849 | } |
|
850 | ||
851 | public function testDeleteWithChildrenRoot() |
|
852 | { |
|
853 | $this->assertEquals(13, Node::findOne(1)->deleteWithChildren()); |
|
854 | ||
855 | $this->assertEquals(13, AttributeModeNode::findOne(1)->deleteWithChildren()); |
|
856 | ||
857 | $this->assertEquals(13, MultipleTreeNode::findOne(1)->deleteWithChildren()); |
|
858 | ||
859 | $dataSet = $this->getConnection()->createDataSet(['tree', 'attribute_mode_tree', 'multiple_tree']); |
|
860 | $expectedDataSet = new ArrayDataSet(require(__DIR__ . '/data/test-delete-with-children-root.php')); |
|
861 | $this->assertDataSetsEqual($expectedDataSet, $dataSet); |
|
862 | } |
|
863 | ||
864 | /** |
|
865 | * @expectedException \yii\base\Exception |