mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-01-11 01:38:41 +00:00
fix tests
This commit is contained in:
parent
999ec823b3
commit
ec49bf2dc1
|
|
@ -247,7 +247,7 @@ class BinarySearchTree
|
|||
}
|
||||
|
||||
$temp = null;
|
||||
if ($node->right !== null) {
|
||||
if ($node->left === null) {
|
||||
$temp = $node->right->root;
|
||||
if ($temp === null) {
|
||||
return;
|
||||
|
|
@ -272,7 +272,7 @@ class BinarySearchTree
|
|||
return;
|
||||
}
|
||||
|
||||
if ($node->left !== null) {
|
||||
if ($node->right === null) {
|
||||
$temp = $node->left->root;
|
||||
if ($temp === null) {
|
||||
return;
|
||||
|
|
@ -306,11 +306,11 @@ class BinarySearchTree
|
|||
/**
|
||||
* To array
|
||||
*
|
||||
* @return array
|
||||
* @return null|array
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function toArray() : array
|
||||
public function toArray() : ?array
|
||||
{
|
||||
return $this->root?->toArray() ?? null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -124,20 +124,20 @@ final class BinarySearchTreeTest extends \PHPUnit\Framework\TestCase
|
|||
'key' => 'O',
|
||||
0 => null,
|
||||
1 => [
|
||||
'key' => 'R',
|
||||
0 => null,
|
||||
1 => [
|
||||
'key' => 'U',
|
||||
0 => [
|
||||
'key' => 'U',
|
||||
0 => [
|
||||
'key' => 'R',
|
||||
0 => null,
|
||||
1 => [
|
||||
'key' => 'T',
|
||||
0 => null,
|
||||
1 => null
|
||||
],
|
||||
1 => [
|
||||
'key' => 'Z',
|
||||
0 => null,
|
||||
1 => null
|
||||
],
|
||||
]
|
||||
],
|
||||
1 => [
|
||||
'key' => 'Z',
|
||||
0 => null,
|
||||
1 => null
|
||||
],
|
||||
],
|
||||
],
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user