|
@@ 717-726 (lines=10) @@
|
| 714 |
|
$node->insertAfter(Node::findOne(23))->save(); |
| 715 |
|
} |
| 716 |
|
|
| 717 |
|
public function testDelete() |
| 718 |
|
{ |
| 719 |
|
$this->assertEquals(1, Node::findOne(2)->delete()); |
| 720 |
|
|
| 721 |
|
$this->assertEquals(1, MultipleTreeNode::findOne(30)->delete()); |
| 722 |
|
|
| 723 |
|
$dataSet = $this->getConnection()->createDataSet(['tree', 'multiple_tree']); |
| 724 |
|
$expectedDataSet = new ArrayDataSet(require(__DIR__ . '/data/test-delete.php')); |
| 725 |
|
$this->assertDataSetsEqual($expectedDataSet, $dataSet); |
| 726 |
|
} |
| 727 |
|
|
| 728 |
|
/** |
| 729 |
|
* @expectedException \yii\base\Exception |
|
@@ 745-754 (lines=10) @@
|
| 742 |
|
$node->delete(); |
| 743 |
|
} |
| 744 |
|
|
| 745 |
|
public function testDeleteWithChildren() |
| 746 |
|
{ |
| 747 |
|
$this->assertEquals(4, Node::findOne(6)->deleteWithChildren()); |
| 748 |
|
|
| 749 |
|
$this->assertEquals(1, MultipleTreeNode::findOne(28)->deleteWithChildren()); |
| 750 |
|
|
| 751 |
|
$dataSet = $this->getConnection()->createDataSet(['tree', 'multiple_tree']); |
| 752 |
|
$expectedDataSet = new ArrayDataSet(require(__DIR__ . '/data/test-delete-with-children.php')); |
| 753 |
|
$this->assertDataSetsEqual($expectedDataSet, $dataSet); |
| 754 |
|
} |
| 755 |
|
|
| 756 |
|
public function testDeleteWithChildrenRoot() |
| 757 |
|
{ |
|
@@ 756-765 (lines=10) @@
|
| 753 |
|
$this->assertDataSetsEqual($expectedDataSet, $dataSet); |
| 754 |
|
} |
| 755 |
|
|
| 756 |
|
public function testDeleteWithChildrenRoot() |
| 757 |
|
{ |
| 758 |
|
$this->assertEquals(25, Node::findOne(1)->deleteWithChildren()); |
| 759 |
|
|
| 760 |
|
$this->assertEquals(14, MultipleTreeNode::findOne(26)->deleteWithChildren()); |
| 761 |
|
|
| 762 |
|
$dataSet = $this->getConnection()->createDataSet(['tree', 'multiple_tree']); |
| 763 |
|
$expectedDataSet = new ArrayDataSet(require(__DIR__ . '/data/test-delete-with-children-root.php')); |
| 764 |
|
$this->assertDataSetsEqual($expectedDataSet, $dataSet); |
| 765 |
|
} |
| 766 |
|
|
| 767 |
|
/** |
| 768 |
|
* @expectedException \yii\base\Exception |