creocoder / yii2-nested-sets

The nested sets behavior for the Yii framework.
Other
446 stars 129 forks source link

fixing the multiple roots problem with updating left, right #42

Closed Mihai-P closed 9 years ago

Mihai-P commented 9 years ago

shiftLeftRightAttribute takes into consideration the root. However the root is not set until after the the other nodes are updated. So this part of shiftLeftRightAttribute

if ($this->treeAttribute !== false) { $condition = [ 'and', $condition, [$this->treeAttribute => $this->owner->getAttribute($this->treeAttribute)] ]; }

Will create a condition with where $this->owner->getAttribute($this->treeAttribute) is empty. As a result no records are changed.

creocoder commented 9 years ago

@Mihai-P Good catch, thanks!

Mihai-P commented 9 years ago

Can you give me some tips on how to run the tests? I would like to add some tests cases.

creocoder commented 9 years ago

@Mihai-P Download phpunit.phar and put it near phpunit.xml.dist and than run

$ php phpunit.phar

Btw currently there is only base for tests. Help with tests would be very helpful. If you want contribute contact me please via Skype ID: creocoder and i'll explain unit tests next plan.