public function testRoots() { $this->assertEquals([1], array_map(function ($value) { return $value->id; }, Node::find()->roots()->all())); $this->assertEquals([1, 26], array_map(function ($value) { return $value->id; }, MultipleTreeNode::find()->roots()->all())); }
public function testDeleteWithChildrenRoot() { $this->assertEquals(25, Node::findOne(1)->deleteWithChildren()); $this->assertEquals(14, MultipleTreeNode::findOne(26)->deleteWithChildren()); $dataSet = $this->getConnection()->createDataSet(['tree', 'multiple_tree']); $expectedDataSet = new ArrayDataSet(require __DIR__ . '/data/test-delete-with-children-root.php'); $this->assertDataSetsEqual($expectedDataSet, $dataSet); }