mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-01-11 09:48:40 +00:00
test fixes
This commit is contained in:
parent
5876d88901
commit
44098e33d2
|
|
@ -129,14 +129,14 @@ class SQLiteGrammar extends Grammar
|
|||
$fieldQuery .= ' ' . ($field['null'] ? '' : 'NOT ') . 'NULL';
|
||||
}
|
||||
|
||||
if ($field['primary'] ?? false) {
|
||||
$keys .= ' PRIMARY KEY';
|
||||
}
|
||||
|
||||
if ($field['autoincrement'] ?? false) {
|
||||
$fieldQuery .= ' AUTOINCREMENT';
|
||||
}
|
||||
|
||||
if ($field['primary'] ?? false) {
|
||||
$fieldQuery .= ' PRIMARY KEY';
|
||||
}
|
||||
|
||||
$fieldQuery .= ',';
|
||||
|
||||
if ($field['unique'] ?? false) {
|
||||
|
|
|
|||
|
|
@ -853,20 +853,17 @@ class Matrix implements \ArrayAccess, \Iterator
|
|||
throw new InvalidDimensionException($this->m . 'x' . $this->n);
|
||||
}
|
||||
|
||||
$sum = new IdentityMatrix($this->m);
|
||||
$eig = new EigenvalueDecomposition($this);
|
||||
$v = $eig->getV();
|
||||
$d = $eig->getD();
|
||||
|
||||
$factorial = 1;
|
||||
$pow = clone $sum;
|
||||
$vInv = $v->inverse();
|
||||
|
||||
for ($i = 1; $i <= $iterations; ++$i) {
|
||||
$factorial *= $i;
|
||||
$coeff = 1 / $factorial;
|
||||
|
||||
$pow = $pow->mult($this);
|
||||
$sum = $sum->add($pow->mult($coeff));
|
||||
for ($i = 0; $d->m; ++$i) {
|
||||
$d->matrix[$i][$i] = \exp($d->matrix[$i][$i]);
|
||||
}
|
||||
|
||||
return $sum;
|
||||
return $v->mult($d)->mult($vInv);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ final class SocketRouter implements RouterInterface
|
|||
{
|
||||
$bound = [];
|
||||
foreach ($this->routes as $route => $destination) {
|
||||
if (!((bool) \preg_match('~^' . $route . '$~', $uri))) {
|
||||
if (!((bool) \preg_match('~' . $route . '~', $uri))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ final class WebRouter implements RouterInterface
|
|||
{
|
||||
$bound = [];
|
||||
foreach ($this->routes as $route => $destination) {
|
||||
if (!((bool) \preg_match('~^' . $route . '$~', $uri))) {
|
||||
if (!((bool) \preg_match('~' . $route . '~', $uri))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ class ClientConnection
|
|||
|
||||
private $connected = true;
|
||||
|
||||
private Account $account;
|
||||
public Account $account;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
|
|
|
|||
|
|
@ -108,9 +108,9 @@ class Server extends SocketAbstract
|
|||
*/
|
||||
public function create(string $ip, int $port) : void
|
||||
{
|
||||
$this->app->logger->info('Creating socket...');
|
||||
$this->app->logger?->info('Creating socket...');
|
||||
parent::create($ip, $port);
|
||||
$this->app->logger->info('Binding socket...');
|
||||
$this->app->logger?->info('Binding socket...');
|
||||
\socket_bind($this->sock, $this->ip, $this->port);
|
||||
}
|
||||
|
||||
|
|
@ -190,12 +190,12 @@ class Server extends SocketAbstract
|
|||
*/
|
||||
public function run() : void
|
||||
{
|
||||
$this->app->logger->info('Start listening...');
|
||||
$this->app->logger?->info('Start listening...');
|
||||
@\socket_listen($this->sock);
|
||||
@\socket_set_nonblock($this->sock);
|
||||
$this->conn[] = $this->sock;
|
||||
|
||||
$this->app->logger->info('Is running...');
|
||||
$this->app->logger?->info('Is running...');
|
||||
while ($this->run) {
|
||||
$read = $this->conn;
|
||||
|
||||
|
|
@ -225,12 +225,12 @@ class Server extends SocketAbstract
|
|||
$data = \is_string($data) ? \trim($data) : '';
|
||||
|
||||
if (!$client->getHandshake()) {
|
||||
$this->app->logger->debug('Doing handshake...');
|
||||
$this->app->logger?->debug('Doing handshake...');
|
||||
if ($this->handshake($client, $data)) {
|
||||
$client->setHandshake(true);
|
||||
$this->app->logger->debug('Handshake succeeded.');
|
||||
$this->app->logger?->debug('Handshake succeeded.');
|
||||
} else {
|
||||
$this->app->logger->debug('Handshake failed.');
|
||||
$this->app->logger?->debug('Handshake failed.');
|
||||
$this->disconnectClient($client);
|
||||
}
|
||||
} else {
|
||||
|
|
@ -239,7 +239,7 @@ class Server extends SocketAbstract
|
|||
}
|
||||
}
|
||||
}
|
||||
$this->app->logger->info('Is shutdown...');
|
||||
$this->app->logger?->info('Is shutdown...');
|
||||
|
||||
$this->close();
|
||||
}
|
||||
|
|
@ -272,13 +272,13 @@ class Server extends SocketAbstract
|
|||
*/
|
||||
public function connectClient($socket) : void
|
||||
{
|
||||
$this->app->logger->debug('Connecting client...');
|
||||
$this->app->logger?->debug('Connecting client...');
|
||||
$this->app->accountManager->add(new NullAccount(1));
|
||||
$this->clientManager->add($client = new ClientConnection(new NullAccount(1), $socket));
|
||||
|
||||
$this->conn[$client->getId()] = $socket;
|
||||
|
||||
$this->app->logger->debug('Connected client.');
|
||||
$this->app->logger?->debug('Connected client.');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -292,7 +292,7 @@ class Server extends SocketAbstract
|
|||
*/
|
||||
public function disconnectClient($client) : void
|
||||
{
|
||||
$this->app->logger->debug('Disconnecting client...');
|
||||
$this->app->logger?->debug('Disconnecting client...');
|
||||
$client->setConnected(false);
|
||||
$client->setHandshake(false);
|
||||
\socket_shutdown($client->getSocket(), 2);
|
||||
|
|
@ -303,7 +303,7 @@ class Server extends SocketAbstract
|
|||
}
|
||||
|
||||
$this->clientManager->remove($client->id);
|
||||
$this->app->logger->debug('Disconnected client.');
|
||||
$this->app->logger?->debug('Disconnected client.');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -517,7 +517,7 @@ class File extends FileAbstract implements FileInterface
|
|||
return false;
|
||||
}
|
||||
|
||||
$newParent = $this->findNode($to);
|
||||
$newParent = $this->findNode(\dirname($to));
|
||||
|
||||
$state = self::copy($this->con, $this->path, $to, $overwrite);
|
||||
|
||||
|
|
|
|||
|
|
@ -238,11 +238,11 @@ abstract class FileAbstract implements FtpContainerInterface
|
|||
*
|
||||
* @param string $path Path of the node
|
||||
*
|
||||
* @return null|Directory
|
||||
* @return null|Directory|File
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function findNode(string $path) : ?Directory
|
||||
public function findNode(string $path) : null|Directory|File
|
||||
{
|
||||
// Change parent element
|
||||
$currentPath = \explode('/', \trim($this->path, '/'));
|
||||
|
|
|
|||
|
|
@ -491,7 +491,7 @@ final class File extends FileAbstract implements FileInterface
|
|||
*/
|
||||
public function copyNode(string $to, bool $overwrite = false) : bool
|
||||
{
|
||||
$newParent = $this->findNode($to);
|
||||
$newParent = $this->findNode(\dirname($to));
|
||||
|
||||
$state = self::copy($this->path, $to, $overwrite);
|
||||
|
||||
|
|
|
|||
|
|
@ -269,11 +269,11 @@ abstract class FileAbstract implements LocalContainerInterface
|
|||
*
|
||||
* @param string $path Path of the node
|
||||
*
|
||||
* @return null|Directory
|
||||
* @return null|Directory|File
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function findNode(string $path) : ?Directory
|
||||
public function findNode(string $path) : null|Directory|File
|
||||
{
|
||||
// Change parent element
|
||||
$currentPath = \explode('/', \trim($this->path, '/'));
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ final class TesseractOcrTest extends \PHPUnit\Framework\TestCase
|
|||
{
|
||||
$this->expectException(PathException::class);
|
||||
|
||||
$ocr = new TesseractOcr('/invalid/path');
|
||||
TesseractOcr::setBin('/invalid/path');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ final class BuilderTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertEquals($sql, $query->select('a.test')->from('a')->where('a.test', '=', 1)->toSql());
|
||||
|
||||
$query = new Builder($con);
|
||||
$sql = 'SELECT [a].[test] as t FROM [a] as b WHERE [a].[test] = 1;';
|
||||
$sql = 'SELECT [a].[test] AS t FROM [a] AS b WHERE [a].[test] = 1;';
|
||||
$sql = \strtr($sql, '[]', $iS . $iE);
|
||||
self::assertEquals($sql, $query->selectAs('a.test', 't')->fromAs('a', 'b')->where('a.test', '=', 1)->toSql());
|
||||
|
||||
|
|
@ -121,7 +121,7 @@ final class BuilderTest extends \PHPUnit\Framework\TestCase
|
|||
$iE = $con->getGrammar()->systemIdentifierEnd;
|
||||
|
||||
$query = new Builder($con);
|
||||
$sql = 'SELECT [a].[test] FROM [a] as b WHERE [a].[test] = 1 ORDER BY RAND() LIMIT 1;';
|
||||
$sql = 'SELECT [a].[test] FROM [a] AS b WHERE [a].[test] = 1 ORDER BY RAND() LIMIT 1;';
|
||||
$sql = \strtr($sql, '[]', $iS . $iE);
|
||||
self::assertEquals($sql, $query->random('a.test')->fromAs('a', 'b')->where('a.test', '=', 1)->toSql());
|
||||
}
|
||||
|
|
@ -134,7 +134,7 @@ final class BuilderTest extends \PHPUnit\Framework\TestCase
|
|||
$iE = $con->getGrammar()->systemIdentifierEnd;
|
||||
|
||||
$query = new Builder($con);
|
||||
$sql = 'SELECT [a].[test] FROM [a] as b ORDER BY RANDOM() LIMIT 1;';
|
||||
$sql = 'SELECT [a].[test] FROM [a] AS b ORDER BY RANDOM() LIMIT 1;';
|
||||
$sql = \strtr($sql, '[]', $iS . $iE);
|
||||
self::assertEquals($sql, $query->random('a.test')->fromAs('a', 'b')->where('a.test', '=', 1)->toSql());
|
||||
}
|
||||
|
|
@ -147,7 +147,7 @@ final class BuilderTest extends \PHPUnit\Framework\TestCase
|
|||
$iE = $con->getGrammar()->systemIdentifierEnd;
|
||||
|
||||
$query = new Builder($con);
|
||||
$sql = 'SELECT [a].[test] FROM [a] as b ORDER BY RANDOM() LIMIT 1;';
|
||||
$sql = 'SELECT [a].[test] FROM [a] AS b ORDER BY RANDOM() LIMIT 1;';
|
||||
$sql = \strtr($sql, '[]', $iS . $iE);
|
||||
self::assertEquals($sql, $query->random('a.test')->fromAs('a', 'b')->where('a.test', '=', 1)->toSql());
|
||||
}
|
||||
|
|
@ -160,7 +160,7 @@ final class BuilderTest extends \PHPUnit\Framework\TestCase
|
|||
$iE = $con->getGrammar()->systemIdentifierEnd;
|
||||
|
||||
$query = new Builder($con);
|
||||
$sql = 'SELECT TOP 1 [a].[test] FROM [a] as b ORDER BY IDX FETCH FIRST 1 ROWS ONLY;';
|
||||
$sql = 'SELECT TOP 1 [a].[test] FROM [a] AS b ORDER BY IDX FETCH FIRST 1 ROWS ONLY;';
|
||||
$sql = \strtr($sql, '[]', $iS . $iE);
|
||||
self::assertEquals($sql, $query->random('a.test')->fromAs('a', 'b')->where('a.test', '=', 1)->toSql());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -180,7 +180,7 @@ final class BuilderTest extends \PHPUnit\Framework\TestCase
|
|||
} elseif ($con instanceof SqlServerConnection) {
|
||||
$sql = 'CREATE TABLE IF NOT EXISTS [user_roles] ([user_id] INT AUTO_INCREMENT, [role_id] VARCHAR(10) DEFAULT \'1\' NULL, PRIMARY KEY ([user_id]), FOREIGN KEY ([user_id]) REFERENCES [users] ([ext1_id]), FOREIGN KEY ([role_id]) REFERENCES [roles] ([ext2_id]));';
|
||||
} elseif ($con instanceof SQLiteConnection) {
|
||||
$sql = 'CREATE TABLE [user_roles] ([user_id] INTEGER PRIMARY KEY AUTOINCREMENT, [role_id] TEXT DEFAULT \'1\' NULL, PRIMARY KEY ([user_id]), FOREIGN KEY ([user_id]) REFERENCES [users] ([ext1_id]), FOREIGN KEY ([role_id]) REFERENCES [roles] ([ext2_id]));';
|
||||
$sql = 'CREATE TABLE [user_roles] ([user_id] INTEGER AUTOINCREMENT PRIMARY KEY, [role_id] TEXT DEFAULT \'1\' NULL, FOREIGN KEY ([user_id]) REFERENCES [users] ([ext1_id]), FOREIGN KEY ([role_id]) REFERENCES [roles] ([ext2_id]));';
|
||||
}
|
||||
|
||||
$sql = \strtr($sql, '[]', $iS . $iE);
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ final class SocketRouterTest extends \PHPUnit\Framework\TestCase
|
|||
*/
|
||||
public function testDynamicRouteAdding() : void
|
||||
{
|
||||
$this->router->add('^.*backends_admin -settings=general(\?.*$|$)', 'Controller:test');
|
||||
$this->router->add('^.*backends_admin -settings=general( \-.*$|$)', 'Controller:test');
|
||||
self::assertEquals(
|
||||
[['dest' => 'Controller:test']],
|
||||
$this->router->route('backends_admin -settings=general -t 123')
|
||||
|
|
@ -219,7 +219,7 @@ final class SocketRouterTest extends \PHPUnit\Framework\TestCase
|
|||
public function testDataValidation() : void
|
||||
{
|
||||
$this->router->add(
|
||||
'^.*backends_admin -settings=general(\?.*$|$)',
|
||||
'^.*backends_admin -settings=general( \-.*$|$)',
|
||||
'Controller:test',
|
||||
validation: ['test_pattern' => '/^[a-z]*$/']
|
||||
);
|
||||
|
|
@ -238,7 +238,7 @@ final class SocketRouterTest extends \PHPUnit\Framework\TestCase
|
|||
public function testInvalidDataValidation() : void
|
||||
{
|
||||
$this->router->add(
|
||||
'^.*backends_admin -settings=general(\?.*$|$)',
|
||||
'^.*backends_admin -settings=general( \-.*$|$)',
|
||||
'Controller:test',
|
||||
validation: ['test_pattern' => '/^[a-z]*$/']
|
||||
);
|
||||
|
|
@ -257,7 +257,7 @@ final class SocketRouterTest extends \PHPUnit\Framework\TestCase
|
|||
public function testDataFromPattern() : void
|
||||
{
|
||||
$this->router->add(
|
||||
'^.*-settings=general(\?.*$|$)',
|
||||
'^.*-settings=general( \-.*$|$)',
|
||||
'Controller:test',
|
||||
dataPattern: '/^.*?(settings)=([a-z]*).*?$/'
|
||||
);
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ final class WebRouterTest extends \PHPUnit\Framework\TestCase
|
|||
[['dest' => '\Modules\Admin\Controller:viewSettingsGeneral']],
|
||||
$this->router->route(
|
||||
(new HttpRequest(
|
||||
new HttpUri('http://test.com/backend/admin/settings/general/something?test')
|
||||
new HttpUri('http://test.com/backend/admin/settings/general?test')
|
||||
))->uri->getRoute()
|
||||
)
|
||||
);
|
||||
|
|
@ -111,7 +111,7 @@ final class WebRouterTest extends \PHPUnit\Framework\TestCase
|
|||
[],
|
||||
$this->router->route(
|
||||
(new HttpRequest(
|
||||
new HttpUri('http://test.com/backend/admin/settings/general/something?test')
|
||||
new HttpUri('http://test.com/backend/admin/settings/general?test')
|
||||
))->uri->getRoute()
|
||||
)
|
||||
);
|
||||
|
|
@ -130,7 +130,7 @@ final class WebRouterTest extends \PHPUnit\Framework\TestCase
|
|||
[['dest' => '\Modules\Admin\Controller:viewSettingsGeneral']],
|
||||
$this->router->route(
|
||||
(new HttpRequest(
|
||||
new HttpUri('http://test.com/backend/admin/settings/general/something?test')
|
||||
new HttpUri('http://test.com/backend/admin/settings/general?test')
|
||||
))->uri->getRoute(), null, RouteVerb::PUT)
|
||||
);
|
||||
}
|
||||
|
|
@ -147,7 +147,7 @@ final class WebRouterTest extends \PHPUnit\Framework\TestCase
|
|||
[['dest' => 'Controller:test']],
|
||||
$this->router->route(
|
||||
(new HttpRequest(
|
||||
new HttpUri('http://test.com/backends/admin/settings/general/something?test')
|
||||
new HttpUri('http://test.com/backends/admin/settings/general?test')
|
||||
))->uri->getRoute(), null, RouteVerb::ANY)
|
||||
);
|
||||
|
||||
|
|
@ -155,7 +155,7 @@ final class WebRouterTest extends \PHPUnit\Framework\TestCase
|
|||
[['dest' => 'Controller:test']],
|
||||
$this->router->route(
|
||||
(new HttpRequest(
|
||||
new HttpUri('http://test.com/backends/admin/settings/general/something?test')
|
||||
new HttpUri('http://test.com/backends/admin/settings/general?test')
|
||||
))->uri->getRoute(), null, RouteVerb::SET)
|
||||
);
|
||||
|
||||
|
|
@ -163,7 +163,7 @@ final class WebRouterTest extends \PHPUnit\Framework\TestCase
|
|||
[['dest' => 'Controller:test']],
|
||||
$this->router->route(
|
||||
(new HttpRequest(
|
||||
new HttpUri('http://test.com/backends/admin/settings/general/something?test')))->uri->getRoute(), null, RouteVerb::GET)
|
||||
new HttpUri('http://test.com/backends/admin/settings/general?test')))->uri->getRoute(), null, RouteVerb::GET)
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -236,7 +236,7 @@ final class WebRouterTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertEquals(
|
||||
[['dest' => '\Modules\Admin\Controller:viewSettingsGeneral']],
|
||||
$this->router->route(
|
||||
(new HttpRequest(new HttpUri('http://test.com/backend/admin/settings/general/something?test')))->uri->getRoute(),
|
||||
(new HttpRequest(new HttpUri('http://test.com/backend/admin/settings/general?test')))->uri->getRoute(),
|
||||
null,
|
||||
RouteVerb::GET,
|
||||
null,
|
||||
|
|
@ -300,7 +300,7 @@ final class WebRouterTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertNotEquals(
|
||||
[['dest' => '\Modules\Admin\Controller:viewSettingsGeneral']],
|
||||
$this->router->route(
|
||||
(new HttpRequest(new HttpUri('http://test.com/backend/admin/settings/general/something?test')))->uri->getRoute(),
|
||||
(new HttpRequest(new HttpUri('http://test.com/backend/admin/settings/general?test')))->uri->getRoute(),
|
||||
null,
|
||||
RouteVerb::GET,
|
||||
null,
|
||||
|
|
@ -329,7 +329,7 @@ final class WebRouterTest extends \PHPUnit\Framework\TestCase
|
|||
[['dest' => 'Controller:test']],
|
||||
$this->router->route(
|
||||
(new HttpRequest(
|
||||
new HttpUri('http://test.com/backends/admin/settings/general/something?test')
|
||||
new HttpUri('http://test.com/backends/admin/settings/general?test')
|
||||
))->uri->getRoute(), null, RouteVerb::ANY, null, null, null, ['test_pattern' => 'abcdef'])
|
||||
);
|
||||
}
|
||||
|
|
@ -353,7 +353,7 @@ final class WebRouterTest extends \PHPUnit\Framework\TestCase
|
|||
[['dest' => 'Controller:test']],
|
||||
$this->router->route(
|
||||
(new HttpRequest(
|
||||
new HttpUri('http://test.com/backends/admin/settings/general/something?test')
|
||||
new HttpUri('http://test.com/backends/admin/settings/general?test')
|
||||
))->uri->getRoute(), null, RouteVerb::ANY, null, null, null, ['test_pattern' => '123'])
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
declare(strict_types=1);
|
||||
return [
|
||||
'^.*backend_admin -settings=general(\?.*$|$)' => [
|
||||
'^.*backend_admin -settings=general( \-.*$|$)' => [
|
||||
0 => [
|
||||
'dest' => '\Modules\Admin\Controller:viewSettingsGeneral',
|
||||
],
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ declare(strict_types=1);
|
|||
use phpOMS\Account\PermissionType;
|
||||
|
||||
return [
|
||||
'^.*backend_admin -settings=general(\?.*$|$)' => [
|
||||
'^.*backend_admin -settings=general( \-.*$|$)' => [
|
||||
0 => [
|
||||
'dest' => '\Modules\Admin\Controller:viewSettingsGeneral',
|
||||
'permission' => [
|
||||
|
|
|
|||
|
|
@ -42,22 +42,19 @@ final class AddressTest extends \PHPUnit\Framework\TestCase
|
|||
public function testDefault() : void
|
||||
{
|
||||
$expected = [
|
||||
'recipient' => '',
|
||||
'fao' => '',
|
||||
'location' => [
|
||||
'postal' => '',
|
||||
'city' => '',
|
||||
'country' => 'XX',
|
||||
'address' => '',
|
||||
'state' => '',
|
||||
'lat' => 0.0,
|
||||
'lon' => 0.0,
|
||||
],
|
||||
'name' => '',
|
||||
'postal' => '',
|
||||
'city' => '',
|
||||
'country' => 'XX',
|
||||
'address' => '',
|
||||
'state' => '',
|
||||
'lat' => 0.0,
|
||||
'lon' => 0.0,
|
||||
];
|
||||
|
||||
self::assertEquals('', $this->address->recipient);
|
||||
self::assertEquals('', $this->address->fao);
|
||||
self::assertInstanceOf('\phpOMS\Stdlib\Base\Location', $this->address->location);
|
||||
self::assertInstanceOf('\phpOMS\Stdlib\Base\Location', $this->address);
|
||||
self::assertEquals($expected, $this->address->toArray());
|
||||
self::assertEquals($expected, $this->address->jsonSerialize());
|
||||
}
|
||||
|
|
@ -73,29 +70,6 @@ final class AddressTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertEquals('fao', $this->address->fao);
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox The recipient can be set and returned
|
||||
* @covers phpOMS\Stdlib\Base\Address
|
||||
* @group framework
|
||||
*/
|
||||
public function testRecipientInputOutput() : void
|
||||
{
|
||||
$this->address->recipient = 'recipient';
|
||||
self::assertEquals('recipient', $this->address->recipient);
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox The location can be set and returned
|
||||
* @covers phpOMS\Stdlib\Base\Address
|
||||
* @group framework
|
||||
*/
|
||||
public function testLocationInputOutput() : void
|
||||
{
|
||||
$this->address->location = new Location();
|
||||
|
||||
self::assertInstanceOf('\phpOMS\Stdlib\Base\Location', $this->address->location);
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox The address can be turned into array data
|
||||
* @covers phpOMS\Stdlib\Base\Address
|
||||
|
|
@ -104,22 +78,18 @@ final class AddressTest extends \PHPUnit\Framework\TestCase
|
|||
public function testArray() : void
|
||||
{
|
||||
$expected = [
|
||||
'recipient' => 'recipient',
|
||||
'fao' => 'fao',
|
||||
'location' => [
|
||||
'postal' => '',
|
||||
'city' => '',
|
||||
'country' => 'XX',
|
||||
'address' => '',
|
||||
'state' => '',
|
||||
'lat' => 0.0,
|
||||
'lon' => 0.0,
|
||||
],
|
||||
'name' => '',
|
||||
'postal' => '',
|
||||
'city' => '',
|
||||
'country' => 'XX',
|
||||
'address' => '',
|
||||
'state' => '',
|
||||
'lat' => 0.0,
|
||||
'lon' => 0.0,
|
||||
];
|
||||
|
||||
$this->address->fao = 'fao';
|
||||
$this->address->recipient = 'recipient';
|
||||
$this->address->location = new Location();
|
||||
|
||||
self::assertEquals($expected, $this->address->toArray());
|
||||
}
|
||||
|
|
@ -132,22 +102,18 @@ final class AddressTest extends \PHPUnit\Framework\TestCase
|
|||
public function testJsonSerialize() : void
|
||||
{
|
||||
$expected = [
|
||||
'recipient' => 'recipient',
|
||||
'fao' => 'fao',
|
||||
'location' => [
|
||||
'postal' => '',
|
||||
'city' => '',
|
||||
'country' => 'XX',
|
||||
'address' => '',
|
||||
'state' => '',
|
||||
'lat' => 0.0,
|
||||
'lon' => 0.0,
|
||||
],
|
||||
'name' => '',
|
||||
'postal' => '',
|
||||
'city' => '',
|
||||
'country' => 'XX',
|
||||
'address' => '',
|
||||
'state' => '',
|
||||
'lat' => 0.0,
|
||||
'lon' => 0.0,
|
||||
];
|
||||
|
||||
$this->address->fao = 'fao';
|
||||
$this->address->recipient = 'recipient';
|
||||
$this->address->location = new Location();
|
||||
|
||||
self::assertEquals($expected, $this->address->jsonSerialize());
|
||||
}
|
||||
|
|
|
|||
BIN
tests/Utils/Parser/Document/data/WordMpdf.pdf
Normal file
BIN
tests/Utils/Parser/Document/data/WordMpdf.pdf
Normal file
Binary file not shown.
|
|
@ -1,2 +1,2 @@
|
|||
```chart
|
||||
```chartjs
|
||||
```
|
||||
BIN
tests/Utils/Parser/Spreadsheet/data/ExcelMpdf.pdf
Normal file
BIN
tests/Utils/Parser/Spreadsheet/data/ExcelMpdf.pdf
Normal file
Binary file not shown.
|
|
@ -193,7 +193,7 @@ final class StringUtilsTest extends \PHPUnit\Framework\TestCase
|
|||
);
|
||||
|
||||
self::assertEquals(
|
||||
'This is a <del>test</del><ins>new</ins> string.',
|
||||
'This is a <del>test</del> <ins>new</ins> string.',
|
||||
StringUtils::createDiffMarkup($original, $new, ' ')
|
||||
);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user