mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-02-09 05:38:39 +00:00
fix tests
This commit is contained in:
parent
1e197375c5
commit
4bed0db195
|
|
@ -297,6 +297,25 @@ class Matrix implements \ArrayAccess, \Iterator
|
||||||
return $this->matrix;
|
return $this->matrix;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get matrix as 1D array.
|
||||||
|
*
|
||||||
|
* @return array<int, int|float>
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
public function toVectorArray() : array
|
||||||
|
{
|
||||||
|
$result = [];
|
||||||
|
for ($i = 0; $i < $this->m; ++$i) {
|
||||||
|
for ($j = 0; $j < $this->n; ++$j) {
|
||||||
|
$result[] = $this->matrix[$i][$j];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is symmetric.
|
* Is symmetric.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,7 @@ final class VectorTest extends \PHPUnit\Framework\TestCase
|
||||||
{
|
{
|
||||||
self::assertEquals(
|
self::assertEquals(
|
||||||
[-15, -2, 39],
|
[-15, -2, 39],
|
||||||
Vector::fromArray([3, -3, 1])->cross3(Vector::fromArray([4, 9, 2]))->toArray()
|
Vector::fromArray([3, -3, 1])->cross3(Vector::fromArray([4, 9, 2]))->toVectorArray()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -149,8 +149,8 @@ final class RequestAbstractTest extends \PHPUnit\Framework\TestCase
|
||||||
public function testDataDateTimeInputOutput() : void
|
public function testDataDateTimeInputOutput() : void
|
||||||
{
|
{
|
||||||
$this->request->setData('asdf', '2023-01-01');
|
$this->request->setData('asdf', '2023-01-01');
|
||||||
self::assertEquals((new \DateTime('2023-01-01'))->format('Y-m-d'), $this->request->getDataDateTime('asdf'));
|
self::assertEquals((new \DateTime('2023-01-01'))->format('Y-m-d'), $this->request->getDataDateTime('asdf')->format('Y-m-d'));
|
||||||
self::assertEquals((new \DateTime('2023-01-01'))->format('Y-m-d'), $this->request->getData('asdf', 'float'));
|
self::assertEquals((new \DateTime('2023-01-01'))->format('Y-m-d'), $this->request->getData('asdf', 'DateTime')->format('Y-m-d'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testDataInvalidTypeInputOutput() : void
|
public function testDataInvalidTypeInputOutput() : void
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,7 @@ final class ResponseAbstractTest extends \PHPUnit\Framework\TestCase
|
||||||
public function testDataAllInputOutput() : void
|
public function testDataAllInputOutput() : void
|
||||||
{
|
{
|
||||||
$this->response->set('asdf', false);
|
$this->response->set('asdf', false);
|
||||||
self::assertFalse(['asdf' => false], $this->response->getData());
|
self::assertEquals(['asdf' => false], $this->response->getData());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -127,7 +127,6 @@ final class ResponseAbstractTest extends \PHPUnit\Framework\TestCase
|
||||||
{
|
{
|
||||||
$this->response->set('asdf', '[1,2,3]');
|
$this->response->set('asdf', '[1,2,3]');
|
||||||
self::assertEquals([1,2,3], $this->response->getDataJson('asdf'));
|
self::assertEquals([1,2,3], $this->response->getDataJson('asdf'));
|
||||||
self::assertEquals([1,2,3], $this->response->getData('asdf', 'json'));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user