NestedSetsQueryTraitTestCase::testRoots()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
/**
3
 * @link https://github.com/paulzi/yii2-nested-sets
4
 * @copyright Copyright (c) 2015 PaulZi <[email protected]>
5
 * @license MIT (https://github.com/paulzi/yii2-nested-sets/blob/master/LICENSE)
6
 */
7
8
namespace paulzi\nestedsets\tests;
9
10
use paulzi\nestedsets\tests\models\Node;
11
use paulzi\nestedsets\tests\models\MultipleTreeNode;
12
use Yii;
13
14
/**
15
 * @author PaulZi <[email protected]>
16
 */
17
class NestedSetsQueryTraitTestCase extends BaseTestCase
18
{
19
    public function testRoots()
20
    {
21
        $this->assertEquals([1], array_map(function ($value) { return $value->id; }, Node::find()->roots()->all()));
22
        $this->assertEquals([1, 26], array_map(function ($value) { return $value->id; }, MultipleTreeNode::find()->roots()->all()));
23
    }
24
}