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