mirror of
https://github.com/Oreolek/yii2-nested-sets.git
synced 2024-06-17 07:10:46 +03:00
Added new cases to unit tests
This commit is contained in:
parent
db4dffe0be
commit
87ffc3f87d
|
@ -876,7 +876,23 @@ class NestedSetsBehaviorTest extends DatabaseTestCase
|
||||||
*/
|
*/
|
||||||
public function testAncestors()
|
public function testAncestors()
|
||||||
{
|
{
|
||||||
$this->markTestSkipped();
|
$dataSet = $this->createFlatXMLDataSet(__DIR__ . '/datasets/tree.xml');
|
||||||
|
$this->getDatabaseTester()->setDataSet($dataSet);
|
||||||
|
$this->getDatabaseTester()->onSetUp();
|
||||||
|
$node = Tree::findOne(11);
|
||||||
|
$models = $node->ancestors()->all();
|
||||||
|
$dataSet = new ArrayDataSet(['tree' => ArrayHelper::toArray($models)]);
|
||||||
|
$expectedDataSet = $this->createFlatXMLDataSet(__DIR__ . '/datasets/tree-after-ancestors.xml');
|
||||||
|
$this->assertDataSetsEqual($expectedDataSet, $dataSet);
|
||||||
|
|
||||||
|
$dataSet = $this->createFlatXMLDataSet(__DIR__ . '/datasets/multiple-roots-tree.xml');
|
||||||
|
$this->getDatabaseTester()->setDataSet($dataSet);
|
||||||
|
$this->getDatabaseTester()->onSetUp();
|
||||||
|
$node = MultipleRootsTree::findOne(33);
|
||||||
|
$models = $node->ancestors()->all();
|
||||||
|
$dataSet = new ArrayDataSet(['multiple_roots_tree' => ArrayHelper::toArray($models)]);
|
||||||
|
$expectedDataSet = $this->createFlatXMLDataSet(__DIR__ . '/datasets/multiple-roots-tree-after-ancestors.xml');
|
||||||
|
$this->assertDataSetsEqual($expectedDataSet, $dataSet);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue