Skip to content

Commit

Permalink
Strict Types and phpunit tests update
Browse files Browse the repository at this point in the history
  • Loading branch information
Vitexus committed Sep 14, 2024
1 parent 0846eac commit 6cd3c25
Show file tree
Hide file tree
Showing 13 changed files with 50 additions and 51 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"ext-yaml": "*",
"ext-simplexml": "*",
"vitexsoftware/ease-bootstrap4-widgets-abraflexi": "^1.1",
"vitexsoftware/ease-fluentpdo": "^1.1",
"vitexsoftware/ease-fluentpdo": "dev-main",
"vitexsoftware/ease-twbootstrap4-widgets": "^1.3",
"robmorgan/phinx": "^0.12",
"datatables/datatables": "^1.10",
Expand Down
2 changes: 1 addition & 1 deletion src/MultiFlexi/Api/ServerApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class ServerApi extends AbstractServerApi
/**
* Api Handler Engine.
*/
public \MultiFlexi\Servers $engine = null;
public \MultiFlexi\Servers $engine;

/**
* Prepare Servers engine.
Expand Down
2 changes: 1 addition & 1 deletion src/MultiFlexi/CompanyApp.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@
*/
class CompanyApp extends Engine
{
public $myTable = 'companyapp';
public ?Company $company;

/**
* @param array $options
*/
public function __construct(?Company $company = null, $options = [])
{
$this->myTable = 'companyapp';
parent::__construct(null, $options);
$this->company = $company;
}
Expand Down
2 changes: 1 addition & 1 deletion src/MultiFlexi/CompanyJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

class CompanyJob extends DBEngine implements DatabaseEngine
{
public $myTable = 'job';
public string $myTable = 'job';
public $companyId;
public $appId;

Expand Down
6 changes: 5 additions & 1 deletion src/MultiFlexi/Conffield.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@
*/
class Conffield extends \Ease\SQL\Engine
{
public string $myTable = 'conffield';
public function __construct($identifier = null, $options = [])
{
$this->myTable = 'conffield';
parent::__construct($identifier, $options);
}

public function takeData($data)
{
Expand Down
14 changes: 5 additions & 9 deletions src/MultiFlexi/Logger.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,18 @@
*/
class Logger extends DBEngine
{
public $myTable = 'log';
public string $myTable = 'log';
public $myKeyColumn = 'id';
public $createColumn = 'created';
public $modifiedColumn = 'created';
public $nameColumn = 'heading';

/**
* Search resuts targeting to here.
*/
public string $keyword = 'dbmessage';
public ?string $createColumn = 'created';
public ?string $modifiedColumn = 'created';

/**
* @param int $id
*/
public function __construct($id = null)
{
$this->nameColumn = 'heading';
$this->keyword = 'dbmessage';
parent::__construct($id);
}

Expand Down
13 changes: 9 additions & 4 deletions src/MultiFlexi/RunTemplate.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
/**
* @author vitex
*/
class RunTemplate extends Engine
class RunTemplate extends \MultiFlexi\Engine
{
/**
* @param mixed $identifier
Expand Down Expand Up @@ -104,10 +104,15 @@ public function deleteFromSQL($data = null)
public function getCompanyEnvironment()
{
$connectionData = $this->getAppInfo();
$platformHelperClass = '\\MultiFlexi\\'.$connectionData['type'].'\\Company';
$platformHelper = new $platformHelperClass($connectionData['company_id'], $connectionData);

return $platformHelper->getEnvironment();
if ($connectionData['type']) {
$platformHelperClass = '\\MultiFlexi\\'.$connectionData['type'].'\\Company';
$platformHelper = new $platformHelperClass($connectionData['company_id'], $connectionData);

return $platformHelper->getEnvironment();
}

return [];
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/MultiFlexi/Scheduler.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
*/
class Scheduler extends Engine
{
public $myTable = 'schedule';
public string $myTable = 'schedule';

/**
* Save Job excution time.
* Save Job execution time.
*/
public function addJob(Job $job, \DateTime $when)
{
Expand Down
18 changes: 8 additions & 10 deletions src/MultiFlexi/Token.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,14 @@
*/
class Token extends Engine
{
/**
* Token live here.
*/
public string $nameColumn = 'token';

/**
* We work with table token.
*/
public string $myTable = 'token';
public $createColumn = 'start';

public function __construct($identifier = null, $options = []) {
$this->nameColumn = 'token';
$this->myTable = 'token';
$this->createColumn = 'start';
parent::__construct($identifier, $options);
}

/**
* @return \MultiFlexi\User
*/
Expand Down
6 changes: 3 additions & 3 deletions src/MultiFlexi/Ui/AppsMenu.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
*/
class AppsMenu extends MainPageMenu
{
public Application $apper = null;
public Application $apper;

/**
* Application Status Menu.
Expand All @@ -41,9 +41,9 @@ public function __construct()
}

/**
* Add Appliaction card.
* Add Application card.
*
* @param int $id appliaction ID
* @param int $id application ID
* @param string $nazev
* @param string $popis
* @param string $executable
Expand Down
11 changes: 4 additions & 7 deletions src/MultiFlexi/Ui/ColumnsForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,18 @@ class ColumnsForm extends Form
/**
* Řádek.
*/
public Row $row = null;
public Row $row;

/**
* Počet položek na řádek.
*/
public int $itemsPerRow = 3;
public SysEngine $engine = null;
public SysEngine $engine;

/**
* Odesílací tlačítka.
*/
public \Ease\Html\Div $savers = null;
public \Ease\Html\Div $savers;

/**
* Formulář Bootstrapu.
Expand All @@ -66,10 +66,7 @@ public function __construct(
$tagProperties['name'] = \get_class($engine);
parent::__construct($tagProperties, [], $formContents);
$this->newRow();
$this->savers = new DivTag(
null,
['style' => 'text-align: right'],
);
$this->savers = new DivTag(null,['style' => 'text-align: right'],);
}

/**
Expand Down
4 changes: 3 additions & 1 deletion tests/src/MultiFlexi/RunTemplateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ class RunTemplateTest extends \PHPUnit\Framework\TestCase
*/
protected function setUp(): void
{
$this->object = new RunTemplate();
$rt = new RunTemplate();
$rtid = $rt->listingQuery()->limit(1)->fetch('id');
$this->object = new RunTemplate($rtid);
}

/**
Expand Down
17 changes: 7 additions & 10 deletions tests/src/MultiFlexi/SchedulerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,34 +20,32 @@
/**
* Generated by PHPUnit_SkeletonGenerator on 2023-11-07 at 13:03:33.
*/
class SchedulerTest extends \PHPUnit\Framework\TestCase
{
class SchedulerTest extends \PHPUnit\Framework\TestCase {

protected Scheduler $object;

/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*/
protected function setUp(): void
{
protected function setUp(): void {
$this->object = new Scheduler();
}

/**
* Tears down the fixture, for example, closes a network connection.
* This method is called after a test is executed.
*/
protected function tearDown(): void
{
protected function tearDown(): void {
}

/**
* @covers \MultiFlexi\Scheduler::addJob
*
* @todo Implement testaddJob().
*/
public function testaddJob(): void
{
public function testaddJob(): void {
$this->assertEquals('', $this->object->addJob());
// Remove the following lines when you implement this test.
$this->markTestIncomplete('This test has not been implemented yet.');
Expand All @@ -58,8 +56,7 @@ public function testaddJob(): void
*
* @todo Implement testgetCurrentJobs().
*/
public function testgetCurrentJobs(): void
{
public function testgetCurrentJobs(): void {
$this->assertEquals('', $this->object->getCurrentJobs());
// Remove the following lines when you implement this test.
$this->markTestIncomplete('This test has not been implemented yet.');
Expand Down

0 comments on commit 6cd3c25

Please sign in to comment.