1
0
Fork 0
mirror of https://github.com/Oreolek/yii2-nested-sets.git synced 2024-05-25 20:28:10 +03:00

Added new cases to unit tests

This commit is contained in:
Alexander Kochetov 2015-01-03 18:52:53 +03:00
parent db4dffe0be
commit 87ffc3f87d

View file

@ -876,7 +876,23 @@ class NestedSetsBehaviorTest extends DatabaseTestCase
*/
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);
}
/**