fix tests

This commit is contained in:
Dennis Eichhorn 2023-10-22 11:52:44 +00:00
parent 60ccfdb242
commit 8a8ee4ed90
4 changed files with 29 additions and 4 deletions

View File

@ -60,7 +60,7 @@ final class FileLogger implements LoggerInterface
* @var bool
* @since 1.0.0
*/
protected bool $verbose = false;
public bool $verbose = false;
/**
* The file pointer for the logging.

View File

@ -454,6 +454,26 @@ final class ArrayUtils
return $squared;
}
/**
* Get a column of 2D matrix.
*
* @param array<array> $matrix Matrix
* @param mixed $index Column index to return
*
* @return array
*
* @since 1.0.0
*/
public static function column(array $matrix, mixed $index) : array
{
$column = [];
foreach ($matrix as $id => $row) {
$column[$id] = $row[$index];
}
return $column;
}
/**
* Sqrt all values in array.
*

View File

@ -27,9 +27,9 @@ final class ModelCFTest extends \PHPUnit\Framework\TestCase
{
self::assertEquals(
[
[],
[],
[],
[14.0, 12.0, 10.0],
[17.0, 11.0, 10.0],
[15.0, 15.0, 12.0],
],
ModelCF::score(
[

View File

@ -14,6 +14,8 @@ declare(strict_types=1);
namespace phpOMS\tests\DataStorage\Database;
include_once __DIR__ . '/../../Autoloader.php';
use phpOMS\DataStorage\Database\Query\OrderType;
use phpOMS\tests\DataStorage\Database\TestModel\BaseModel;
use phpOMS\tests\DataStorage\Database\TestModel\BaseModelMapper;
@ -42,10 +44,13 @@ final class DataMapperAbstractTest extends \PHPUnit\Framework\TestCase
{
$this->model = new BaseModel();
\phpOMS\Log\FileLogger::getInstance()->verbose = true;
$GLOBALS['dbpool']->get()->con->prepare(
'CREATE TABLE `test_base` (
`test_base_id` int(11) NOT NULL AUTO_INCREMENT,
`test_base_string` varchar(254) NOT NULL,
`test_base_compress` varchar(254) NOT NULL,
`test_base_pstring` varchar(254) NOT NULL,
`test_base_int` int(11) NOT NULL,
`test_base_bool` tinyint(1) DEFAULT NULL,