|
@@ 707-716 (lines=10) @@
|
| 704 |
|
$node->insertAfter(Node::findOne(23))->save(); |
| 705 |
|
} |
| 706 |
|
|
| 707 |
|
public function testDelete() |
| 708 |
|
{ |
| 709 |
|
$this->assertEquals(1, Node::findOne(2)->delete()); |
| 710 |
|
|
| 711 |
|
$this->assertEquals(1, MultipleTreeNode::findOne(30)->delete()); |
| 712 |
|
|
| 713 |
|
$dataSet = $this->getConnection()->createDataSet(['tree', 'multiple_tree']); |
| 714 |
|
$expectedDataSet = new ArrayDataSet(require(__DIR__ . '/data/test-delete.php')); |
| 715 |
|
$this->assertDataSetsEqual($expectedDataSet, $dataSet); |
| 716 |
|
} |
| 717 |
|
|
| 718 |
|
/** |
| 719 |
|
* @expectedException \yii\base\Exception |
|
@@ 735-744 (lines=10) @@
|
| 732 |
|
$node->delete(); |
| 733 |
|
} |
| 734 |
|
|
| 735 |
|
public function testDeleteWithChildren() |
| 736 |
|
{ |
| 737 |
|
$this->assertEquals(4, Node::findOne(6)->deleteWithChildren()); |
| 738 |
|
|
| 739 |
|
$this->assertEquals(1, MultipleTreeNode::findOne(28)->deleteWithChildren()); |
| 740 |
|
|
| 741 |
|
$dataSet = $this->getConnection()->createDataSet(['tree', 'multiple_tree']); |
| 742 |
|
$expectedDataSet = new ArrayDataSet(require(__DIR__ . '/data/test-delete-with-children.php')); |
| 743 |
|
$this->assertDataSetsEqual($expectedDataSet, $dataSet); |
| 744 |
|
} |
| 745 |
|
|
| 746 |
|
public function testDeleteWithChildrenRoot() |
| 747 |
|
{ |
|
@@ 746-755 (lines=10) @@
|
| 743 |
|
$this->assertDataSetsEqual($expectedDataSet, $dataSet); |
| 744 |
|
} |
| 745 |
|
|
| 746 |
|
public function testDeleteWithChildrenRoot() |
| 747 |
|
{ |
| 748 |
|
$this->assertEquals(25, Node::findOne(1)->deleteWithChildren()); |
| 749 |
|
|
| 750 |
|
$this->assertEquals(14, MultipleTreeNode::findOne(26)->deleteWithChildren()); |
| 751 |
|
|
| 752 |
|
$dataSet = $this->getConnection()->createDataSet(['tree', 'multiple_tree']); |
| 753 |
|
$expectedDataSet = new ArrayDataSet(require(__DIR__ . '/data/test-delete-with-children-root.php')); |
| 754 |
|
$this->assertDataSetsEqual($expectedDataSet, $dataSet); |
| 755 |
|
} |
| 756 |
|
|
| 757 |
|
/** |
| 758 |
|
* @expectedException \yii\base\Exception |