mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-02-13 23:28:39 +00:00
Further php cs fixes
This commit is contained in:
parent
c2c9767470
commit
51cd98b1a7
|
|
@ -14,7 +14,7 @@ declare(strict_types = 1);
|
||||||
|
|
||||||
namespace phpOMS;
|
namespace phpOMS;
|
||||||
|
|
||||||
spl_autoload_register('\phpOMS\Autoloader::default_autoloader');
|
spl_autoload_register('\phpOMS\Autoloader::defaultAutoloader');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Autoloader class.
|
* Autoloader class.
|
||||||
|
|
@ -32,7 +32,7 @@ class Autoloader
|
||||||
*
|
*
|
||||||
* @param string $class Class path
|
* @param string $class Class path
|
||||||
*
|
*
|
||||||
* @example Autoloader::default_autoloader('\phpOMS\Autoloader') // void
|
* @example Autoloader::defaultAutoloader('\phpOMS\Autoloader') // void
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*
|
*
|
||||||
|
|
@ -40,7 +40,7 @@ class Autoloader
|
||||||
*
|
*
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
public static function default_autoloader(string $class) /* : void */
|
public static function defaultAutoloader(string $class) /* : void */
|
||||||
{
|
{
|
||||||
$class = ltrim($class, '\\');
|
$class = ltrim($class, '\\');
|
||||||
$class = str_replace(['_', '\\'], '/', $class);
|
$class = str_replace(['_', '\\'], '/', $class);
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,8 @@ require_once __DIR__ . '/../Autoloader.php';
|
||||||
class AccountManagerTest extends \PHPUnit\Framework\TestCase
|
class AccountManagerTest extends \PHPUnit\Framework\TestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
public function testAttributes() {
|
public function testAttributes()
|
||||||
|
{
|
||||||
$manager = new AccountManager($GLOBALS['httpSession']);
|
$manager = new AccountManager($GLOBALS['httpSession']);
|
||||||
self::assertInstanceOf('\phpOMS\Account\AccountManager', $manager);
|
self::assertInstanceOf('\phpOMS\Account\AccountManager', $manager);
|
||||||
|
|
||||||
|
|
@ -32,7 +33,8 @@ class AccountManagerTest extends \PHPUnit\Framework\TestCase
|
||||||
self::assertObjectHasAttribute('accounts', $manager);
|
self::assertObjectHasAttribute('accounts', $manager);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testDefault() {
|
public function testDefault()
|
||||||
|
{
|
||||||
$manager = new AccountManager($GLOBALS['httpSession']);
|
$manager = new AccountManager($GLOBALS['httpSession']);
|
||||||
|
|
||||||
self::assertEquals(0, $manager->count());
|
self::assertEquals(0, $manager->count());
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,8 @@ require_once __DIR__ . '/../Autoloader.php';
|
||||||
|
|
||||||
class GroupTest extends \PHPUnit\Framework\TestCase
|
class GroupTest extends \PHPUnit\Framework\TestCase
|
||||||
{
|
{
|
||||||
public function testAttributes() {
|
public function testAttributes()
|
||||||
|
{
|
||||||
$group = new Group();
|
$group = new Group();
|
||||||
self::assertInstanceOf('\phpOMS\Account\Group', $group);
|
self::assertInstanceOf('\phpOMS\Account\Group', $group);
|
||||||
|
|
||||||
|
|
@ -34,7 +35,8 @@ class GroupTest extends \PHPUnit\Framework\TestCase
|
||||||
self::assertObjectHasAttribute('status', $group);
|
self::assertObjectHasAttribute('status', $group);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testDefault() {
|
public function testDefault()
|
||||||
|
{
|
||||||
$group = new Group();
|
$group = new Group();
|
||||||
|
|
||||||
/* Testing default values */
|
/* Testing default values */
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ declare(strict_types = 1);
|
||||||
|
|
||||||
namespace Tests\PHPUnit;
|
namespace Tests\PHPUnit;
|
||||||
|
|
||||||
spl_autoload_register('\Tests\PHPUnit\Autoloader::default_autoloader');
|
spl_autoload_register('\Tests\PHPUnit\Autoloader::defaultAutoloader');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Autoloader class.
|
* Autoloader class.
|
||||||
|
|
@ -32,7 +32,7 @@ class Autoloader
|
||||||
*
|
*
|
||||||
* @param string $class Class path
|
* @param string $class Class path
|
||||||
*
|
*
|
||||||
* @example Autoloader::default_autoloader('\Tests\PHPUnit\Autoloader') // void
|
* @example Autoloader::defaultAutoloader('\Tests\PHPUnit\Autoloader') // void
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*
|
*
|
||||||
|
|
@ -40,7 +40,7 @@ class Autoloader
|
||||||
*
|
*
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
public static function default_autoloader(string $class) /* : void */
|
public static function defaultAutoloader(string $class) /* : void */
|
||||||
{
|
{
|
||||||
$class = ltrim($class, '\\');
|
$class = ltrim($class, '\\');
|
||||||
$class = str_replace(['_', '\\'], '/', $class);
|
$class = str_replace(['_', '\\'], '/', $class);
|
||||||
|
|
|
||||||
|
|
@ -61,15 +61,20 @@ class BaseModel
|
||||||
$this->belongsToOne = new BelongsToModel();
|
$this->belongsToOne = new BelongsToModel();
|
||||||
|
|
||||||
$this->serializable = new class implements \Serializable {
|
$this->serializable = new class implements \Serializable {
|
||||||
public function serialize() {
|
public function serialize()
|
||||||
|
{
|
||||||
return '123';
|
return '123';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function unserialize($data) {}
|
public function unserialize($data)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
$this->jsonSerializable = new class implements \JsonSerializable {
|
$this->jsonSerializable = new class implements \JsonSerializable {
|
||||||
public function jsonSerialize() {
|
public function jsonSerialize()
|
||||||
|
{
|
||||||
return [1, 2, 3];
|
return [1, 2, 3];
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,14 @@ class InfoManagerTest extends \PHPUnit\Framework\TestCase
|
||||||
$info = new InfoManager(__Dir__ . '/info-test.json');
|
$info = new InfoManager(__Dir__ . '/info-test.json');
|
||||||
$info->load();
|
$info->load();
|
||||||
|
|
||||||
$testObj = new class { public $test = 1; public function test() { echo $this->test; }};
|
$testObj = new class {
|
||||||
|
public $test = 1;
|
||||||
|
|
||||||
|
public function test()
|
||||||
|
{
|
||||||
|
echo $this->test;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
$info->set('/name/internal', $testObj);
|
$info->set('/name/internal', $testObj);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
24
tests/Stdlib/Base/EnumArrayDemo.php
Normal file
24
tests/Stdlib/Base/EnumArrayDemo.php
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Orange Management
|
||||||
|
*
|
||||||
|
* PHP Version 7.1
|
||||||
|
*
|
||||||
|
* @package TBD
|
||||||
|
* @copyright Dennis Eichhorn
|
||||||
|
* @license OMS License 1.0
|
||||||
|
* @version 1.0.0
|
||||||
|
* @link http://website.orange-management.de
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace phpOMS\tests\Stdlib\Base;
|
||||||
|
|
||||||
|
use phpOMS\Stdlib\Base\EnumArray;
|
||||||
|
|
||||||
|
final class EnumArrayDemo extends EnumArray
|
||||||
|
{
|
||||||
|
protected static $constants = [
|
||||||
|
'ENUM1' => 1,
|
||||||
|
'ENUM2' => 'abc',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
@ -15,16 +15,6 @@ namespace phpOMS\tests\Stdlib\Base;
|
||||||
|
|
||||||
use phpOMS\Stdlib\Base\EnumArray;
|
use phpOMS\Stdlib\Base\EnumArray;
|
||||||
|
|
||||||
final class EnumArrayDemo extends EnumArray
|
|
||||||
{
|
|
||||||
protected static $constants = [
|
|
||||||
'ENUM1' => 1,
|
|
||||||
'ENUM2' => 'abc',
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
;
|
|
||||||
|
|
||||||
class EnumArrayTest extends \PHPUnit\Framework\TestCase
|
class EnumArrayTest extends \PHPUnit\Framework\TestCase
|
||||||
{
|
{
|
||||||
public function testGetSet()
|
public function testGetSet()
|
||||||
|
|
|
||||||
22
tests/Stdlib/Base/EnumDemo.php
Normal file
22
tests/Stdlib/Base/EnumDemo.php
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Orange Management
|
||||||
|
*
|
||||||
|
* PHP Version 7.1
|
||||||
|
*
|
||||||
|
* @package TBD
|
||||||
|
* @copyright Dennis Eichhorn
|
||||||
|
* @license OMS License 1.0
|
||||||
|
* @version 1.0.0
|
||||||
|
* @link http://website.orange-management.de
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace phpOMS\tests\Stdlib\Base;
|
||||||
|
|
||||||
|
use phpOMS\Stdlib\Base\Enum;
|
||||||
|
|
||||||
|
final class EnumDemo extends Enum
|
||||||
|
{
|
||||||
|
const ENUM1 = 1;
|
||||||
|
const ENUM2 = ';l';
|
||||||
|
}
|
||||||
|
|
@ -15,12 +15,6 @@ namespace phpOMS\tests\Stdlib\Base;
|
||||||
|
|
||||||
use phpOMS\Stdlib\Base\Enum;
|
use phpOMS\Stdlib\Base\Enum;
|
||||||
|
|
||||||
final class EnumDemo extends Enum
|
|
||||||
{
|
|
||||||
const ENUM1 = 1;
|
|
||||||
const ENUM2 = ';l';
|
|
||||||
};
|
|
||||||
|
|
||||||
class EnumTest extends \PHPUnit\Framework\TestCase
|
class EnumTest extends \PHPUnit\Framework\TestCase
|
||||||
{
|
{
|
||||||
public function testGetSet()
|
public function testGetSet()
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,10 @@ class TaskAbstractTest extends \PHPUnit\Framework\TestCase
|
||||||
protected function setUp()
|
protected function setUp()
|
||||||
{
|
{
|
||||||
$this->class = new class('') extends TaskAbstract {
|
$this->class = new class('') extends TaskAbstract {
|
||||||
public static function createWith(array $jobData) : TaskAbstract {}
|
public static function createWith(array $jobData) : TaskAbstract
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user