function testConstructor() { $avl = new AvlTree(function ($a, $b) { if ($a < $b) { return 1; } elseif ($b < $a) { return -1; } else { return 0; } }); $avl->add(4); $avl->add(3); $avl->add(5); $root = new BinaryTree(4); $root->setLeft(new BinaryTree(5)); $root->setRight(new BinaryTree(3)); $this->reCalculateHeights($root); $this->assertEquals($root, $avl->toBinaryTree()); }