test fixes

This commit is contained in:
Dennis Eichhorn 2023-10-22 12:27:59 +00:00
parent 772453e753
commit 9c02749567
4 changed files with 27 additions and 3 deletions

View File

@ -456,6 +456,8 @@ final class ReadMapper extends DataMapperAbstract
] ]
); );
var_dump($query->execute()?->fetchColumn());
return $query->execute()?->fetchColumn(); return $query->execute()?->fetchColumn();
} }

View File

@ -243,8 +243,12 @@ class BinarySearchTree
} }
$temp = null; $temp = null;
if ($node->left === null) { if ($node->right !== null) {
$temp = $node->right->root; $temp = $node->right->root;
if ($temp === null) {
return;
}
if ($node->parent !== null) { if ($node->parent !== null) {
if ($node->parent->left !== null if ($node->parent->left !== null
&& $node->parent->left->root?->compare($node->data) === 0 && $node->parent->left->root?->compare($node->data) === 0
@ -264,8 +268,12 @@ class BinarySearchTree
return; return;
} }
if ($node->right === null) { if ($node->left !== null) {
$temp = $node->left->root; $temp = $node->left->root;
if ($temp === null) {
return;
}
if ($node->parent !== null) { if ($node->parent !== null) {
if ($node->parent->left !== null if ($node->parent->left !== null
&& $node->parent->left->root?->compare($node->data) === 0 && $node->parent->left->root?->compare($node->data) === 0
@ -291,6 +299,13 @@ class BinarySearchTree
} }
} }
/**
* To array
*
* @return array
*
* @since 1.0.0
*/
public function toArray() : array public function toArray() : array
{ {
return $this->root?->toArray() ?? ['key' => null, 0 => null, 1 => null]; return $this->root?->toArray() ?? ['key' => null, 0 => null, 1 => null];

View File

@ -100,6 +100,13 @@ class Node
return $this->data <=> $data; return $this->data <=> $data;
} }
/**
* To array
*
* @return array
*
* @since 1.0.0
*/
public function toArray() : array public function toArray() : array
{ {
return [ return [