|
|
@@ -65,6 +65,7 @@ class TreeBehaviorNumberTest extends CakeTestCase {
|
|
|
public function testInitialize() {
|
|
|
extract($this->settings);
|
|
|
$this->Tree = new $modelClass();
|
|
|
+ $this->Tree->order = null;
|
|
|
$this->Tree->initialize(2, 2);
|
|
|
|
|
|
$result = $this->Tree->find('count');
|
|
|
@@ -82,6 +83,7 @@ class TreeBehaviorNumberTest extends CakeTestCase {
|
|
|
public function testDetectInvalidLeft() {
|
|
|
extract($this->settings);
|
|
|
$this->Tree = new $modelClass();
|
|
|
+ $this->Tree->order = null;
|
|
|
$this->Tree->initialize(2, 2);
|
|
|
|
|
|
$result = $this->Tree->findByName('1.1');
|
|
|
@@ -108,6 +110,7 @@ class TreeBehaviorNumberTest extends CakeTestCase {
|
|
|
public function testDetectInvalidRight() {
|
|
|
extract($this->settings);
|
|
|
$this->Tree = new $modelClass();
|
|
|
+ $this->Tree->order = null;
|
|
|
$this->Tree->initialize(2, 2);
|
|
|
|
|
|
$result = $this->Tree->findByName('1.1');
|
|
|
@@ -134,6 +137,7 @@ class TreeBehaviorNumberTest extends CakeTestCase {
|
|
|
public function testDetectInvalidParent() {
|
|
|
extract($this->settings);
|
|
|
$this->Tree = new $modelClass();
|
|
|
+ $this->Tree->order = null;
|
|
|
$this->Tree->initialize(2, 2);
|
|
|
|
|
|
$result = $this->Tree->findByName('1.1');
|
|
|
@@ -159,6 +163,7 @@ class TreeBehaviorNumberTest extends CakeTestCase {
|
|
|
public function testDetectNoneExistentParent() {
|
|
|
extract($this->settings);
|
|
|
$this->Tree = new $modelClass();
|
|
|
+ $this->Tree->order = null;
|
|
|
$this->Tree->initialize(2, 2);
|
|
|
|
|
|
$result = $this->Tree->findByName('1.1');
|
|
|
@@ -182,6 +187,7 @@ class TreeBehaviorNumberTest extends CakeTestCase {
|
|
|
public function testRecoverUsingParentMode() {
|
|
|
extract($this->settings);
|
|
|
$this->Tree = new $modelClass();
|
|
|
+ $this->Tree->order = null;
|
|
|
$this->Tree->Behaviors->disable('Tree');
|
|
|
|
|
|
$this->Tree->save(array('name' => 'Main', $parentField => null, $leftField => 0, $rightField => 0));
|
|
|
@@ -233,6 +239,7 @@ class TreeBehaviorNumberTest extends CakeTestCase {
|
|
|
public function testRecoverUsingParentModeAndDelete() {
|
|
|
extract($this->settings);
|
|
|
$this->Tree = new $modelClass();
|
|
|
+ $this->Tree->order = null;
|
|
|
$this->Tree->Behaviors->disable('Tree');
|
|
|
|
|
|
$this->Tree->save(array('name' => 'Main', $parentField => null, $leftField => 0, $rightField => 0));
|
|
|
@@ -301,6 +308,7 @@ class TreeBehaviorNumberTest extends CakeTestCase {
|
|
|
public function testRecoverFromMissingParent() {
|
|
|
extract($this->settings);
|
|
|
$this->Tree = new $modelClass();
|
|
|
+ $this->Tree->order = null;
|
|
|
$this->Tree->initialize(2, 2);
|
|
|
|
|
|
$result = $this->Tree->findByName('1.1');
|
|
|
@@ -324,6 +332,7 @@ class TreeBehaviorNumberTest extends CakeTestCase {
|
|
|
public function testDetectInvalidParents() {
|
|
|
extract($this->settings);
|
|
|
$this->Tree = new $modelClass();
|
|
|
+ $this->Tree->order = null;
|
|
|
$this->Tree->initialize(2, 2);
|
|
|
|
|
|
$this->Tree->updateAll(array($parentField => null));
|
|
|
@@ -346,6 +355,7 @@ class TreeBehaviorNumberTest extends CakeTestCase {
|
|
|
public function testDetectInvalidLftsRghts() {
|
|
|
extract($this->settings);
|
|
|
$this->Tree = new $modelClass();
|
|
|
+ $this->Tree->order = null;
|
|
|
$this->Tree->initialize(2, 2);
|
|
|
|
|
|
$this->Tree->updateAll(array($leftField => 0, $rightField => 0));
|
|
|
@@ -367,6 +377,7 @@ class TreeBehaviorNumberTest extends CakeTestCase {
|
|
|
public function testDetectEqualLftsRghts() {
|
|
|
extract($this->settings);
|
|
|
$this->Tree = new $modelClass();
|
|
|
+ $this->Tree->order = null;
|
|
|
$this->Tree->initialize(1, 3);
|
|
|
|
|
|
$result = $this->Tree->findByName('1.1');
|
|
|
@@ -394,6 +405,7 @@ class TreeBehaviorNumberTest extends CakeTestCase {
|
|
|
public function testAddOrphan() {
|
|
|
extract($this->settings);
|
|
|
$this->Tree = new $modelClass();
|
|
|
+ $this->Tree->order = null;
|
|
|
$this->Tree->initialize(2, 2);
|
|
|
|
|
|
$this->Tree->save(array($modelClass => array('name' => 'testAddOrphan', $parentField => null)));
|
|
|
@@ -413,6 +425,7 @@ class TreeBehaviorNumberTest extends CakeTestCase {
|
|
|
public function testAddMiddle() {
|
|
|
extract($this->settings);
|
|
|
$this->Tree = new $modelClass();
|
|
|
+ $this->Tree->order = null;
|
|
|
$this->Tree->initialize(2, 2);
|
|
|
|
|
|
$data = $this->Tree->find('first', array('fields' => array('id'), 'conditions' => array($modelClass . '.name' => '1.1')));
|
|
|
@@ -444,6 +457,7 @@ class TreeBehaviorNumberTest extends CakeTestCase {
|
|
|
public function testAddWithPreSpecifiedId() {
|
|
|
extract($this->settings);
|
|
|
$this->Tree = new $modelClass();
|
|
|
+ $this->Tree->order = null;
|
|
|
$this->Tree->initialize(2, 2);
|
|
|
|
|
|
$data = $this->Tree->find('first', array(
|
|
|
@@ -474,6 +488,7 @@ class TreeBehaviorNumberTest extends CakeTestCase {
|
|
|
public function testAddInvalid() {
|
|
|
extract($this->settings);
|
|
|
$this->Tree = new $modelClass();
|
|
|
+ $this->Tree->order = null;
|
|
|
$this->Tree->initialize(2, 2);
|
|
|
$this->Tree->id = null;
|
|
|
|
|
|
@@ -498,6 +513,7 @@ class TreeBehaviorNumberTest extends CakeTestCase {
|
|
|
public function testAddNotIndexedByModel() {
|
|
|
extract($this->settings);
|
|
|
$this->Tree = new $modelClass();
|
|
|
+ $this->Tree->order = null;
|
|
|
$this->Tree->initialize(2, 2);
|
|
|
|
|
|
$this->Tree->save(array('name' => 'testAddNotIndexed', $parentField => null));
|
|
|
@@ -517,6 +533,7 @@ class TreeBehaviorNumberTest extends CakeTestCase {
|
|
|
public function testMovePromote() {
|
|
|
extract($this->settings);
|
|
|
$this->Tree = new $modelClass();
|
|
|
+ $this->Tree->order = null;
|
|
|
$this->Tree->initialize(2, 2);
|
|
|
$this->Tree->id = null;
|
|
|
|
|
|
@@ -543,6 +560,7 @@ class TreeBehaviorNumberTest extends CakeTestCase {
|
|
|
public function testMoveWithWhitelist() {
|
|
|
extract($this->settings);
|
|
|
$this->Tree = new $modelClass();
|
|
|
+ $this->Tree->order = null;
|
|
|
$this->Tree->initialize(2, 2);
|
|
|
$this->Tree->id = null;
|
|
|
|
|
|
@@ -570,6 +588,7 @@ class TreeBehaviorNumberTest extends CakeTestCase {
|
|
|
public function testInsertWithWhitelist() {
|
|
|
extract($this->settings);
|
|
|
$this->Tree = new $modelClass();
|
|
|
+ $this->Tree->order = null;
|
|
|
$this->Tree->initialize(2, 2);
|
|
|
|
|
|
$this->Tree->whitelist = array('name', $parentField);
|
|
|
@@ -588,6 +607,7 @@ class TreeBehaviorNumberTest extends CakeTestCase {
|
|
|
public function testMoveBefore() {
|
|
|
extract($this->settings);
|
|
|
$this->Tree = new $modelClass();
|
|
|
+ $this->Tree->order = null;
|
|
|
$this->Tree->initialize(2, 2);
|
|
|
$this->Tree->id = null;
|
|
|
|
|
|
@@ -616,6 +636,7 @@ class TreeBehaviorNumberTest extends CakeTestCase {
|
|
|
public function testMoveAfter() {
|
|
|
extract($this->settings);
|
|
|
$this->Tree = new $modelClass();
|
|
|
+ $this->Tree->order = null;
|
|
|
$this->Tree->initialize(2, 2);
|
|
|
$this->Tree->id = null;
|
|
|
|
|
|
@@ -644,6 +665,7 @@ class TreeBehaviorNumberTest extends CakeTestCase {
|
|
|
public function testMoveDemoteInvalid() {
|
|
|
extract($this->settings);
|
|
|
$this->Tree = new $modelClass();
|
|
|
+ $this->Tree->order = null;
|
|
|
$this->Tree->initialize(2, 2);
|
|
|
$this->Tree->id = null;
|
|
|
|
|
|
@@ -676,6 +698,7 @@ class TreeBehaviorNumberTest extends CakeTestCase {
|
|
|
public function testMoveInvalid() {
|
|
|
extract($this->settings);
|
|
|
$this->Tree = new $modelClass();
|
|
|
+ $this->Tree->order = null;
|
|
|
$this->Tree->initialize(2, 2);
|
|
|
$this->Tree->id = null;
|
|
|
|
|
|
@@ -700,6 +723,7 @@ class TreeBehaviorNumberTest extends CakeTestCase {
|
|
|
public function testMoveSelfInvalid() {
|
|
|
extract($this->settings);
|
|
|
$this->Tree = new $modelClass();
|
|
|
+ $this->Tree->order = null;
|
|
|
$this->Tree->initialize(2, 2);
|
|
|
$this->Tree->id = null;
|
|
|
|
|
|
@@ -725,6 +749,7 @@ class TreeBehaviorNumberTest extends CakeTestCase {
|
|
|
public function testMoveUpSuccess() {
|
|
|
extract($this->settings);
|
|
|
$this->Tree = new $modelClass();
|
|
|
+ $this->Tree->order = null;
|
|
|
$this->Tree->initialize(2, 2);
|
|
|
|
|
|
$data = $this->Tree->find('first', array('fields' => array('id'), 'conditions' => array($modelClass . '.name' => '1.2')));
|
|
|
@@ -746,6 +771,7 @@ class TreeBehaviorNumberTest extends CakeTestCase {
|
|
|
public function testMoveUpFail() {
|
|
|
extract($this->settings);
|
|
|
$this->Tree = new $modelClass();
|
|
|
+ $this->Tree->order = null;
|
|
|
$this->Tree->initialize(2, 2);
|
|
|
|
|
|
$data = $this->Tree->find('first', array('conditions' => array($modelClass . '.name' => '1.1')));
|
|
|
@@ -768,6 +794,7 @@ class TreeBehaviorNumberTest extends CakeTestCase {
|
|
|
public function testMoveUp2() {
|
|
|
extract($this->settings);
|
|
|
$this->Tree = new $modelClass();
|
|
|
+ $this->Tree->order = null;
|
|
|
$this->Tree->initialize(1, 10);
|
|
|
|
|
|
$data = $this->Tree->find('first', array('fields' => array('id'), 'conditions' => array($modelClass . '.name' => '1.5')));
|
|
|
@@ -798,6 +825,7 @@ class TreeBehaviorNumberTest extends CakeTestCase {
|
|
|
public function testMoveUpFirst() {
|
|
|
extract($this->settings);
|
|
|
$this->Tree = new $modelClass();
|
|
|
+ $this->Tree->order = null;
|
|
|
$this->Tree->initialize(1, 10);
|
|
|
|
|
|
$data = $this->Tree->find('first', array('fields' => array('id'), 'conditions' => array($modelClass . '.name' => '1.5')));
|
|
|
@@ -828,6 +856,7 @@ class TreeBehaviorNumberTest extends CakeTestCase {
|
|
|
public function testMoveDownSuccess() {
|
|
|
extract($this->settings);
|
|
|
$this->Tree = new $modelClass();
|
|
|
+ $this->Tree->order = null;
|
|
|
$this->Tree->initialize(2, 2);
|
|
|
|
|
|
$data = $this->Tree->find('first', array('fields' => array('id'), 'conditions' => array($modelClass . '.name' => '1.1')));
|
|
|
@@ -849,6 +878,7 @@ class TreeBehaviorNumberTest extends CakeTestCase {
|
|
|
public function testMoveDownFail() {
|
|
|
extract($this->settings);
|
|
|
$this->Tree = new $modelClass();
|
|
|
+ $this->Tree->order = null;
|
|
|
$this->Tree->initialize(2, 2);
|
|
|
|
|
|
$data = $this->Tree->find('first', array('conditions' => array($modelClass . '.name' => '1.2')));
|
|
|
@@ -870,6 +900,7 @@ class TreeBehaviorNumberTest extends CakeTestCase {
|
|
|
public function testMoveDownLast() {
|
|
|
extract($this->settings);
|
|
|
$this->Tree = new $modelClass();
|
|
|
+ $this->Tree->order = null;
|
|
|
$this->Tree->initialize(1, 10);
|
|
|
|
|
|
$data = $this->Tree->find('first', array('fields' => array('id'), 'conditions' => array($modelClass . '.name' => '1.5')));
|
|
|
@@ -900,6 +931,7 @@ class TreeBehaviorNumberTest extends CakeTestCase {
|
|
|
public function testMoveDown2() {
|
|
|
extract($this->settings);
|
|
|
$this->Tree = new $modelClass();
|
|
|
+ $this->Tree->order = null;
|
|
|
$this->Tree->initialize(1, 10);
|
|
|
|
|
|
$data = $this->Tree->find('first', array('fields' => array('id'), 'conditions' => array($modelClass . '.name' => '1.5')));
|
|
|
@@ -930,6 +962,7 @@ class TreeBehaviorNumberTest extends CakeTestCase {
|
|
|
public function testSaveNoMove() {
|
|
|
extract($this->settings);
|
|
|
$this->Tree = new $modelClass();
|
|
|
+ $this->Tree->order = null;
|
|
|
$this->Tree->initialize(1, 10);
|
|
|
|
|
|
$data = $this->Tree->find('first', array('fields' => array('id'), 'conditions' => array($modelClass . '.name' => '1.5')));
|
|
|
@@ -960,6 +993,7 @@ class TreeBehaviorNumberTest extends CakeTestCase {
|
|
|
public function testMoveToRootAndMoveUp() {
|
|
|
extract($this->settings);
|
|
|
$this->Tree = new $modelClass();
|
|
|
+ $this->Tree->order = null;
|
|
|
$this->Tree->initialize(1, 1);
|
|
|
$data = $this->Tree->find('first', array('fields' => array('id'), 'conditions' => array($modelClass . '.name' => '1.1')));
|
|
|
$this->Tree->id = $data[$modelClass]['id'];
|
|
|
@@ -984,6 +1018,7 @@ class TreeBehaviorNumberTest extends CakeTestCase {
|
|
|
public function testDelete() {
|
|
|
extract($this->settings);
|
|
|
$this->Tree = new $modelClass();
|
|
|
+ $this->Tree->order = null;
|
|
|
$this->Tree->initialize(2, 2);
|
|
|
|
|
|
$initialCount = $this->Tree->find('count');
|
|
|
@@ -1019,6 +1054,7 @@ class TreeBehaviorNumberTest extends CakeTestCase {
|
|
|
public function testDeleteDoesNotExist() {
|
|
|
extract($this->settings);
|
|
|
$this->Tree = new $modelClass();
|
|
|
+ $this->Tree->order = null;
|
|
|
$this->Tree->initialize(2, 2);
|
|
|
$this->Tree->delete(99999);
|
|
|
}
|
|
|
@@ -1031,6 +1067,7 @@ class TreeBehaviorNumberTest extends CakeTestCase {
|
|
|
public function testRemove() {
|
|
|
extract($this->settings);
|
|
|
$this->Tree = new $modelClass();
|
|
|
+ $this->Tree->order = null;
|
|
|
$this->Tree->initialize(2, 2);
|
|
|
$initialCount = $this->Tree->find('count');
|
|
|
$result = $this->Tree->findByName('1.1');
|
|
|
@@ -1063,6 +1100,7 @@ class TreeBehaviorNumberTest extends CakeTestCase {
|
|
|
public function testRemoveLastTopParent() {
|
|
|
extract($this->settings);
|
|
|
$this->Tree = new $modelClass();
|
|
|
+ $this->Tree->order = null;
|
|
|
$this->Tree->initialize(2, 2);
|
|
|
|
|
|
$initialCount = $this->Tree->find('count');
|
|
|
@@ -1096,6 +1134,7 @@ class TreeBehaviorNumberTest extends CakeTestCase {
|
|
|
public function testRemoveNoChildren() {
|
|
|
extract($this->settings);
|
|
|
$this->Tree = new $modelClass();
|
|
|
+ $this->Tree->order = null;
|
|
|
$this->Tree->initialize(2, 2);
|
|
|
$initialCount = $this->Tree->find('count');
|
|
|
|
|
|
@@ -1130,6 +1169,7 @@ class TreeBehaviorNumberTest extends CakeTestCase {
|
|
|
public function testRemoveAndDelete() {
|
|
|
extract($this->settings);
|
|
|
$this->Tree = new $modelClass();
|
|
|
+ $this->Tree->order = null;
|
|
|
$this->Tree->initialize(2, 2);
|
|
|
|
|
|
$initialCount = $this->Tree->find('count');
|
|
|
@@ -1164,6 +1204,7 @@ class TreeBehaviorNumberTest extends CakeTestCase {
|
|
|
public function testRemoveAndDeleteNoChildren() {
|
|
|
extract($this->settings);
|
|
|
$this->Tree = new $modelClass();
|
|
|
+ $this->Tree->order = null;
|
|
|
$this->Tree->initialize(2, 2);
|
|
|
$initialCount = $this->Tree->find('count');
|
|
|
|
|
|
@@ -1196,6 +1237,7 @@ class TreeBehaviorNumberTest extends CakeTestCase {
|
|
|
public function testChildren() {
|
|
|
extract($this->settings);
|
|
|
$this->Tree = new $modelClass();
|
|
|
+ $this->Tree->order = null;
|
|
|
$this->Tree->initialize(2, 2);
|
|
|
|
|
|
$data = $this->Tree->find('first', array('conditions' => array($modelClass . '.name' => '1. Root')));
|
|
|
@@ -1226,6 +1268,7 @@ class TreeBehaviorNumberTest extends CakeTestCase {
|
|
|
public function testCountChildren() {
|
|
|
extract($this->settings);
|
|
|
$this->Tree = new $modelClass();
|
|
|
+ $this->Tree->order = null;
|
|
|
$this->Tree->initialize(2, 2);
|
|
|
|
|
|
$data = $this->Tree->find('first', array('conditions' => array($modelClass . '.name' => '1. Root')));
|
|
|
@@ -1251,6 +1294,7 @@ class TreeBehaviorNumberTest extends CakeTestCase {
|
|
|
public function testGetParentNode() {
|
|
|
extract($this->settings);
|
|
|
$this->Tree = new $modelClass();
|
|
|
+ $this->Tree->order = null;
|
|
|
$this->Tree->initialize(2, 2);
|
|
|
|
|
|
$data = $this->Tree->find('first', array('conditions' => array($modelClass . '.name' => '1.2.2')));
|
|
|
@@ -1269,6 +1313,7 @@ class TreeBehaviorNumberTest extends CakeTestCase {
|
|
|
public function testGetPath() {
|
|
|
extract($this->settings);
|
|
|
$this->Tree = new $modelClass();
|
|
|
+ $this->Tree->order = null;
|
|
|
$this->Tree->initialize(2, 2);
|
|
|
|
|
|
$data = $this->Tree->find('first', array('conditions' => array($modelClass . '.name' => '1.2.2')));
|
|
|
@@ -1289,6 +1334,7 @@ class TreeBehaviorNumberTest extends CakeTestCase {
|
|
|
public function testNoAmbiguousColumn() {
|
|
|
extract($this->settings);
|
|
|
$this->Tree = new $modelClass();
|
|
|
+ $this->Tree->order = null;
|
|
|
$this->Tree->bindModel(array('belongsTo' => array('Dummy' =>
|
|
|
array('className' => $modelClass, 'foreignKey' => $parentField, 'conditions' => array('Dummy.id' => null)))), false);
|
|
|
$this->Tree->initialize(2, 2);
|
|
|
@@ -1321,6 +1367,7 @@ class TreeBehaviorNumberTest extends CakeTestCase {
|
|
|
public function testReorderTree() {
|
|
|
extract($this->settings);
|
|
|
$this->Tree = new $modelClass();
|
|
|
+ $this->Tree->order = null;
|
|
|
$this->Tree->initialize(3, 3);
|
|
|
$nodes = $this->Tree->find('list', array('order' => $leftField));
|
|
|
|
|
|
@@ -1352,6 +1399,7 @@ class TreeBehaviorNumberTest extends CakeTestCase {
|
|
|
public function testReorderBigTreeWithQueryCaching() {
|
|
|
extract($this->settings);
|
|
|
$this->Tree = new $modelClass();
|
|
|
+ $this->Tree->order = null;
|
|
|
$this->Tree->initialize(2, 10);
|
|
|
|
|
|
$original = $this->Tree->cacheQueries;
|
|
|
@@ -1369,6 +1417,7 @@ class TreeBehaviorNumberTest extends CakeTestCase {
|
|
|
public function testGenerateTreeListWithSelfJoin() {
|
|
|
extract($this->settings);
|
|
|
$this->Tree = new $modelClass();
|
|
|
+ $this->Tree->order = null;
|
|
|
$this->Tree->bindModel(array('belongsTo' => array('Dummy' =>
|
|
|
array('className' => $modelClass, 'foreignKey' => $parentField, 'conditions' => array('Dummy.id' => null)))), false);
|
|
|
$this->Tree->initialize(2, 2);
|
|
|
@@ -1386,6 +1435,7 @@ class TreeBehaviorNumberTest extends CakeTestCase {
|
|
|
public function testGenerateTreeListFormatting() {
|
|
|
extract($this->settings);
|
|
|
$this->Tree = new $modelClass();
|
|
|
+ $this->Tree->order = null;
|
|
|
$this->Tree->initialize(2, 2);
|
|
|
|
|
|
$result = $this->Tree->generateTreeList(
|
|
|
@@ -1406,6 +1456,7 @@ class TreeBehaviorNumberTest extends CakeTestCase {
|
|
|
public function testArraySyntax() {
|
|
|
extract($this->settings);
|
|
|
$this->Tree = new $modelClass();
|
|
|
+ $this->Tree->order = null;
|
|
|
$this->Tree->initialize(3, 3);
|
|
|
$this->assertSame($this->Tree->childCount(2), $this->Tree->childCount(array('id' => 2)));
|
|
|
$this->assertSame($this->Tree->getParentNode(2), $this->Tree->getParentNode(array('id' => 2)));
|