コード例 #1
0
 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()));
 }
コード例 #2
0
 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);
 }