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, NestedSetBehavior::makeRoot bug fix
This commit is contained in:
parent
d900b1ba25
commit
a874b13bd1
|
@ -523,7 +523,7 @@ class NestedSetsBehavior extends Behavior
|
|||
[
|
||||
$this->leftAttribute => new Expression($leftAttribute . sprintf('%+d', 1 - $leftValue)),
|
||||
$this->rightAttribute => new Expression($rightAttribute . sprintf('%+d', 1 - $leftValue)),
|
||||
$this->depthAttribute => new Expression($depthAttribute . sprintf('%+d', 1 - $depthValue)),
|
||||
$this->depthAttribute => new Expression($depthAttribute . sprintf('%+d', -$depthValue)),
|
||||
$this->treeAttribute => $this->owner->getPrimaryKey(),
|
||||
],
|
||||
[
|
||||
|
|
|
@ -191,7 +191,15 @@ class NestedSetsBehaviorTest extends DatabaseTestCase
|
|||
*/
|
||||
public function testMakeExistsRoot()
|
||||
{
|
||||
$this->markTestSkipped();
|
||||
$dataSet = $this->createFlatXMLDataSet(__DIR__ . '/datasets/multiple-roots-tree.xml');
|
||||
$this->getDatabaseTester()->setDataSet($dataSet);
|
||||
$this->getDatabaseTester()->onSetUp();
|
||||
$node = MultipleRootsTree::findOne(31);
|
||||
$node->name = 'Updated node 2';
|
||||
$this->assertTrue($node->makeRoot());
|
||||
$dataSet = $this->getConnection()->createDataSet(['multiple_roots_tree']);
|
||||
$expectedDataSet = $this->createFlatXMLDataSet(__DIR__ . '/datasets/multiple-roots-tree-after-make-exists-root.xml');
|
||||
$this->assertDataSetsEqual($expectedDataSet, $dataSet);
|
||||
}
|
||||
|
||||
// @todo: makeRoot exceptions tests here
|
||||
|
|
Loading…
Reference in a new issue