upgrade phpunit

This commit is contained in:
Dennis Eichhorn 2024-03-20 05:16:00 +00:00
parent a1b591d141
commit d6ddf6cbe9
437 changed files with 5280 additions and 12367 deletions

View File

@ -20,10 +20,10 @@ use phpOMS\Account\NullAccount;
require_once __DIR__ . '/../Autoloader.php';
/**
* @testdox phpOMS\tests\Account\AccountManager: Account/user manager to handle/access loaded accounts
*
* @internal
*/
#[\PHPUnit\Framework\Attributes\CoversClass(\phpOMS\Account\AccountManager::class)]
#[\PHPUnit\Framework\Attributes\TestDox('phpOMS\tests\Account\AccountManager: Account/user manager to handle/access loaded accounts')]
final class AccountManagerTest extends \PHPUnit\Framework\TestCase
{
protected $manager = null;
@ -35,17 +35,14 @@ final class AccountManagerTest extends \PHPUnit\Framework\TestCase
*/
protected function setUp() : void
{
$this->manager = new AccountManager($GLOBALS['httpSession']);
$this->manager = new AccountManager($GLOBALS['session']);
$this->account = new NullAccount(3);
$this->account->generatePassword('abcd');
}
/**
* @testdox The manager has the expected default values after initialization
* @covers \phpOMS\Account\AccountManager<extended>
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The manager has the expected default values after initialization')]
public function testDefault() : void
{
self::assertEquals(0, $this->manager->count());
@ -53,11 +50,8 @@ final class AccountManagerTest extends \PHPUnit\Framework\TestCase
self::assertInstanceOf('\phpOMS\Account\NullAccount', $this->manager->get(-1));
}
/**
* @testdox An account can be added to the manager
* @covers \phpOMS\Account\AccountManager<extended>
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('An account can be added to the manager')]
public function testAddAccount() : void
{
$added = $this->manager->add($this->account);
@ -65,22 +59,16 @@ final class AccountManagerTest extends \PHPUnit\Framework\TestCase
self::assertEquals(1, $this->manager->count());
}
/**
* @testdox An account can be retrieved from the manager
* @covers \phpOMS\Account\AccountManager<extended>
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('An account can be retrieved from the manager')]
public function testRetrieveAccount() : void
{
$this->manager->add($this->account);
self::assertEquals($this->account, $this->manager->get($this->account->id));
}
/**
* @testdox An account can only be added once to the account manager (no duplication)
* @covers \phpOMS\Account\AccountManager<extended>
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('An account can only be added once to the account manager (no duplication)')]
public function testNoAccountDuplication() : void
{
$this->manager->add($this->account);
@ -92,11 +80,8 @@ final class AccountManagerTest extends \PHPUnit\Framework\TestCase
self::assertEquals(0, $this->manager->count());
}
/**
* @testdox An account can be removed from the account manager
* @covers \phpOMS\Account\AccountManager<extended>
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('An account can be removed from the account manager')]
public function testRemoveAccount() : void
{
$this->manager->add($this->account);
@ -105,11 +90,8 @@ final class AccountManagerTest extends \PHPUnit\Framework\TestCase
self::assertFalse($this->manager->remove(-1));
}
/**
* @testdox Only a valid account can be removed from the manager
* @covers \phpOMS\Account\AccountManager<extended>
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('Only a valid account can be removed from the manager')]
public function testRemoveOnlyValidAccount() : void
{
$this->manager->add($this->account);

View File

@ -19,36 +19,32 @@ require_once __DIR__ . '/../Autoloader.php';
use phpOMS\Account\AccountStatus;
/**
* @testdox phpOMS\tests\Account\AccountStatus: Account status
* @internal
*/
#[\PHPUnit\Framework\Attributes\TestDox('phpOMS\tests\Account\AccountStatus: Account status')]
final class AccountStatusTest extends \PHPUnit\Framework\TestCase
{
/**
* @testdoxThe account status enum has the correct number of status codes
* @group framework
* @coversNothing
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\CoversNothing]
public function testEnumCount() : void
{
self::assertCount(4, AccountStatus::getConstants());
}
/**
* @testdox The account status enum has only unique values
* @group framework
* @coversNothing
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The account status enum has only unique values')]
#[\PHPUnit\Framework\Attributes\CoversNothing]
public function testUnique() : void
{
self::assertEquals(AccountStatus::getConstants(), \array_unique(AccountStatus::getConstants()));
}
/**
* @testdox The account status enum has the correct values
* @group framework
* @coversNothing
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The account status enum has the correct values')]
#[\PHPUnit\Framework\Attributes\CoversNothing]
public function testEnums() : void
{
self::assertEquals(1, AccountStatus::ACTIVE);

View File

@ -27,10 +27,10 @@ use phpOMS\Localization\Localization;
require_once __DIR__ . '/../Autoloader.php';
/**
* @testdox phpOMS\tests\Account\Account: Base account/user representation
*
* @internal
*/
#[\PHPUnit\Framework\Attributes\CoversClass(\phpOMS\Account\Account::class)]
#[\PHPUnit\Framework\Attributes\TestDox('phpOMS\tests\Account\Account: Base account/user representation')]
final class AccountTest extends \PHPUnit\Framework\TestCase
{
protected $l11nManager = null;
@ -44,10 +44,9 @@ final class AccountTest extends \PHPUnit\Framework\TestCase
}
/**
* @testdox The account has the expected default values after initialization
* @covers \phpOMS\Account\Account<extended>
* @group framework
*/
#[\PHPUnit\Framework\Attributes\TestDox('The account has the expected default values after initialization')]
public function testDefault() : void
{
$account = new Account();
@ -94,10 +93,9 @@ final class AccountTest extends \PHPUnit\Framework\TestCase
}
/**
* @testdox The account names can be set and retrieved correctly
* @covers \phpOMS\Account\Account<extended>
* @group framework
*/
#[\PHPUnit\Framework\Attributes\TestDox('The account names can be set and retrieved correctly')]
public function testSetAndGetAccountNames() : void
{
$account = new Account();
@ -117,10 +115,9 @@ final class AccountTest extends \PHPUnit\Framework\TestCase
}
/**
* @testdox Groups can be added to an account
* @covers \phpOMS\Account\Account<extended>
* @group framework
*/
#[\PHPUnit\Framework\Attributes\TestDox('Groups can be added to an account')]
public function testAddAndGetGroup() : void
{
$account = new Account();
@ -132,10 +129,9 @@ final class AccountTest extends \PHPUnit\Framework\TestCase
}
/**
* @testdox An account can have a valid email address
* @covers \phpOMS\Account\Account<extended>
* @group framework
*/
#[\PHPUnit\Framework\Attributes\TestDox('An account can have a valid email address')]
public function testSetAndGetAccountEmail() : void
{
$account = new Account();
@ -146,10 +142,9 @@ final class AccountTest extends \PHPUnit\Framework\TestCase
}
/**
* @testdox Account permissions can be added
* @covers \phpOMS\Account\Account<extended>
* @group framework
*/
#[\PHPUnit\Framework\Attributes\TestDox('Account permissions can be added')]
public function testPermissionAdd() : void
{
$account = new Account();
@ -178,10 +173,9 @@ final class AccountTest extends \PHPUnit\Framework\TestCase
}
/**
* @testdox Account permissions can be checked for existence
* @covers \phpOMS\Account\Account<extended>
* @group framework
*/
#[\PHPUnit\Framework\Attributes\TestDox('Account permissions can be checked for existence')]
public function testPermissionExists() : void
{
$account = new Account();
@ -207,10 +201,9 @@ final class AccountTest extends \PHPUnit\Framework\TestCase
}
/**
* @testdox Account permissions can be removed
* @covers \phpOMS\Account\Account<extended>
* @group framework
*/
#[\PHPUnit\Framework\Attributes\TestDox('Account permissions can be removed')]
public function testPermissionRemove() : void
{
$account = new Account();
@ -227,10 +220,9 @@ final class AccountTest extends \PHPUnit\Framework\TestCase
}
/**
* @testdox An account can have it's own localization
* @covers \phpOMS\Account\Account<extended>
* @group framework
*/
#[\PHPUnit\Framework\Attributes\TestDox("An account can have it's own localization")]
public function testLocalization() : void
{
$account = new Account();
@ -241,9 +233,9 @@ final class AccountTest extends \PHPUnit\Framework\TestCase
}
/**
* @testdox An account 'last activity' timestamp can be updated and retrieved
* @group framework
*/
#[\PHPUnit\Framework\Attributes\TestDox("An account 'last activity' timestamp can be updated and retrieved")]
public function testLastChange() : void
{
$account = new Account();
@ -255,9 +247,9 @@ final class AccountTest extends \PHPUnit\Framework\TestCase
}
/**
* @testdox An account can only have a valid email
* @group framework
*/
#[\PHPUnit\Framework\Attributes\TestDox('An account can only have a valid email')]
public function testEmailException() : void
{
$this->expectException(\InvalidArgumentException::class);

View File

@ -19,36 +19,30 @@ require_once __DIR__ . '/../Autoloader.php';
use phpOMS\Account\AccountType;
/**
* @testdox phpOMS\tests\Account\AccountType: Account type
* @internal
*/
#[\PHPUnit\Framework\Attributes\TestDox('phpOMS\tests\Account\AccountType: Account type')]
final class AccountTypeTest extends \PHPUnit\Framework\TestCase
{
/**
* @testdox The account type enum has the correct number of type codes
* @group framework
* @coversNothing
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The account type enum has the correct number of type codes')]
#[\PHPUnit\Framework\Attributes\CoversNothing]
public function testEnumCount() : void
{
self::assertCount(2, AccountType::getConstants());
}
/**
* @testdox The account type enum has only unique values
* @group framework
* @coversNothing
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The account type enum has only unique values')]
#[\PHPUnit\Framework\Attributes\CoversNothing]
public function testUnique() : void
{
self::assertEquals(AccountType::getConstants(), \array_unique(AccountType::getConstants()));
}
/**
* @testdox The account type enum has the correct values
* @group framework
* @coversNothing
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The account type enum has the correct values')]
#[\PHPUnit\Framework\Attributes\CoversNothing]
public function testEnums() : void
{
self::assertEquals(0, AccountType::USER);

View File

@ -19,36 +19,30 @@ require_once __DIR__ . '/../Autoloader.php';
use phpOMS\Account\GroupStatus;
/**
* @testdox phpOMS\tests\Account\GroupStatus: Group status
* @internal
*/
#[\PHPUnit\Framework\Attributes\TestDox('phpOMS\tests\Account\GroupStatus: Group status')]
final class GroupStatusTest extends \PHPUnit\Framework\TestCase
{
/**
* @testdox The group status enum has the correct number of status codes
* @group framework
* @coversNothing
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The group status enum has the correct number of status codes')]
#[\PHPUnit\Framework\Attributes\CoversNothing]
public function testEnumCount() : void
{
self::assertCount(3, GroupStatus::getConstants());
}
/**
* @testdox The group status enum has only unique values
* @group framework
* @coversNothing
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The group status enum has only unique values')]
#[\PHPUnit\Framework\Attributes\CoversNothing]
public function testUnique() : void
{
self::assertEquals(GroupStatus::getConstants(), \array_unique(GroupStatus::getConstants()));
}
/**
* @testdox The group status enum has the correct values
* @group framework
* @coversNothing
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The group status enum has the correct values')]
#[\PHPUnit\Framework\Attributes\CoversNothing]
public function testEnums() : void
{
self::assertEquals(1, GroupStatus::ACTIVE);

View File

@ -22,17 +22,16 @@ use phpOMS\Account\PermissionType;
require_once __DIR__ . '/../Autoloader.php';
/**
* @testdox phpOMS\tests\Account\Group: Base group representation
*
* @internal
*/
#[\PHPUnit\Framework\Attributes\CoversClass(\phpOMS\Account\Group::class)]
#[\PHPUnit\Framework\Attributes\TestDox('phpOMS\tests\Account\Group: Base group representation')]
final class GroupTest extends \PHPUnit\Framework\TestCase
{
/**
* @testdox The group has the expected default values after initialization
* @covers \phpOMS\Account\Group<extended>
* @group framework
*/
#[\PHPUnit\Framework\Attributes\TestDox('The group has the expected default values after initialization')]
public function testDefault() : void
{
$group = new Group();
@ -58,10 +57,9 @@ final class GroupTest extends \PHPUnit\Framework\TestCase
}
/**
* @testdox The group name and description can be set and retrieved correctly
* @covers \phpOMS\Account\Group<extended>
* @group framework
*/
#[\PHPUnit\Framework\Attributes\TestDox('The group name and description can be set and retrieved correctly')]
public function testSetAndGetGroupNameDescription() : void
{
$group = new Group();
@ -74,10 +72,9 @@ final class GroupTest extends \PHPUnit\Framework\TestCase
}
/**
* @testdox Group permissions can be added
* @covers \phpOMS\Account\Group<extended>
* @group framework
*/
#[\PHPUnit\Framework\Attributes\TestDox('Group permissions can be added')]
public function testPermissionAdd() : void
{
$group = new Group();
@ -105,10 +102,9 @@ final class GroupTest extends \PHPUnit\Framework\TestCase
}
/**
* @testdox Group permissions can be checked for existence
* @covers \phpOMS\Account\Group<extended>
* @group framework
*/
#[\PHPUnit\Framework\Attributes\TestDox('Group permissions can be checked for existence')]
public function testPermissionExists() : void
{
$group = new Group();
@ -121,10 +117,9 @@ final class GroupTest extends \PHPUnit\Framework\TestCase
}
/**
* @testdox Group permissions can be removed
* @covers \phpOMS\Account\Group<extended>
* @group framework
*/
#[\PHPUnit\Framework\Attributes\TestDox('Group permissions can be removed')]
public function testPermissionRemove() : void
{
$group = new Group();

View File

@ -19,26 +19,21 @@ require_once __DIR__ . '/../Autoloader.php';
use phpOMS\Account\NullAccount;
/**
* @testdox phpOMS\tests\Account\NullAccount: Null account
* @internal
*/
#[\PHPUnit\Framework\Attributes\CoversClass(\phpOMS\Account\NullAccount::class)]
#[\PHPUnit\Framework\Attributes\TestDox('phpOMS\tests\Account\NullAccount: Null account')]
final class NullAccountTest extends \PHPUnit\Framework\TestCase
{
/**
* @testdox The null account is an instance of the account class
* @covers \phpOMS\Account\NullAccount
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The null account is an instance of the account class')]
public function testNull() : void
{
self::assertInstanceOf('\phpOMS\Account\Account', new NullAccount());
}
/**
* @testdox The null account can get initialized with an id
* @covers \phpOMS\Account\NullAccount
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The null account can get initialized with an id')]
public function testId() : void
{
$null = new NullAccount(2);

View File

@ -19,26 +19,21 @@ require_once __DIR__ . '/../Autoloader.php';
use phpOMS\Account\NullGroup;
/**
* @testdox phpOMS\tests\Account\NullGroup: Null group
* @internal
*/
#[\PHPUnit\Framework\Attributes\CoversClass(\phpOMS\Account\NullGroup::class)]
#[\PHPUnit\Framework\Attributes\TestDox('phpOMS\tests\Account\NullGroup: Null group')]
final class NullGroupTest extends \PHPUnit\Framework\TestCase
{
/**
* @testdox The null group is an instance of the group class
* @covers \phpOMS\Account\NullGroup
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The null group is an instance of the group class')]
public function testNull() : void
{
self::assertInstanceOf('\phpOMS\Account\Group', new NullGroup());
}
/**
* @testdox The null group can get initialized with an id
* @covers \phpOMS\Account\NullGroup
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The null group can get initialized with an id')]
public function testId() : void
{
$null = new NullGroup(2);

View File

@ -20,17 +20,14 @@ use phpOMS\Account\PermissionAbstract;
use phpOMS\Account\PermissionType;
/**
* @testdox phpOMS\tests\Account\PermissionAbstractTest: Base permission representation
*
* @internal
*/
#[\PHPUnit\Framework\Attributes\CoversClass(\phpOMS\Account\PermissionAbstract::class)]
#[\PHPUnit\Framework\Attributes\TestDox('phpOMS\tests\Account\PermissionAbstractTest: Base permission representation')]
final class PermissionAbstractTest extends \PHPUnit\Framework\TestCase
{
/**
* @testdox The permission has the expected default values after initialization
* @covers \phpOMS\Account\PermissionAbstract
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The permission has the expected default values after initialization')]
public function testAbstractDefault() : void
{
$perm = new class() extends PermissionAbstract {};
@ -64,11 +61,8 @@ final class PermissionAbstractTest extends \PHPUnit\Framework\TestCase
);
}
/**
* @testdox The permission can be set and returned correctly
* @covers \phpOMS\Account\PermissionAbstract
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The permission can be set and returned correctly')]
public function testPermissionInputOutput() : void
{
$perm = new class() extends PermissionAbstract {};
@ -77,11 +71,8 @@ final class PermissionAbstractTest extends \PHPUnit\Framework\TestCase
self::assertEquals(PermissionType::READ, $perm->getPermission());
}
/**
* @testdox Two permissions can be checked for equality
* @covers \phpOMS\Account\PermissionAbstract
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('Two permissions can be checked for equality')]
public function testEqualPermissions() : void
{
$perm1 = new class() extends PermissionAbstract {};
@ -117,11 +108,8 @@ final class PermissionAbstractTest extends \PHPUnit\Framework\TestCase
);
}
/**
* @testdox Correct permissions are validated
* @covers \phpOMS\Account\PermissionAbstract
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('Correct permissions are validated')]
public function testValidPermission() : void
{
$perm = new class() extends PermissionAbstract {};
@ -132,11 +120,8 @@ final class PermissionAbstractTest extends \PHPUnit\Framework\TestCase
self::assertTrue($perm->hasPermission(PermissionType::READ));
}
/**
* @testdox Invalid permissions are not validated
* @covers \phpOMS\Account\PermissionAbstract
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('Invalid permissions are not validated')]
public function testInvalidPermission() : void
{
$perm = new class() extends PermissionAbstract {};
@ -146,11 +131,8 @@ final class PermissionAbstractTest extends \PHPUnit\Framework\TestCase
self::assertFalse($perm->hasPermission(PermissionType::MODIFY));
}
/**
* @testdox Correct permission flags are validated
* @covers \phpOMS\Account\PermissionAbstract
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('Correct permission flags are validated')]
public function testValidPermissionFlag() : void
{
$perm = new class() extends PermissionAbstract {};
@ -161,11 +143,8 @@ final class PermissionAbstractTest extends \PHPUnit\Framework\TestCase
self::assertTrue($perm->hasPermissionFlags(PermissionType::READ | PermissionType::CREATE));
}
/**
* @testdox Invalid permission flags are not validated
* @covers \phpOMS\Account\PermissionAbstract
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('Invalid permission flags are not validated')]
public function testInvalidPermissionFlag() : void
{
$perm = new class() extends PermissionAbstract {};

View File

@ -19,36 +19,30 @@ require_once __DIR__ . '/../Autoloader.php';
use phpOMS\Account\PermissionType;
/**
* @testdox phpOMS\tests\Account\PermissionType: Permission type
* @internal
*/
#[\PHPUnit\Framework\Attributes\TestDox('phpOMS\tests\Account\PermissionType: Permission type')]
final class PermissionTypeTest extends \PHPUnit\Framework\TestCase
{
/**
* @testdox The permission type enum has the correct number of type codes
* @group framework
* @coversNothing
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The permission type enum has the correct number of type codes')]
#[\PHPUnit\Framework\Attributes\CoversNothing]
public function testEnumCount() : void
{
self::assertCount(6, PermissionType::getConstants());
}
/**
* @testdox The permission type enum has only unique values
* @group framework
* @coversNothing
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The permission type enum has only unique values')]
#[\PHPUnit\Framework\Attributes\CoversNothing]
public function testUnique() : void
{
self::assertEquals(PermissionType::getConstants(), \array_unique(PermissionType::getConstants()));
}
/**
* @testdox The permission type enum has the correct values
* @group framework
* @coversNothing
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The permission type enum has the correct values')]
#[\PHPUnit\Framework\Attributes\CoversNothing]
public function testEnums() : void
{
self::assertEquals(1, PermissionType::NONE);

View File

@ -19,12 +19,10 @@ use phpOMS\Ai\Ocr\BasicOcr;
/**
* @internal
*/
#[\PHPUnit\Framework\Attributes\CoversClass(\phpOMS\Ai\Ocr\BasicOcr::class)]
final class BasicOcrTest extends \PHPUnit\Framework\TestCase
{
/**
* @covers \phpOMS\Ai\Ocr\BasicOcr
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
public function testOcr() : void
{
$ocr = new BasicOcr();
@ -63,10 +61,7 @@ final class BasicOcrTest extends \PHPUnit\Framework\TestCase
}
}
/**
* @covers \phpOMS\Ai\Ocr\BasicOcr
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
public function testInvalidImagePath() : void
{
$this->expectException(\phpOMS\System\File\PathException::class);
@ -74,10 +69,7 @@ final class BasicOcrTest extends \PHPUnit\Framework\TestCase
$ocr->trainWith(__DIR__ . '/invalid', __DIR__ . '/train-labels-idx1-ubyte', 1);
}
/**
* @covers \phpOMS\Ai\Ocr\BasicOcr
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
public function testInvalidLabelPath() : void
{
$this->expectException(\phpOMS\System\File\PathException::class);

View File

@ -23,6 +23,7 @@ use phpOMS\System\File\PathException;
/**
* @internal
*/
#[\PHPUnit\Framework\Attributes\CoversClass(\phpOMS\Ai\Ocr\Tesseract\TesseractOcr::class)]
final class TesseractOcrTest extends \PHPUnit\Framework\TestCase
{
/**
@ -49,10 +50,7 @@ final class TesseractOcrTest extends \PHPUnit\Framework\TestCase
echo 'Match2: ' . $m2 . " \n";
}
/**
* @covers \phpOMS\Ai\Ocr\Tesseract\TesseractOcr
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
public function testOcrBasic() : void
{
$ocr = new TesseractOcr();
@ -75,10 +73,7 @@ final class TesseractOcrTest extends \PHPUnit\Framework\TestCase
TesseractOcr::setBin('/invalid/path');
}
/**
* @covers \phpOMS\Ai\Ocr\Tesseract\TesseractOcr
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
public function testOcrWithThresholding() : void
{
$ocr = new TesseractOcr();

View File

@ -20,17 +20,14 @@ use phpOMS\Algorithm\Clustering\Point;
include_once __DIR__ . '/../../Autoloader.php';
/**
* @testdox phpOMS\tests\Algorithm\Clustering\KmeansTest: Clustering points/elements with the K-means algorithm
*
* @internal
*/
#[\PHPUnit\Framework\Attributes\CoversClass(\phpOMS\Algorithm\Clustering\Kmeans::class)]
#[\PHPUnit\Framework\Attributes\TestDox('phpOMS\tests\Algorithm\Clustering\KmeansTest: Clustering points/elements with the K-means algorithm')]
final class KmeansTest extends \PHPUnit\Framework\TestCase
{
/**
* @testdox The clustering of points and dynamic check of new points works as expected
* @covers \phpOMS\Algorithm\Clustering\Kmeans
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The clustering of points and dynamic check of new points works as expected')]
public function testKmeans() : void
{
$seed = \mt_rand(\PHP_INT_MIN, \PHP_INT_MAX);

View File

@ -17,17 +17,14 @@ namespace phpOMS\tests\Algorithm\Clustering;
use phpOMS\Algorithm\Clustering\Point;
/**
* @testdox phpOMS\tests\Algorithm\Clustering\PointTest: Default point in a cluster
*
* @internal
*/
#[\PHPUnit\Framework\Attributes\CoversClass(\phpOMS\Algorithm\Clustering\Point::class)]
#[\PHPUnit\Framework\Attributes\TestDox('phpOMS\tests\Algorithm\Clustering\PointTest: Default point in a cluster')]
final class PointTest extends \PHPUnit\Framework\TestCase
{
/**
* @testdox The point has the expected default values after initialization
* @covers \phpOMS\Algorithm\Clustering\Point
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The point has the expected default values after initialization')]
public function testDefault() : void
{
$point = new Point([3.0, 2.0], 'abc');
@ -39,11 +36,8 @@ final class PointTest extends \PHPUnit\Framework\TestCase
self::assertEquals('abc', $point->name);
}
/**
* @testdox Coordinates of a point can be set and returned
* @covers \phpOMS\Algorithm\Clustering\Point
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('Coordinates of a point can be set and returned')]
public function testCoordinateInputOutput() : void
{
$point = new Point([3.0, 2.0], 'abc');
@ -56,11 +50,8 @@ final class PointTest extends \PHPUnit\Framework\TestCase
self::assertEquals(1.0, $point->getCoordinate(1));
}
/**
* @testdox The group/cluster of a point can be set and returned
* @covers \phpOMS\Algorithm\Clustering\Point
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The group/cluster of a point can be set and returned')]
public function testGroupInputOutput() : void
{
$point = new Point([3.0, 2.0], 'abc');
@ -69,11 +60,8 @@ final class PointTest extends \PHPUnit\Framework\TestCase
self::assertEquals(2, $point->group);
}
/**
* @testdox The name of a point can be set and returned
* @covers \phpOMS\Algorithm\Clustering\Point
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The name of a point can be set and returned')]
public function testNameInputOutput() : void
{
$point = new Point([3.0, 2.0], 'abc');

View File

@ -19,17 +19,14 @@ use phpOMS\Algorithm\CoinMatching\MinimumCoinProblem;
require_once __DIR__ . '/../../Autoloader.php';
/**
* @testdox phpOMS\tests\Algorithm\CoinMatching\MinimumCoinProblemTest: Match a value by using the minimum quantity of available sub values (Minimum Coin Problem)
*
* @internal
*/
#[\PHPUnit\Framework\Attributes\CoversClass(\phpOMS\Algorithm\CoinMatching\MinimumCoinProblem::class)]
#[\PHPUnit\Framework\Attributes\TestDox('phpOMS\tests\Algorithm\CoinMatching\MinimumCoinProblemTest: Match a value by using the minimum quantity of available sub values (Minimum Coin Problem)')]
final class MinimumCoinProblemTest extends \PHPUnit\Framework\TestCase
{
/**
* @testdox A value is matched with the minimum quantity of available coins.
* @covers \phpOMS\Algorithm\CoinMatching\MinimumCoinProblem
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('A value is matched with the minimum quantity of available coins.')]
public function testMinimumCoins() : void
{
self::assertEquals(

View File

@ -19,10 +19,9 @@ use phpOMS\Algorithm\Frequency\Apriori;
require_once __DIR__ . '/../../Autoloader.php';
/**
* @testdox phpOMS\tests\Algorithm\Frequency\AprioriTest:
*
* @internal
*/
#[\PHPUnit\Framework\Attributes\TestDox('phpOMS\tests\Algorithm\Frequency\AprioriTest:')]
final class AprioriTest extends \PHPUnit\Framework\TestCase
{
public function testApriori() : void

View File

@ -19,16 +19,13 @@ use phpOMS\Algorithm\Graph\DependencyResolver;
require_once __DIR__ . '/../../Autoloader.php';
/**
* @testdox phpOMS\tests\Algorithm\Graph\DependencyResolverTest:
*
* @internal
*/
#[\PHPUnit\Framework\Attributes\CoversClass(\phpOMS\Algorithm\Graph\DependencyResolver::class)]
#[\PHPUnit\Framework\Attributes\TestDox('phpOMS\tests\Algorithm\Graph\DependencyResolverTest:')]
final class DependencyResolverTest extends \PHPUnit\Framework\TestCase
{
/**
* @covers \phpOMS\Algorithm\Graph\DependencyResolver
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
public function testResolveCircular() : void
{
self::assertNull(
@ -36,10 +33,7 @@ final class DependencyResolverTest extends \PHPUnit\Framework\TestCase
);
}
/**
* @covers \phpOMS\Algorithm\Graph\DependencyResolver
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
public function testResolve() : void
{
self::assertEquals(

View File

@ -19,16 +19,13 @@ use phpOMS\Algorithm\Graph\MarkovChain;
require_once __DIR__ . '/../../Autoloader.php';
/**
* @testdox phpOMS\tests\Algorithm\Graph\MarkovChainTest:
*
* @internal
*/
#[\PHPUnit\Framework\Attributes\CoversClass(\phpOMS\Algorithm\Graph\MarkovChain::class)]
#[\PHPUnit\Framework\Attributes\TestDox('phpOMS\tests\Algorithm\Graph\MarkovChainTest:')]
final class MarkovChainTest extends \PHPUnit\Framework\TestCase
{
/**
* @covers \phpOMS\Algorithm\Graph\MarkovChain
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
public function testGenerate() : void
{
$markov = new MarkovChain();
@ -43,10 +40,7 @@ final class MarkovChainTest extends \PHPUnit\Framework\TestCase
self::assertEquals(3, \count($markov->generate(3, ['A'])));
}
/**
* @covers \phpOMS\Algorithm\Graph\MarkovChain
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
public function testTrainingGenerate() : void
{
$markov = new MarkovChain();
@ -55,10 +49,7 @@ final class MarkovChainTest extends \PHPUnit\Framework\TestCase
self::assertEquals(5, \count($markov->generate(5, ['A'])));
}
/**
* @covers \phpOMS\Algorithm\Graph\MarkovChain
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
public function testStepProbability() : void
{
$markov = new MarkovChain(2);
@ -79,10 +70,7 @@ final class MarkovChainTest extends \PHPUnit\Framework\TestCase
self::assertEquals(0.1, $markov->stepProbability(['D', 'G'], 'D'));
}
/**
* @covers \phpOMS\Algorithm\Graph\MarkovChain
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
public function testPathProbability() : void
{
$markov = new MarkovChain(2);

View File

@ -17,17 +17,14 @@ namespace phpOMS\tests\Algorithm\JobScheduling;
use phpOMS\Algorithm\JobScheduling\Job;
/**
* @testdox phpOMS\tests\Algorithm\JobScheduling\JobTest: Default job for the job scheduling
*
* @internal
*/
#[\PHPUnit\Framework\Attributes\CoversClass(\phpOMS\Algorithm\JobScheduling\Job::class)]
#[\PHPUnit\Framework\Attributes\TestDox('phpOMS\tests\Algorithm\JobScheduling\JobTest: Default job for the job scheduling')]
final class JobTest extends \PHPUnit\Framework\TestCase
{
/**
* @testdox The job has the expected values after initialization
* @covers \phpOMS\Algorithm\JobScheduling\Job
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The job has the expected values after initialization')]
public function testDefault() : void
{
$item = new Job(3.0, new \DateTime('now'), null, 'abc');

View File

@ -18,17 +18,14 @@ use phpOMS\Algorithm\JobScheduling\Job;
use phpOMS\Algorithm\JobScheduling\Weighted;
/**
* @testdox phpOMS\tests\Algorithm\JobScheduling\WeightedTest: Job scheduling based on values/profit
*
* @internal
*/
#[\PHPUnit\Framework\Attributes\CoversClass(\phpOMS\Algorithm\JobScheduling\Weighted::class)]
#[\PHPUnit\Framework\Attributes\TestDox('phpOMS\tests\Algorithm\JobScheduling\WeightedTest: Job scheduling based on values/profit')]
final class WeightedTest extends \PHPUnit\Framework\TestCase
{
/**
* @testdox The optimal job combination is selected to maximize the value/profit without overlapping jobs
* @covers \phpOMS\Algorithm\JobScheduling\Weighted
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The optimal job combination is selected to maximize the value/profit without overlapping jobs')]
public function testNoOverlappingScheduling() : void
{
$jobs = [
@ -58,11 +55,8 @@ final class WeightedTest extends \PHPUnit\Framework\TestCase
);
}
/**
* @testdox A job list with only one job simply returns one job
* @covers \phpOMS\Algorithm\JobScheduling\Weighted
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('A job list with only one job simply returns one job')]
public function testSmallList() : void
{
$jobs = [

View File

@ -18,17 +18,14 @@ use phpOMS\Algorithm\Knapsack\Backpack;
use phpOMS\Algorithm\Knapsack\Item;
/**
* @testdox phpOMS\tests\Algorithm\Knapsack\BackpackTest: The default backpack or basket which holds all items for the Knapsack algorithm
*
* @internal
*/
#[\PHPUnit\Framework\Attributes\CoversClass(\phpOMS\Algorithm\Knapsack\Backpack::class)]
#[\PHPUnit\Framework\Attributes\TestDox('phpOMS\tests\Algorithm\Knapsack\BackpackTest: The default backpack or basket which holds all items for the Knapsack algorithm')]
final class BackpackTest extends \PHPUnit\Framework\TestCase
{
/**
* @testdox The backpack has the expected values after initialization
* @covers \phpOMS\Algorithm\Knapsack\Backpack
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The backpack has the expected values after initialization')]
public function testDefault() : void
{
$backpack = new Backpack(3.0);
@ -39,11 +36,8 @@ final class BackpackTest extends \PHPUnit\Framework\TestCase
self::assertEquals([], $backpack->getItems());
}
/**
* @testdox Items can be added to the backpack and automatically change the value and cost the backpack contains
* @covers \phpOMS\Algorithm\Knapsack\Backpack
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('Items can be added to the backpack and automatically change the value and cost the backpack contains')]
public function testAddItems() : void
{
$backpack = new Backpack(3.0);

View File

@ -19,17 +19,14 @@ use phpOMS\Algorithm\Knapsack\Bounded;
use phpOMS\Algorithm\Knapsack\Item;
/**
* @testdox phpOMS\tests\Algorithm\Knapsack\BoundedTest: A Knapsack implementation for discrete quantities, values and costs and bounded item quantities
*
* @internal
*/
#[\PHPUnit\Framework\Attributes\CoversClass(\phpOMS\Algorithm\Knapsack\Bounded::class)]
#[\PHPUnit\Framework\Attributes\TestDox('phpOMS\tests\Algorithm\Knapsack\BoundedTest: A Knapsack implementation for discrete quantities, values and costs and bounded item quantities')]
final class BoundedTest extends \PHPUnit\Framework\TestCase
{
/**
* @testdox The optimal item selection in a backpack is calculated in order to optimize the value/profit while considering the available capacity/cost limit
* @covers \phpOMS\Algorithm\Knapsack\Bounded
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The optimal item selection in a backpack is calculated in order to optimize the value/profit while considering the available capacity/cost limit')]
public function testBackpacking() : void
{
$items = [

View File

@ -19,17 +19,14 @@ use phpOMS\Algorithm\Knapsack\Continuous;
use phpOMS\Algorithm\Knapsack\Item;
/**
* @testdox phpOMS\tests\Algorithm\Knapsack\ContinuousTest: A Knapsack implementation for continuous quantities, values and costs
*
* @internal
*/
#[\PHPUnit\Framework\Attributes\CoversClass(\phpOMS\Algorithm\Knapsack\Continuous::class)]
#[\PHPUnit\Framework\Attributes\TestDox('phpOMS\tests\Algorithm\Knapsack\ContinuousTest: A Knapsack implementation for continuous quantities, values and costs')]
final class ContinuousTest extends \PHPUnit\Framework\TestCase
{
/**
* @testdox The optimal item selection in a backpack is calculated in order to optimize the value/profit while considering the available capacity/cost limit [discrete quantities]
* @covers \phpOMS\Algorithm\Knapsack\Continuous
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The optimal item selection in a backpack is calculated in order to optimize the value/profit while considering the available capacity/cost limit [discrete quantities]')]
public function testBackpacking() : void
{
$items = [
@ -67,11 +64,8 @@ final class ContinuousTest extends \PHPUnit\Framework\TestCase
);
}
/**
* @testdox The optimal item selection in a backpack is calculated in order to optimize the value/profit while considering the available capacity/cost limit [continuous quantities]
* @covers \phpOMS\Algorithm\Knapsack\Continuous
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The optimal item selection in a backpack is calculated in order to optimize the value/profit while considering the available capacity/cost limit [continuous quantities]')]
public function testBackpackingAlternative() : void
{
$items = [

View File

@ -17,17 +17,14 @@ namespace phpOMS\tests\Algorithm\Knapsack;
use phpOMS\Algorithm\Knapsack\Item;
/**
* @testdox phpOMS\tests\Algorithm\Knapsack\ItemTest: The default item to be added to the backpack or basket
*
* @internal
*/
#[\PHPUnit\Framework\Attributes\CoversClass(\phpOMS\Algorithm\Knapsack\Item::class)]
#[\PHPUnit\Framework\Attributes\TestDox('phpOMS\tests\Algorithm\Knapsack\ItemTest: The default item to be added to the backpack or basket')]
final class ItemTest extends \PHPUnit\Framework\TestCase
{
/**
* @testdox The item has the expected values after initialization
* @covers \phpOMS\Algorithm\Knapsack\Item
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The item has the expected values after initialization')]
public function testDefault() : void
{
$item = new Item(3.0, 2.0, 'abc');

View File

@ -19,17 +19,14 @@ use phpOMS\Algorithm\Maze\MazeGenerator;
require_once __DIR__ . '/../../Autoloader.php';
/**
* @testdox phpOMS\tests\Algorithm\Maze\MazeGeneratorTest: Maze generation
*
* @internal
*/
#[\PHPUnit\Framework\Attributes\CoversClass(\phpOMS\Algorithm\Maze\MazeGenerator::class)]
#[\PHPUnit\Framework\Attributes\TestDox('phpOMS\tests\Algorithm\Maze\MazeGeneratorTest: Maze generation')]
final class MazeGeneratorTest extends \PHPUnit\Framework\TestCase
{
/**
* @testdox A random maze can be generated
* @covers \phpOMS\Algorithm\Maze\MazeGenerator
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('A random maze can be generated')]
public function testMazeGeneration() : void
{
$maze = MazeGenerator::random(10, 7);
@ -59,11 +56,8 @@ final class MazeGeneratorTest extends \PHPUnit\Framework\TestCase
);
}
/**
* @testdox A random maze can be rendered
* @covers \phpOMS\Algorithm\Maze\MazeGenerator
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('A random maze can be rendered')]
public function testMazeRender() : void
{
$ob = MazeGenerator::render(MazeGenerator::random(10, 7));

View File

@ -19,10 +19,10 @@ use phpOMS\Algorithm\PathFinding\AStarNode;
require_once __DIR__ . '/../../Autoloader.php';
/**
* @testdox phpOMS\tests\Algorithm\PathFinding\AStarNode: AStarNode on grid for path finding
*
* @internal
*/
#[\PHPUnit\Framework\Attributes\CoversClass(\phpOMS\Algorithm\PathFinding\AStarNode::class)]
#[\PHPUnit\Framework\Attributes\TestDox('phpOMS\tests\Algorithm\PathFinding\AStarNode: AStarNode on grid for path finding')]
final class AStarNodeTest extends \PHPUnit\Framework\TestCase
{
protected $node;
@ -35,11 +35,8 @@ final class AStarNodeTest extends \PHPUnit\Framework\TestCase
$this->node = new AStarNode(1, 2, 3.0, false);
}
/**
* @testdox The node has the expected values after initialization
* @covers \phpOMS\Algorithm\PathFinding\AStarNode
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The node has the expected values after initialization')]
public function testDefault() : void
{
self::assertFalse($this->node->isClosed());
@ -49,55 +46,40 @@ final class AStarNodeTest extends \PHPUnit\Framework\TestCase
self::assertEquals(0.0, $this->node->getF());
}
/**
* @testdox The node can be set closed and checked
* @covers \phpOMS\Algorithm\PathFinding\AStarNode
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The node can be set closed and checked')]
public function testClosedInputOutput() : void
{
$this->node->setClosed(true);
self::assertTrue($this->node->isClosed());
}
/**
* @testdox The node can be set opened and checked
* @covers \phpOMS\Algorithm\PathFinding\AStarNode
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The node can be set opened and checked')]
public function testOpenedInputOutput() : void
{
$this->node->setOpened(true);
self::assertTrue($this->node->isOpened());
}
/**
* @testdox The g value cen be set and returned
* @covers \phpOMS\Algorithm\PathFinding\AStarNode
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The g value cen be set and returned')]
public function testGInputOutput() : void
{
$this->node->setG(2.0);
self::assertEquals(2.0, $this->node->getG());
}
/**
* @testdox The h value cen be set and returned
* @covers \phpOMS\Algorithm\PathFinding\AStarNode
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The h value cen be set and returned')]
public function testHInputOutput() : void
{
$this->node->setH(2.0);
self::assertEquals(2.0, $this->node->getH());
}
/**
* @testdox The f value cen be set and returned
* @covers \phpOMS\Algorithm\PathFinding\AStarNode
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The f value cen be set and returned')]
public function testFInputOutput() : void
{
$this->node->setF(2.0);

View File

@ -24,10 +24,10 @@ use phpOMS\Algorithm\PathFinding\Path;
require_once __DIR__ . '/../../Autoloader.php';
/**
* @testdox phpOMS\tests\Algorithm\PathFinding\AStarTest: AStar path finding
*
* @internal
*/
#[\PHPUnit\Framework\Attributes\CoversClass(\phpOMS\Algorithm\PathFinding\AStar::class)]
#[\PHPUnit\Framework\Attributes\TestDox('phpOMS\tests\Algorithm\PathFinding\AStarTest: AStar path finding')]
final class AStarTest extends \PHPUnit\Framework\TestCase
{
private array $gridArray = [
@ -75,11 +75,8 @@ final class AStarTest extends \PHPUnit\Framework\TestCase
}
}
/**
* @testdox The correct path is found for diagonal movement
* @covers \phpOMS\Algorithm\PathFinding\AStar
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The correct path is found for diagonal movement')]
public function testPathFindingDiagonal() : void
{
$grid = Grid::createGridFromArray($this->gridArray, AStarNode::class);
@ -138,11 +135,8 @@ final class AStarTest extends \PHPUnit\Framework\TestCase
);
}
/**
* @testdox The correct path is found for straight movement
* @covers \phpOMS\Algorithm\PathFinding\AStar
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The correct path is found for straight movement')]
public function testPathFindingStraight() : void
{
$grid = Grid::createGridFromArray($this->gridArray, AStarNode::class);
@ -201,11 +195,8 @@ final class AStarTest extends \PHPUnit\Framework\TestCase
);
}
/**
* @testdox The correct path is found for diagonal movement [one obstacle]
* @covers \phpOMS\Algorithm\PathFinding\AStar
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The correct path is found for diagonal movement [one obstacle]')]
public function testPathFindingDiagonalOneObstacle() : void
{
$grid = Grid::createGridFromArray($this->gridArray, AStarNode::class);
@ -264,11 +255,8 @@ final class AStarTest extends \PHPUnit\Framework\TestCase
);
}
/**
* @testdox The correct path is found for diagonal movement [no obstacle]
* @covers \phpOMS\Algorithm\PathFinding\AStar
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The correct path is found for diagonal movement [no obstacle]')]
public function testPathFindingDiagonalNoObstacle() : void
{
$grid = Grid::createGridFromArray($this->gridArray, AStarNode::class);
@ -327,11 +315,8 @@ final class AStarTest extends \PHPUnit\Framework\TestCase
);
}
/**
* @testdox A invalid start or end node returns the grid
* @covers \phpOMS\Algorithm\PathFinding\AStar
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('A invalid start or end node returns the grid')]
public function testInvalidStartEndNode() : void
{
$grid = Grid::createGridFromArray($this->gridArray, AStarNode::class);

View File

@ -21,28 +21,22 @@ use phpOMS\Algorithm\PathFinding\Node;
require_once __DIR__ . '/../../Autoloader.php';
/**
* @testdox phpOMS\tests\Algorithm\PathFinding\GridTest: Grid for path finding
*
* @internal
*/
#[\PHPUnit\Framework\Attributes\CoversClass(\phpOMS\Algorithm\PathFinding\Grid::class)]
#[\PHPUnit\Framework\Attributes\TestDox('phpOMS\tests\Algorithm\PathFinding\GridTest: Grid for path finding')]
final class GridTest extends \PHPUnit\Framework\TestCase
{
/**
* @testdox By default a grid is empty
* @covers \phpOMS\Algorithm\PathFinding\Grid
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('By default a grid is empty')]
public function testDefault() : void
{
$grid = new Grid();
self::assertNull($grid->getNode(0, 0));
}
/**
* @testdox A grid can be created from an array
* @covers \phpOMS\Algorithm\PathFinding\Grid
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('A grid can be created from an array')]
public function testGridFromArray() : void
{
$grid = Grid::createGridFromArray([
@ -64,11 +58,8 @@ final class GridTest extends \PHPUnit\Framework\TestCase
self::assertTrue($grid->isWalkable(2, 2));
}
/**
* @testdox A node can be set and returned from the grid
* @covers \phpOMS\Algorithm\PathFinding\Grid
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('A node can be set and returned from the grid')]
public function testNodeInputOutput() : void
{
$grid = Grid::createGridFromArray([
@ -82,11 +73,8 @@ final class GridTest extends \PHPUnit\Framework\TestCase
self::assertFalse($grid->isWalkable(0, 0));
}
/**
* @testdox Out of bounds nodes cannot be returned
* @covers \phpOMS\Algorithm\PathFinding\Grid::getNode
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('Out of bounds nodes cannot be returned')]
public function testOutOfBoundsNode() : void
{
$grid = Grid::createGridFromArray([
@ -101,11 +89,8 @@ final class GridTest extends \PHPUnit\Framework\TestCase
self::assertNull($grid->getNode(0, 3));
}
/**
* @testdox All horizontal neighbors can be found correctly
* @covers \phpOMS\Algorithm\PathFinding\Grid::getNeighbors
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('All horizontal neighbors can be found correctly')]
public function testStraightHorizontalNeighbors() : void
{
$grid = Grid::createGridFromArray([
@ -122,11 +107,8 @@ final class GridTest extends \PHPUnit\Framework\TestCase
self::assertTrue($grid->getNode(2, 1)->isEqual($neighbors[0]));
}
/**
* @testdox All vertical neighbors can be found correctly
* @covers \phpOMS\Algorithm\PathFinding\Grid::getNeighbors
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('All vertical neighbors can be found correctly')]
public function testStraightVerticalNeighbors() : void
{
$grid = Grid::createGridFromArray([
@ -143,11 +125,8 @@ final class GridTest extends \PHPUnit\Framework\TestCase
self::assertTrue($grid->getNode(1, 2)->isEqual($neighbors[1]));
}
/**
* @testdox No straight neighbors are found if no straight neighbors exist
* @covers \phpOMS\Algorithm\PathFinding\Grid::getNeighbors
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('No straight neighbors are found if no straight neighbors exist')]
public function testStraightNoneNeighbors() : void
{
$grid = Grid::createGridFromArray([
@ -162,11 +141,8 @@ final class GridTest extends \PHPUnit\Framework\TestCase
self::assertEquals(0, \count($neighbors));
}
/**
* @testdox All straight neighbors can be found correctly
* @covers \phpOMS\Algorithm\PathFinding\Grid::getNeighbors
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('All straight neighbors can be found correctly')]
public function testStraightAllNeighbors() : void
{
$grid = Grid::createGridFromArray([
@ -185,11 +161,8 @@ final class GridTest extends \PHPUnit\Framework\TestCase
self::assertTrue($grid->getNode(1, 2)->isEqual($neighbors[2]));
}
/**
* @testdox All neighbors except blocked diagonal neighbors can be found correctly
* @covers \phpOMS\Algorithm\PathFinding\Grid::getNeighbors
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('All neighbors except blocked diagonal neighbors can be found correctly')]
public function testDiagonalLRNeighbors() : void
{
$grid = Grid::createGridFromArray([
@ -210,11 +183,8 @@ final class GridTest extends \PHPUnit\Framework\TestCase
self::assertTrue($grid->getNode(2, 2)->isEqual($neighbors[5]));
}
/**
* @testdox All neighbors except blocked diagonal neighbors can be found correctly
* @covers \phpOMS\Algorithm\PathFinding\Grid::getNeighbors
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('All neighbors except blocked diagonal neighbors can be found correctly')]
public function testDiagonalURNeighbors() : void
{
$grid = Grid::createGridFromArray([
@ -235,11 +205,8 @@ final class GridTest extends \PHPUnit\Framework\TestCase
self::assertTrue($grid->getNode(0, 2)->isEqual($neighbors[5]));
}
/**
* @testdox No diagonal neighbors are found if no neighbors exist
* @covers \phpOMS\Algorithm\PathFinding\Grid::getNeighbors
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('No diagonal neighbors are found if no neighbors exist')]
public function testDiagonalNoneNeighbors() : void
{
$grid = Grid::createGridFromArray([
@ -254,11 +221,8 @@ final class GridTest extends \PHPUnit\Framework\TestCase
self::assertEquals(0, \count($neighbors));
}
/**
* @testdox All diagonal neighbors can be found correctly
* @covers \phpOMS\Algorithm\PathFinding\Grid::getNeighbors
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('All diagonal neighbors can be found correctly')]
public function testDiagonalOnlyNeighbors() : void
{
$grid = Grid::createGridFromArray([
@ -277,11 +241,8 @@ final class GridTest extends \PHPUnit\Framework\TestCase
self::assertTrue($grid->getNode(2, 2)->isEqual($neighbors[2]));
}
/**
* @testdox All neighbors can be found correctly
* @covers \phpOMS\Algorithm\PathFinding\Grid::getNeighbors
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('All neighbors can be found correctly')]
public function testDiagonalAllNeighbors() : void
{
$grid = Grid::createGridFromArray([
@ -304,11 +265,8 @@ final class GridTest extends \PHPUnit\Framework\TestCase
self::assertTrue($grid->getNode(2, 2)->isEqual($neighbors[6]));
}
/**
* @testdox All neighbors can be found correctly even if one obstacle exists
* @covers \phpOMS\Algorithm\PathFinding\Grid::getNeighbors
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('All neighbors can be found correctly even if one obstacle exists')]
public function testDiagonalOneObstacleNoBlockNeighbors() : void
{
$grid = Grid::createGridFromArray([
@ -330,11 +288,8 @@ final class GridTest extends \PHPUnit\Framework\TestCase
self::assertTrue($grid->getNode(2, 2)->isEqual($neighbors[5]));
}
/**
* @testdox No diagonal neighbors are found if they are blocked on two sides
* @covers \phpOMS\Algorithm\PathFinding\Grid::getNeighbors
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('No diagonal neighbors are found if they are blocked on two sides')]
public function testDiagonalOneObstacleBlockNeighbors() : void
{
$grid = Grid::createGridFromArray([
@ -354,11 +309,8 @@ final class GridTest extends \PHPUnit\Framework\TestCase
self::assertTrue($grid->getNode(2, 2)->isEqual($neighbors[3]));
}
/**
* @testdox All neighbors can be found correctly if no obstacles exists
* @covers \phpOMS\Algorithm\PathFinding\Grid::getNeighbors
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('All neighbors can be found correctly if no obstacles exists')]
public function testDiagonalOneObstacleAllNeighbors() : void
{
$grid = Grid::createGridFromArray([
@ -381,11 +333,8 @@ final class GridTest extends \PHPUnit\Framework\TestCase
self::assertTrue($grid->getNode(2, 2)->isEqual($neighbors[6]));
}
/**
* @testdox No diagonal neighbors are found if one obstacle exists
* @covers \phpOMS\Algorithm\PathFinding\Grid::getNeighbors
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('No diagonal neighbors are found if one obstacle exists')]
public function testDiagonalNoObstacleBlockNeighbors() : void
{
$grid = Grid::createGridFromArray([
@ -405,11 +354,8 @@ final class GridTest extends \PHPUnit\Framework\TestCase
self::assertTrue($grid->getNode(2, 2)->isEqual($neighbors[3]));
}
/**
* @testdox All neighbors can be found correctly if no obstacles exist
* @covers \phpOMS\Algorithm\PathFinding\Grid::getNeighbors
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('All neighbors can be found correctly if no obstacles exist')]
public function testDiagonalNoObstacleAllNeighbors() : void
{
$grid = Grid::createGridFromArray([

View File

@ -20,17 +20,14 @@ use phpOMS\Algorithm\PathFinding\HeuristicType;
require_once __DIR__ . '/../../Autoloader.php';
/**
* @testdox phpOMS\tests\Algorithm\PathFinding\HeuristicTest: Heuristic for path finding
*
* @internal
*/
#[\PHPUnit\Framework\Attributes\CoversClass(\phpOMS\Algorithm\PathFinding\Heuristic::class)]
#[\PHPUnit\Framework\Attributes\TestDox('phpOMS\tests\Algorithm\PathFinding\HeuristicTest: Heuristic for path finding')]
final class HeuristicTest extends \PHPUnit\Framework\TestCase
{
/**
* @testdox The heuristics return the correct metric results
* @covers \phpOMS\Algorithm\PathFinding\Heuristic
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The heuristics return the correct metric results')]
public function testHeuristics() : void
{
self::assertEquals(

View File

@ -19,10 +19,10 @@ use phpOMS\Algorithm\PathFinding\JumpPointNode;
require_once __DIR__ . '/../../Autoloader.php';
/**
* @testdox phpOMS\tests\Algorithm\PathFinding\JumpPointNode: JumpPointNode on grid for path finding
*
* @internal
*/
#[\PHPUnit\Framework\Attributes\CoversClass(\phpOMS\Algorithm\PathFinding\JumpPointNode::class)]
#[\PHPUnit\Framework\Attributes\TestDox('phpOMS\tests\Algorithm\PathFinding\JumpPointNode: JumpPointNode on grid for path finding')]
final class JumpPointNodeTest extends \PHPUnit\Framework\TestCase
{
protected $node;
@ -35,11 +35,8 @@ final class JumpPointNodeTest extends \PHPUnit\Framework\TestCase
$this->node = new JumpPointNode(1, 2, 3.0, false);
}
/**
* @testdox The node has the expected values after initialization
* @covers \phpOMS\Algorithm\PathFinding\JumpPointNode
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The node has the expected values after initialization')]
public function testDefault() : void
{
self::assertFalse($this->node->isClosed());
@ -50,66 +47,48 @@ final class JumpPointNodeTest extends \PHPUnit\Framework\TestCase
self::assertEquals(0.0, $this->node->getF());
}
/**
* @testdox The node can be set closed and checked
* @covers \phpOMS\Algorithm\PathFinding\JumpPointNode
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The node can be set closed and checked')]
public function testClosedInputOutput() : void
{
$this->node->setClosed(true);
self::assertTrue($this->node->isClosed());
}
/**
* @testdox The node can be set opened and checked
* @covers \phpOMS\Algorithm\PathFinding\JumpPointNode
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The node can be set opened and checked')]
public function testOpenedInputOutput() : void
{
$this->node->setOpened(true);
self::assertTrue($this->node->isOpened());
}
/**
* @testdox The node can be set tested and checked
* @covers \phpOMS\Algorithm\PathFinding\JumpPointNode
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The node can be set tested and checked')]
public function testTestedInputOutput() : void
{
$this->node->setTested(true);
self::assertTrue($this->node->isTested());
}
/**
* @testdox The g value cen be set and returned
* @covers \phpOMS\Algorithm\PathFinding\JumpPointNode
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The g value cen be set and returned')]
public function testGInputOutput() : void
{
$this->node->setG(2.0);
self::assertEquals(2.0, $this->node->getG());
}
/**
* @testdox The h value cen be set and returned
* @covers \phpOMS\Algorithm\PathFinding\JumpPointNode
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The h value cen be set and returned')]
public function testHInputOutput() : void
{
$this->node->setH(2.0);
self::assertEquals(2.0, $this->node->getH());
}
/**
* @testdox The f value cen be set and returned
* @covers \phpOMS\Algorithm\PathFinding\JumpPointNode
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The f value cen be set and returned')]
public function testFInputOutput() : void
{
$this->node->setF(2.0);

View File

@ -24,10 +24,10 @@ use phpOMS\Algorithm\PathFinding\Path;
require_once __DIR__ . '/../../Autoloader.php';
/**
* @testdox phpOMS\tests\Algorithm\PathFinding\JumpPointSearchTest: JumpPoint path finding
*
* @internal
*/
#[\PHPUnit\Framework\Attributes\CoversClass(\phpOMS\Algorithm\PathFinding\JumpPointSearch::class)]
#[\PHPUnit\Framework\Attributes\TestDox('phpOMS\tests\Algorithm\PathFinding\JumpPointSearchTest: JumpPoint path finding')]
final class JumpPointSearchTest extends \PHPUnit\Framework\TestCase
{
private array $gridArray = [
@ -75,11 +75,8 @@ final class JumpPointSearchTest extends \PHPUnit\Framework\TestCase
}
}
/**
* @testdox The correct path is found for diagonal movement
* @covers \phpOMS\Algorithm\PathFinding\JumpPointSearch
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The correct path is found for diagonal movement')]
public function testPathFindingDiagonal() : void
{
$grid = Grid::createGridFromArray($this->gridArray, JumpPointNode::class);
@ -119,11 +116,8 @@ final class JumpPointSearchTest extends \PHPUnit\Framework\TestCase
], $this->gridArray);
}
/**
* @testdox The correct path is found for straight movement
* @covers \phpOMS\Algorithm\PathFinding\JumpPointSearch
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The correct path is found for straight movement')]
public function testPathFindingStraight() : void
{
$grid = Grid::createGridFromArray($this->gridArray, JumpPointNode::class);
@ -163,11 +157,8 @@ final class JumpPointSearchTest extends \PHPUnit\Framework\TestCase
], $this->gridArray);
}
/**
* @testdox The correct path is found for diagonal movement [one obstacle]
* @covers \phpOMS\Algorithm\PathFinding\JumpPointSearch
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The correct path is found for diagonal movement [one obstacle]')]
public function testPathFindingDiagonalOneObstacle() : void
{
$grid = Grid::createGridFromArray($this->gridArray, JumpPointNode::class);
@ -207,11 +198,8 @@ final class JumpPointSearchTest extends \PHPUnit\Framework\TestCase
], $this->gridArray);
}
/**
* @testdox The correct path is found for diagonal movement [no obstacle]
* @covers \phpOMS\Algorithm\PathFinding\JumpPointSearch
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The correct path is found for diagonal movement [no obstacle]')]
public function testPathFindingDiagonalNoObstacle() : void
{
$grid = Grid::createGridFromArray($this->gridArray, JumpPointNode::class);
@ -251,11 +239,8 @@ final class JumpPointSearchTest extends \PHPUnit\Framework\TestCase
], $this->gridArray);
}
/**
* @testdox A invalid start or end node returns the grid
* @covers \phpOMS\Algorithm\PathFinding\JumpPointSearch
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('A invalid start or end node returns the grid')]
public function testInvalidStartEndNode() : void
{
$grid = Grid::createGridFromArray($this->gridArray, JumpPointNode::class);

View File

@ -19,17 +19,14 @@ use phpOMS\Algorithm\PathFinding\Node;
require_once __DIR__ . '/../../Autoloader.php';
/**
* @testdox phpOMS\tests\Algorithm\PathFinding\NodeTest: Node on grid for path finding
*
* @internal
*/
#[\PHPUnit\Framework\Attributes\CoversClass(\phpOMS\Algorithm\PathFinding\Node::class)]
#[\PHPUnit\Framework\Attributes\TestDox('phpOMS\tests\Algorithm\PathFinding\NodeTest: Node on grid for path finding')]
final class NodeTest extends \PHPUnit\Framework\TestCase
{
/**
* @testdox The node has the expected values after initialization
* @covers \phpOMS\Algorithm\PathFinding\Node
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The node has the expected values after initialization')]
public function testDefault() : void
{
$node = new Node(1, 2, 3.0, false);
@ -42,11 +39,8 @@ final class NodeTest extends \PHPUnit\Framework\TestCase
self::assertFalse($node->isWalkable);
}
/**
* @testdox Nodes with equal coordinates are equal
* @covers \phpOMS\Algorithm\PathFinding\Node
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('Nodes with equal coordinates are equal')]
public function testNodesWithEqualCoordinatesAreEqual() : void
{
$node = new Node(1, 2, 3.0, false);
@ -55,11 +49,8 @@ final class NodeTest extends \PHPUnit\Framework\TestCase
self::assertTrue($node->isEqual($node2));
}
/**
* @testdox Nodes with different coordinates are not equal
* @covers \phpOMS\Algorithm\PathFinding\Node
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('Nodes with different coordinates are not equal')]
public function testNodesWithDifferentCoordinatesAreNotEqual() : void
{
$node = new Node(1, 2, 3.0, false);
@ -68,11 +59,8 @@ final class NodeTest extends \PHPUnit\Framework\TestCase
self::assertFalse($node->isEqual($node2));
}
/**
* @testdox A parent node can be set and returned
* @covers \phpOMS\Algorithm\PathFinding\Node
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('A parent node can be set and returned')]
public function testParentInputOutput() : void
{
$node = new Node(1, 2, 3.0, false);

View File

@ -21,17 +21,14 @@ use phpOMS\Algorithm\PathFinding\Path;
require_once __DIR__ . '/../../Autoloader.php';
/**
* @testdox phpOMS\tests\Algorithm\PathFinding\PathTest: Path on grid
*
* @internal
*/
#[\PHPUnit\Framework\Attributes\CoversClass(\phpOMS\Algorithm\PathFinding\Path::class)]
#[\PHPUnit\Framework\Attributes\TestDox('phpOMS\tests\Algorithm\PathFinding\PathTest: Path on grid')]
final class PathTest extends \PHPUnit\Framework\TestCase
{
/**
* @testdox The path has the expected values after initialization
* @covers \phpOMS\Algorithm\PathFinding\Path
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The path has the expected values after initialization')]
public function testDefault() : void
{
$path = new Path(new Grid());
@ -40,11 +37,8 @@ final class PathTest extends \PHPUnit\Framework\TestCase
self::assertEquals([], $path->expandPath());
}
/**
* @testdox The diagonal euclidean path length is calculated correctly
* @covers \phpOMS\Algorithm\PathFinding\Path
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The diagonal euclidean path length is calculated correctly')]
public function testDiagonalPathLength() : void
{
$grid = Grid::createGridFromArray([
@ -64,11 +58,8 @@ final class PathTest extends \PHPUnit\Framework\TestCase
self::assertEqualsWithDelta(4.2426, $path->getLength(), 0.001);
}
/**
* @testdox The straight euclidean path length is calculated correctly
* @covers \phpOMS\Algorithm\PathFinding\Path
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The straight euclidean path length is calculated correctly')]
public function testStraightPathLength() : void
{
$grid = Grid::createGridFromArray([
@ -88,11 +79,8 @@ final class PathTest extends \PHPUnit\Framework\TestCase
self::assertEqualsWithDelta(4.0, $path->getLength(), 0.001);
}
/**
* @testdox The path is correctly expanded in case only jump points are defined
* @covers \phpOMS\Algorithm\PathFinding\Path
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The path is correctly expanded in case only jump points are defined')]
public function testPathExpansion() : void
{
$grid = Grid::createGridFromArray([

View File

@ -19,17 +19,14 @@ use phpOMS\Algorithm\Rating\Elo;
require_once __DIR__ . '/../../Autoloader.php';
/**
* @testdox phpOMS\tests\Algorithm\Rating\EloTest: Rating generation
*
* @internal
*/
#[\PHPUnit\Framework\Attributes\CoversClass(\phpOMS\Algorithm\Rating\Elo::class)]
#[\PHPUnit\Framework\Attributes\TestDox('phpOMS\tests\Algorithm\Rating\EloTest: Rating generation')]
final class EloTest extends \PHPUnit\Framework\TestCase
{
/**
* @testdox 1v1 rating test
* @covers \phpOMS\Algorithm\Rating\Elo
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('1v1 rating test')]
public function testSoloRating() : void
{
$rating = new Elo();
@ -79,11 +76,8 @@ final class EloTest extends \PHPUnit\Framework\TestCase
);
}
/**
* @testdox group rating test
* @covers \phpOMS\Algorithm\Rating\Elo
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('group rating test')]
public function testGroupRating() : void
{
$rating = new Elo();

View File

@ -19,17 +19,14 @@ use phpOMS\Algorithm\Rating\Glicko1;
require_once __DIR__ . '/../../Autoloader.php';
/**
* @testdox phpOMS\tests\Algorithm\Rating\Glicko1Test: Rating generation
*
* @internal
*/
#[\PHPUnit\Framework\Attributes\CoversClass(\phpOMS\Algorithm\Rating\Glicko1::class)]
#[\PHPUnit\Framework\Attributes\TestDox('phpOMS\tests\Algorithm\Rating\Glicko1Test: Rating generation')]
final class Glicko1Test extends \PHPUnit\Framework\TestCase
{
/**
* @testdox 1v1 rating test
* @covers \phpOMS\Algorithm\Rating\Glicko1
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('1v1 rating test')]
public function testSoloRating() : void
{
$rating = new Glicko1();
@ -120,11 +117,8 @@ final class Glicko1Test extends \PHPUnit\Framework\TestCase
);
}
/**
* @testdox group rating test
* @covers \phpOMS\Algorithm\Rating\Glicko1
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('group rating test')]
public function testGroupRating() : void
{
$rating = new Glicko1();

View File

@ -19,17 +19,14 @@ use phpOMS\Algorithm\Rating\Glicko2;
require_once __DIR__ . '/../../Autoloader.php';
/**
* @testdox phpOMS\tests\Algorithm\Rating\Glicko2Test: Rating generation
*
* @internal
*/
#[\PHPUnit\Framework\Attributes\CoversClass(\phpOMS\Algorithm\Rating\Glicko2::class)]
#[\PHPUnit\Framework\Attributes\TestDox('phpOMS\tests\Algorithm\Rating\Glicko2Test: Rating generation')]
final class Glicko2Test extends \PHPUnit\Framework\TestCase
{
/**
* @testdox 1v1 rating test
* @covers \phpOMS\Algorithm\Rating\Glicko2
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('1v1 rating test')]
public function testSoloRating() : void
{
$rating = new Glicko2();
@ -140,11 +137,8 @@ final class Glicko2Test extends \PHPUnit\Framework\TestCase
);
}
/**
* @testdox group rating test
* @covers \phpOMS\Algorithm\Rating\Glicko2
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('group rating test')]
public function testGroupRating() : void
{
$rating = new Glicko2();

View File

@ -20,10 +20,9 @@ use phpOMS\Algorithm\Sort\SortOrder;
require_once __DIR__ . '/../../Autoloader.php';
/**
* @testdox phpOMS\tests\Algorithm\Sort\BitonicSortTest: Bitonic sort
*
* @internal
*/
#[\PHPUnit\Framework\Attributes\TestDox('phpOMS\tests\Algorithm\Sort\BitonicSortTest: Bitonic sort')]
final class BitonicSortTest extends \PHPUnit\Framework\TestCase
{
protected $list = [];
@ -41,10 +40,8 @@ final class BitonicSortTest extends \PHPUnit\Framework\TestCase
];
}
/**
* @testdox A list with one element returns the list with the element itself
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('A list with one element returns the list with the element itself')]
public function testSmallList() : void
{
$smallList = [new NumericElement(3)];
@ -53,10 +50,8 @@ final class BitonicSortTest extends \PHPUnit\Framework\TestCase
self::assertEquals($smallList, $newList);
}
/**
* @testdox A list ot elements can be sorted in ASC order
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('A list ot elements can be sorted in ASC order')]
public function testSortASC() : void
{
$newList = BitonicSort::sort($this->list);
@ -69,10 +64,8 @@ final class BitonicSortTest extends \PHPUnit\Framework\TestCase
);
}
/**
* @testdox A list ot elements can be sorted in DESC order
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('A list ot elements can be sorted in DESC order')]
public function testSortDESC() : void
{
$newList = BitonicSort::sort($this->list, SortOrder::DESC);

View File

@ -20,10 +20,9 @@ use phpOMS\Algorithm\Sort\SortOrder;
require_once __DIR__ . '/../../Autoloader.php';
/**
* @testdox phpOMS\tests\Algorithm\Sort\BubbleSortTest: Bubble sort
*
* @internal
*/
#[\PHPUnit\Framework\Attributes\TestDox('phpOMS\tests\Algorithm\Sort\BubbleSortTest: Bubble sort')]
final class BubbleSortTest extends \PHPUnit\Framework\TestCase
{
protected $list = [];
@ -42,10 +41,8 @@ final class BubbleSortTest extends \PHPUnit\Framework\TestCase
];
}
/**
* @testdox A list with one element returns the list with the element itself
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('A list with one element returns the list with the element itself')]
public function testSmallList() : void
{
$smallList = [new NumericElement(3)];
@ -54,10 +51,8 @@ final class BubbleSortTest extends \PHPUnit\Framework\TestCase
self::assertEquals($smallList, $newList);
}
/**
* @testdox A list ot elements can be sorted in ASC order
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('A list ot elements can be sorted in ASC order')]
public function testSortASC() : void
{
$newList = BubbleSort::sort($this->list);
@ -70,10 +65,8 @@ final class BubbleSortTest extends \PHPUnit\Framework\TestCase
);
}
/**
* @testdox A list ot elements can be sorted in DESC order
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('A list ot elements can be sorted in DESC order')]
public function testSortDESC() : void
{
$newList = BubbleSort::sort($this->list, SortOrder::DESC);

View File

@ -20,10 +20,9 @@ use phpOMS\Algorithm\Sort\SortOrder;
require_once __DIR__ . '/../../Autoloader.php';
/**
* @testdox phpOMS\tests\Algorithm\Sort\BucketSortTest: Bucket sort
*
* @internal
*/
#[\PHPUnit\Framework\Attributes\TestDox('phpOMS\tests\Algorithm\Sort\BucketSortTest: Bucket sort')]
final class BucketSortTest extends \PHPUnit\Framework\TestCase
{
protected $list = [];
@ -42,10 +41,8 @@ final class BucketSortTest extends \PHPUnit\Framework\TestCase
];
}
/**
* @testdox A list with one element returns the list with the element itself
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('A list with one element returns the list with the element itself')]
public function testSmallList() : void
{
$smallList = [new NumericElement(3)];
@ -54,10 +51,8 @@ final class BucketSortTest extends \PHPUnit\Framework\TestCase
self::assertEquals($smallList, $newList);
}
/**
* @testdox A list ot elements can be sorted in ASC order
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('A list ot elements can be sorted in ASC order')]
public function testSortASC() : void
{
$newList = BucketSort::sort($this->list, 2, \phpOMS\Algorithm\Sort\SelectionSort::class);
@ -70,10 +65,8 @@ final class BucketSortTest extends \PHPUnit\Framework\TestCase
);
}
/**
* @testdox A list ot elements can be sorted in DESC order
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('A list ot elements can be sorted in DESC order')]
public function testSortDESC() : void
{
$newList = BucketSort::sort($this->list, 2, \phpOMS\Algorithm\Sort\SelectionSort::class, SortOrder::DESC);
@ -86,10 +79,8 @@ final class BucketSortTest extends \PHPUnit\Framework\TestCase
);
}
/**
* @testdox If no buckets are specified the elements cannot be sorted and an empty result is returned
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('If no buckets are specified the elements cannot be sorted and an empty result is returned')]
public function testNoBuckets() : void
{
$newList = BucketSort::sort($this->list, 0, \phpOMS\Algorithm\Sort\SelectionSort::class);

View File

@ -20,10 +20,9 @@ use phpOMS\Algorithm\Sort\SortOrder;
require_once __DIR__ . '/../../Autoloader.php';
/**
* @testdox phpOMS\tests\Algorithm\Sort\CocktailShakerSortTest: CocktailShaker sort
*
* @internal
*/
#[\PHPUnit\Framework\Attributes\TestDox('phpOMS\tests\Algorithm\Sort\CocktailShakerSortTest: CocktailShaker sort')]
final class CocktailShakerSortTest extends \PHPUnit\Framework\TestCase
{
protected $list = [];
@ -42,10 +41,8 @@ final class CocktailShakerSortTest extends \PHPUnit\Framework\TestCase
];
}
/**
* @testdox A list with one element returns the list with the element itself
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('A list with one element returns the list with the element itself')]
public function testSmallList() : void
{
$smallList = [new NumericElement(3)];
@ -54,10 +51,8 @@ final class CocktailShakerSortTest extends \PHPUnit\Framework\TestCase
self::assertEquals($smallList, $newList);
}
/**
* @testdox A list ot elements can be sorted in ASC order
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('A list ot elements can be sorted in ASC order')]
public function testSortASC() : void
{
$newList = CocktailShakerSort::sort($this->list);
@ -70,10 +65,8 @@ final class CocktailShakerSortTest extends \PHPUnit\Framework\TestCase
);
}
/**
* @testdox A list ot elements can be sorted in DESC order
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('A list ot elements can be sorted in DESC order')]
public function testSortDESC() : void
{
$newList = CocktailShakerSort::sort($this->list, SortOrder::DESC);

View File

@ -20,10 +20,9 @@ use phpOMS\Algorithm\Sort\SortOrder;
require_once __DIR__ . '/../../Autoloader.php';
/**
* @testdox phpOMS\tests\Algorithm\Sort\CombSortTest: Comb sort
*
* @internal
*/
#[\PHPUnit\Framework\Attributes\TestDox('phpOMS\tests\Algorithm\Sort\CombSortTest: Comb sort')]
final class CombSortTest extends \PHPUnit\Framework\TestCase
{
protected $list = [];
@ -42,10 +41,8 @@ final class CombSortTest extends \PHPUnit\Framework\TestCase
];
}
/**
* @testdox A list with one element returns the list with the element itself
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('A list with one element returns the list with the element itself')]
public function testSmallList() : void
{
$smallList = [new NumericElement(3)];
@ -54,10 +51,8 @@ final class CombSortTest extends \PHPUnit\Framework\TestCase
self::assertEquals($smallList, $newList);
}
/**
* @testdox A list ot elements can be sorted in ASC order
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('A list ot elements can be sorted in ASC order')]
public function testSortASC() : void
{
$newList = CombSort::sort($this->list);
@ -70,10 +65,8 @@ final class CombSortTest extends \PHPUnit\Framework\TestCase
);
}
/**
* @testdox A list ot elements can be sorted in DESC order
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('A list ot elements can be sorted in DESC order')]
public function testSortDESC() : void
{
$newList = CombSort::sort($this->list, SortOrder::DESC);

View File

@ -20,10 +20,9 @@ use phpOMS\Algorithm\Sort\SortOrder;
require_once __DIR__ . '/../../Autoloader.php';
/**
* @testdox phpOMS\tests\Algorithm\Sort\CycleSortTest: Cycle sort
*
* @internal
*/
#[\PHPUnit\Framework\Attributes\TestDox('phpOMS\tests\Algorithm\Sort\CycleSortTest: Cycle sort')]
final class CycleSortTest extends \PHPUnit\Framework\TestCase
{
protected $list = [];
@ -43,10 +42,8 @@ final class CycleSortTest extends \PHPUnit\Framework\TestCase
];
}
/**
* @testdox A list with one element returns the list with the element itself
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('A list with one element returns the list with the element itself')]
public function testSmallList() : void
{
$smallList = [new NumericElement(3)];
@ -55,10 +52,8 @@ final class CycleSortTest extends \PHPUnit\Framework\TestCase
self::assertEquals($smallList, $newList);
}
/**
* @testdox A list ot elements can be sorted in ASC order
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('A list ot elements can be sorted in ASC order')]
public function testSortASC() : void
{
$newList = CycleSort::sort($this->list);
@ -71,10 +66,8 @@ final class CycleSortTest extends \PHPUnit\Framework\TestCase
);
}
/**
* @testdox A list ot elements can be sorted in DESC order
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('A list ot elements can be sorted in DESC order')]
public function testSortDESC() : void
{
$newList = CycleSort::sort($this->list, SortOrder::DESC);

View File

@ -20,10 +20,9 @@ use phpOMS\Algorithm\Sort\SortOrder;
require_once __DIR__ . '/../../Autoloader.php';
/**
* @testdox phpOMS\tests\Algorithm\Sort\GnomeSortTest: Gnome sort
*
* @internal
*/
#[\PHPUnit\Framework\Attributes\TestDox('phpOMS\tests\Algorithm\Sort\GnomeSortTest: Gnome sort')]
final class GnomeSortTest extends \PHPUnit\Framework\TestCase
{
protected $list = [];
@ -42,10 +41,8 @@ final class GnomeSortTest extends \PHPUnit\Framework\TestCase
];
}
/**
* @testdox A list with one element returns the list with the element itself
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('A list with one element returns the list with the element itself')]
public function testSmallList() : void
{
$smallList = [new NumericElement(3)];
@ -54,10 +51,8 @@ final class GnomeSortTest extends \PHPUnit\Framework\TestCase
self::assertEquals($smallList, $newList);
}
/**
* @testdox A list ot elements can be sorted in ASC order
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('A list ot elements can be sorted in ASC order')]
public function testSortASC() : void
{
$newList = GnomeSort::sort($this->list);
@ -70,10 +65,8 @@ final class GnomeSortTest extends \PHPUnit\Framework\TestCase
);
}
/**
* @testdox A list ot elements can be sorted in DESC order
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('A list ot elements can be sorted in DESC order')]
public function testSortDESC() : void
{
$newList = GnomeSort::sort($this->list, SortOrder::DESC);

View File

@ -20,10 +20,9 @@ use phpOMS\Algorithm\Sort\SortOrder;
require_once __DIR__ . '/../../Autoloader.php';
/**
* @testdox phpOMS\tests\Algorithm\Sort\HeapSortTest: Heap sort
*
* @internal
*/
#[\PHPUnit\Framework\Attributes\TestDox('phpOMS\tests\Algorithm\Sort\HeapSortTest: Heap sort')]
final class HeapSortTest extends \PHPUnit\Framework\TestCase
{
protected $list = [];
@ -42,10 +41,8 @@ final class HeapSortTest extends \PHPUnit\Framework\TestCase
];
}
/**
* @testdox A list with one element returns the list with the element itself
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('A list with one element returns the list with the element itself')]
public function testSmallList() : void
{
$smallList = [new NumericElement(3)];
@ -54,10 +51,8 @@ final class HeapSortTest extends \PHPUnit\Framework\TestCase
self::assertEquals($smallList, $newList);
}
/**
* @testdox A list ot elements can be sorted in ASC order
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('A list ot elements can be sorted in ASC order')]
public function testSortASC() : void
{
$newList = HeapSort::sort($this->list);
@ -70,10 +65,8 @@ final class HeapSortTest extends \PHPUnit\Framework\TestCase
);
}
/**
* @testdox A list ot elements can be sorted in DESC order
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('A list ot elements can be sorted in DESC order')]
public function testSortDESC() : void
{
$newList = HeapSort::sort($this->list, SortOrder::DESC);

View File

@ -20,10 +20,9 @@ use phpOMS\Algorithm\Sort\SortOrder;
require_once __DIR__ . '/../../Autoloader.php';
/**
* @testdox phpOMS\tests\Algorithm\Sort\InsertionSortTest: Insertion sort
*
* @internal
*/
#[\PHPUnit\Framework\Attributes\TestDox('phpOMS\tests\Algorithm\Sort\InsertionSortTest: Insertion sort')]
final class InsertionSortTest extends \PHPUnit\Framework\TestCase
{
protected $list = [];
@ -42,10 +41,8 @@ final class InsertionSortTest extends \PHPUnit\Framework\TestCase
];
}
/**
* @testdox A list with one element returns the list with the element itself
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('A list with one element returns the list with the element itself')]
public function testSmallList() : void
{
$smallList = [new NumericElement(3)];
@ -54,10 +51,8 @@ final class InsertionSortTest extends \PHPUnit\Framework\TestCase
self::assertEquals($smallList, $newList);
}
/**
* @testdox A list ot elements can be sorted in ASC order
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('A list ot elements can be sorted in ASC order')]
public function testSortASC() : void
{
$newList = InsertionSort::sort($this->list);
@ -70,10 +65,8 @@ final class InsertionSortTest extends \PHPUnit\Framework\TestCase
);
}
/**
* @testdox A list ot elements can be sorted in DESC order
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('A list ot elements can be sorted in DESC order')]
public function testSortDESC() : void
{
$newList = InsertionSort::sort($this->list, SortOrder::DESC);

View File

@ -20,10 +20,9 @@ use phpOMS\Algorithm\Sort\SortOrder;
require_once __DIR__ . '/../../Autoloader.php';
/**
* @testdox phpOMS\tests\Algorithm\Sort\IntroSortTest: Intro sort
*
* @internal
*/
#[\PHPUnit\Framework\Attributes\TestDox('phpOMS\tests\Algorithm\Sort\IntroSortTest: Intro sort')]
final class IntroSortTest extends \PHPUnit\Framework\TestCase
{
protected $list = [];
@ -42,10 +41,8 @@ final class IntroSortTest extends \PHPUnit\Framework\TestCase
];
}
/**
* @testdox A list with one element returns the list with the element itself
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('A list with one element returns the list with the element itself')]
public function testSmallList() : void
{
$smallList = [new NumericElement(3)];
@ -54,10 +51,8 @@ final class IntroSortTest extends \PHPUnit\Framework\TestCase
self::assertEquals($smallList, $newList);
}
/**
* @testdox A list ot elements can be sorted in ASC order
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('A list ot elements can be sorted in ASC order')]
public function testSortASC() : void
{
$newList = IntroSort::sort($this->list);
@ -99,10 +94,8 @@ final class IntroSortTest extends \PHPUnit\Framework\TestCase
);
}
/**
* @testdox A list ot elements can be sorted in DESC order
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('A list ot elements can be sorted in DESC order')]
public function testSortDESC() : void
{
$newList = IntroSort::sort($this->list, SortOrder::DESC);

View File

@ -20,10 +20,9 @@ use phpOMS\Algorithm\Sort\SortOrder;
require_once __DIR__ . '/../../Autoloader.php';
/**
* @testdox phpOMS\tests\Algorithm\Sort\MergeSortTest: Merge sort
*
* @internal
*/
#[\PHPUnit\Framework\Attributes\TestDox('phpOMS\tests\Algorithm\Sort\MergeSortTest: Merge sort')]
final class MergeSortTest extends \PHPUnit\Framework\TestCase
{
protected $list = [];
@ -42,10 +41,8 @@ final class MergeSortTest extends \PHPUnit\Framework\TestCase
];
}
/**
* @testdox A list with one element returns the list with the element itself
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('A list with one element returns the list with the element itself')]
public function testSmallList() : void
{
$smallList = [new NumericElement(3)];
@ -54,10 +51,8 @@ final class MergeSortTest extends \PHPUnit\Framework\TestCase
self::assertEquals($smallList, $newList);
}
/**
* @testdox A list ot elements can be sorted in ASC order
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('A list ot elements can be sorted in ASC order')]
public function testSortASC() : void
{
$newList = MergeSort::sort($this->list);
@ -70,10 +65,8 @@ final class MergeSortTest extends \PHPUnit\Framework\TestCase
);
}
/**
* @testdox A list ot elements can be sorted in DESC order
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('A list ot elements can be sorted in DESC order')]
public function testSortDESC() : void
{
$newList = MergeSort::sort($this->list, SortOrder::DESC);

View File

@ -20,10 +20,9 @@ use phpOMS\Algorithm\Sort\SortOrder;
require_once __DIR__ . '/../../Autoloader.php';
/**
* @testdox phpOMS\tests\Algorithm\Sort\OddEvenSortTest: OddEven sort
*
* @internal
*/
#[\PHPUnit\Framework\Attributes\TestDox('phpOMS\tests\Algorithm\Sort\OddEvenSortTest: OddEven sort')]
final class OddEvenSortTest extends \PHPUnit\Framework\TestCase
{
protected $list = [];
@ -42,10 +41,8 @@ final class OddEvenSortTest extends \PHPUnit\Framework\TestCase
];
}
/**
* @testdox A list with one element returns the list with the element itself
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('A list with one element returns the list with the element itself')]
public function testSmallList() : void
{
$smallList = [new NumericElement(3)];
@ -54,10 +51,8 @@ final class OddEvenSortTest extends \PHPUnit\Framework\TestCase
self::assertEquals($smallList, $newList);
}
/**
* @testdox A list ot elements can be sorted in ASC order
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('A list ot elements can be sorted in ASC order')]
public function testSortASC() : void
{
$newList = OddEvenSort::sort($this->list);
@ -70,10 +65,8 @@ final class OddEvenSortTest extends \PHPUnit\Framework\TestCase
);
}
/**
* @testdox A list ot elements can be sorted in DESC order
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('A list ot elements can be sorted in DESC order')]
public function testSortDESC() : void
{
$newList = OddEvenSort::sort($this->list, SortOrder::DESC);

View File

@ -20,10 +20,9 @@ use phpOMS\Algorithm\Sort\SortOrder;
require_once __DIR__ . '/../../Autoloader.php';
/**
* @testdox phpOMS\tests\Algorithm\Sort\PancakeSortTest: Pancake sort
*
* @internal
*/
#[\PHPUnit\Framework\Attributes\TestDox('phpOMS\tests\Algorithm\Sort\PancakeSortTest: Pancake sort')]
final class PancakeSortTest extends \PHPUnit\Framework\TestCase
{
protected $list = [];
@ -42,10 +41,8 @@ final class PancakeSortTest extends \PHPUnit\Framework\TestCase
];
}
/**
* @testdox A list with one element returns the list with the element itself
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('A list with one element returns the list with the element itself')]
public function testSmallList() : void
{
$smallList = [new NumericElement(3)];
@ -54,10 +51,8 @@ final class PancakeSortTest extends \PHPUnit\Framework\TestCase
self::assertEquals($smallList, $newList);
}
/**
* @testdox A list ot elements can be sorted in ASC order
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('A list ot elements can be sorted in ASC order')]
public function testSortASC() : void
{
$newList = PancakeSort::sort($this->list);
@ -70,10 +65,8 @@ final class PancakeSortTest extends \PHPUnit\Framework\TestCase
);
}
/**
* @testdox A list ot elements can be sorted in DESC order
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('A list ot elements can be sorted in DESC order')]
public function testSortDESC() : void
{
$newList = PancakeSort::sort($this->list, SortOrder::DESC);

View File

@ -20,10 +20,9 @@ use phpOMS\Algorithm\Sort\SortOrder;
require_once __DIR__ . '/../../Autoloader.php';
/**
* @testdox phpOMS\tests\Algorithm\Sort\QuickSortTest: Quick sort
*
* @internal
*/
#[\PHPUnit\Framework\Attributes\TestDox('phpOMS\tests\Algorithm\Sort\QuickSortTest: Quick sort')]
final class QuickSortTest extends \PHPUnit\Framework\TestCase
{
protected $list = [];
@ -42,10 +41,8 @@ final class QuickSortTest extends \PHPUnit\Framework\TestCase
];
}
/**
* @testdox A list with one element returns the list with the element itself
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('A list with one element returns the list with the element itself')]
public function testSmallList() : void
{
$smallList = [new NumericElement(3)];
@ -54,10 +51,8 @@ final class QuickSortTest extends \PHPUnit\Framework\TestCase
self::assertEquals($smallList, $newList);
}
/**
* @testdox A list ot elements can be sorted in ASC order
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('A list ot elements can be sorted in ASC order')]
public function testSortASC() : void
{
$newList = QuickSort::sort($this->list);
@ -70,10 +65,8 @@ final class QuickSortTest extends \PHPUnit\Framework\TestCase
);
}
/**
* @testdox A list ot elements can be sorted in DESC order
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('A list ot elements can be sorted in DESC order')]
public function testSortDESC() : void
{
$newList = QuickSort::sort($this->list, SortOrder::DESC);

View File

@ -20,10 +20,9 @@ use phpOMS\Algorithm\Sort\SortOrder;
require_once __DIR__ . '/../../Autoloader.php';
/**
* @testdox phpOMS\tests\Algorithm\Sort\SelectionSortTest: Selection sort
*
* @internal
*/
#[\PHPUnit\Framework\Attributes\TestDox('phpOMS\tests\Algorithm\Sort\SelectionSortTest: Selection sort')]
final class SelectionSortTest extends \PHPUnit\Framework\TestCase
{
protected $list = [];
@ -42,10 +41,8 @@ final class SelectionSortTest extends \PHPUnit\Framework\TestCase
];
}
/**
* @testdox A list with one element returns the list with the element itself
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('A list with one element returns the list with the element itself')]
public function testSmallList() : void
{
$smallList = [new NumericElement(3)];
@ -54,10 +51,8 @@ final class SelectionSortTest extends \PHPUnit\Framework\TestCase
self::assertEquals($smallList, $newList);
}
/**
* @testdox A list ot elements can be sorted in ASC order
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('A list ot elements can be sorted in ASC order')]
public function testSortASC() : void
{
$newList = SelectionSort::sort($this->list);
@ -70,10 +65,8 @@ final class SelectionSortTest extends \PHPUnit\Framework\TestCase
);
}
/**
* @testdox A list ot elements can be sorted in DESC order
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('A list ot elements can be sorted in DESC order')]
public function testSortDESC() : void
{
$newList = SelectionSort::sort($this->list, SortOrder::DESC);

View File

@ -20,10 +20,9 @@ use phpOMS\Algorithm\Sort\SortOrder;
require_once __DIR__ . '/../../Autoloader.php';
/**
* @testdox phpOMS\tests\Algorithm\Sort\ShellSortTest: Shell sort
*
* @internal
*/
#[\PHPUnit\Framework\Attributes\TestDox('phpOMS\tests\Algorithm\Sort\ShellSortTest: Shell sort')]
final class ShellSortTest extends \PHPUnit\Framework\TestCase
{
protected $list = [];
@ -42,10 +41,8 @@ final class ShellSortTest extends \PHPUnit\Framework\TestCase
];
}
/**
* @testdox A list with one element returns the list with the element itself
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('A list with one element returns the list with the element itself')]
public function testSmallList() : void
{
$smallList = [new NumericElement(3)];
@ -54,10 +51,8 @@ final class ShellSortTest extends \PHPUnit\Framework\TestCase
self::assertEquals($smallList, $newList);
}
/**
* @testdox A list ot elements can be sorted in ASC order
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('A list ot elements can be sorted in ASC order')]
public function testSortASC() : void
{
$newList = ShellSort::sort($this->list);
@ -70,10 +65,8 @@ final class ShellSortTest extends \PHPUnit\Framework\TestCase
);
}
/**
* @testdox A list ot elements can be sorted in DESC order
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('A list ot elements can be sorted in DESC order')]
public function testSortDESC() : void
{
$newList = ShellSort::sort($this->list, SortOrder::DESC);

View File

@ -20,10 +20,9 @@ use phpOMS\Algorithm\Sort\StoogeSort;
require_once __DIR__ . '/../../Autoloader.php';
/**
* @testdox phpOMS\tests\Algorithm\Sort\StoogeSortTest: Stooge sort
*
* @internal
*/
#[\PHPUnit\Framework\Attributes\TestDox('phpOMS\tests\Algorithm\Sort\StoogeSortTest: Stooge sort')]
final class StoogeSortTest extends \PHPUnit\Framework\TestCase
{
protected $list = [];
@ -43,10 +42,8 @@ final class StoogeSortTest extends \PHPUnit\Framework\TestCase
];
}
/**
* @testdox A list with one element returns the list with the element itself
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('A list with one element returns the list with the element itself')]
public function testSmallList() : void
{
$smallList = [new NumericElement(3)];
@ -55,10 +52,8 @@ final class StoogeSortTest extends \PHPUnit\Framework\TestCase
self::assertEquals($smallList, $newList);
}
/**
* @testdox A list ot elements can be sorted in ASC order
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('A list ot elements can be sorted in ASC order')]
public function testSortASC() : void
{
$newList = StoogeSort::sort($this->list);
@ -71,10 +66,8 @@ final class StoogeSortTest extends \PHPUnit\Framework\TestCase
);
}
/**
* @testdox A list ot elements can be sorted in DESC order
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('A list ot elements can be sorted in DESC order')]
public function testSortDESC() : void
{
$newList = StoogeSort::sort($this->list, SortOrder::DESC);

View File

@ -20,10 +20,9 @@ use phpOMS\Algorithm\Sort\TimSort;
require_once __DIR__ . '/../../Autoloader.php';
/**
* @testdox phpOMS\tests\Algorithm\Sort\TimSortTest: Tim sort
*
* @internal
*/
#[\PHPUnit\Framework\Attributes\TestDox('phpOMS\tests\Algorithm\Sort\TimSortTest: Tim sort')]
final class TimSortTest extends \PHPUnit\Framework\TestCase
{
protected $list = [];
@ -42,10 +41,8 @@ final class TimSortTest extends \PHPUnit\Framework\TestCase
];
}
/**
* @testdox A list with one element returns the list with the element itself
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('A list with one element returns the list with the element itself')]
public function testSmallList() : void
{
$smallList = [new NumericElement(3)];
@ -54,10 +51,8 @@ final class TimSortTest extends \PHPUnit\Framework\TestCase
self::assertEquals($smallList, $newList);
}
/**
* @testdox A list ot elements can be sorted in ASC order
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('A list ot elements can be sorted in ASC order')]
public function testSortASC() : void
{
$newList = TimSort::sort($this->list);
@ -99,10 +94,8 @@ final class TimSortTest extends \PHPUnit\Framework\TestCase
);
}
/**
* @testdox A list ot elements can be sorted in DESC order
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('A list ot elements can be sorted in DESC order')]
public function testSortDESC() : void
{
$newList = TimSort::sort($this->list, SortOrder::DESC);

View File

@ -17,17 +17,14 @@ namespace phpOMS\tests\Api\EUVAT;
use phpOMS\Api\EUVAT\EUVATBffOnline;
/**
* @testdox phpOMS\tests\Api\EUVAT\EUVATBffOnlineTest: EU VAT German BFF Online validation
*
* @internal
*/
#[\PHPUnit\Framework\Attributes\CoversClass(\phpOMS\Api\EUVAT\EUVATBffOnline::class)]
#[\PHPUnit\Framework\Attributes\TestDox('phpOMS\tests\Api\EUVAT\EUVATBffOnlineTest: EU VAT German BFF Online validation')]
final class EUVATBffOnlineTest extends \PHPUnit\Framework\TestCase
{
/**
* @testdox The BFF Online service can validate a valid VAT ID
* @covers \phpOMS\Api\EUVAT\EUVATBffOnline
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The BFF Online service can validate a valid VAT ID')]
public function testValidateInvalidId() : void
{
$status = EUVATBffOnline::validate('DE123456789', 'DE123456789');

View File

@ -17,17 +17,14 @@ namespace phpOMS\tests\Api\EUVAT;
use phpOMS\Api\EUVAT\EUVATVies;
/**
* @testdox phpOMS\tests\Api\EUVAT\EUVATViesTest: EU VAT Vies validation
*
* @internal
*/
#[\PHPUnit\Framework\Attributes\CoversClass(\phpOMS\Api\EUVAT\EUVATVies::class)]
#[\PHPUnit\Framework\Attributes\TestDox('phpOMS\tests\Api\EUVAT\EUVATViesTest: EU VAT Vies validation')]
final class EUVATViesTest extends \PHPUnit\Framework\TestCase
{
/**
* @testdox The VIES service can validate a valid VAT ID
* @covers \phpOMS\Api\EUVAT\EUVATVies
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The VIES service can validate a valid VAT ID')]
public function testValidateInvalidId() : void
{
$status = EUVATVies::validate('DE123456789');

View File

@ -17,10 +17,9 @@ namespace phpOMS\tests\Api\Geocoding;
use phpOMS\Api\Geocoding\Nominatim;
/**
* @testdox phpOMS\tests\Api\Geocoding\NominatimTest: EU VAT Vies validation
*
* @internal
*/
#[\PHPUnit\Framework\Attributes\TestDox('phpOMS\tests\Api\Geocoding\NominatimTest: EU VAT Vies validation')]
final class NominatimTest extends \PHPUnit\Framework\TestCase
{
public function testGeocoding() : void

View File

@ -17,17 +17,14 @@ namespace phpOMS\tests\Application;
use phpOMS\Application\ApplicationAbstract;
/**
* @testdox phpOMS\tests\Application\ApplicationAbstractTest: Application abstraction
*
* @internal
*/
#[\PHPUnit\Framework\Attributes\CoversClass(\phpOMS\Application\ApplicationAbstract::class)]
#[\PHPUnit\Framework\Attributes\TestDox('phpOMS\tests\Application\ApplicationAbstractTest: Application abstraction')]
final class ApplicationAbstractTest extends \PHPUnit\Framework\TestCase
{
/**
* @testdox Application values can be set and returned
* @covers \phpOMS\Application\ApplicationAbstract<extended>
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('Application values can be set and returned')]
public function testInputOutput() : void
{
$obj = new class() extends ApplicationAbstract {};
@ -36,11 +33,8 @@ final class ApplicationAbstractTest extends \PHPUnit\Framework\TestCase
self::assertEquals('Test', $obj->appName);
}
/**
* @testdox Application values cannot be overwritten
* @covers \phpOMS\Application\ApplicationAbstract<extended>
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('Application values cannot be overwritten')]
public function testInvalidInputOutput() : void
{
$obj = new class() extends ApplicationAbstract {};

View File

@ -19,17 +19,14 @@ require_once __DIR__ . '/../Autoloader.php';
use phpOMS\Application\ApplicationInfo;
/**
* @testdox phpOMS\tests\Application\ApplicationInfoTest: Module info file manager
*
* @internal
*/
#[\PHPUnit\Framework\Attributes\CoversClass(\phpOMS\Application\ApplicationInfo::class)]
#[\PHPUnit\Framework\Attributes\TestDox('phpOMS\tests\Application\ApplicationInfoTest: Module info file manager')]
final class ApplicationInfoTest extends \PHPUnit\Framework\TestCase
{
/**
* @testdox An application info file can be correctly loaded
* @covers \phpOMS\Application\ApplicationInfo
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('An application info file can be correctly loaded')]
public function testLoad() : void
{
$info = new ApplicationInfo(__DIR__ . '/info-test.json');
@ -49,11 +46,8 @@ final class ApplicationInfoTest extends \PHPUnit\Framework\TestCase
self::assertEquals(__DIR__ . '/info-test.json', $info->getPath());
}
/**
* @testdox A info file can be modified
* @covers \phpOMS\Application\ApplicationInfo
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('A info file can be modified')]
public function testChange() : void
{
$jarray = \json_decode(\file_get_contents(__DIR__ . '/info-test.json'), true);
@ -73,11 +67,8 @@ final class ApplicationInfoTest extends \PHPUnit\Framework\TestCase
$info->update();
}
/**
* @testdox A invalid info file path load throws a PathException
* @covers \phpOMS\Application\ApplicationInfo
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('A invalid info file path load throws a PathException')]
public function testInvalidPathLoad() : void
{
$this->expectException(\phpOMS\System\File\PathException::class);
@ -86,11 +77,8 @@ final class ApplicationInfoTest extends \PHPUnit\Framework\TestCase
$info->load();
}
/**
* @testdox A invalid info file path update throws a PathException
* @covers \phpOMS\Application\ApplicationInfo
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('A invalid info file path update throws a PathException')]
public function testInvalidPathUpdate() : void
{
$this->expectException(\phpOMS\System\File\PathException::class);
@ -99,11 +87,8 @@ final class ApplicationInfoTest extends \PHPUnit\Framework\TestCase
$info->update();
}
/**
* @testdox A invalid change data throws a InvalidArgumentException
* @covers \phpOMS\Application\ApplicationInfo
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('A invalid change data throws a InvalidArgumentException')]
public function testInvalidDataSet() : void
{
$this->expectException(\InvalidArgumentException::class);

View File

@ -27,10 +27,13 @@ use phpOMS\Router\WebRouter;
use phpOMS\System\File\Local\Directory;
/**
* @testdox phpOMS\tests\Application\ApplicationManagerTest: Application manager
*
* @internal
*/
#[\PHPUnit\Framework\Attributes\CoversClass(\phpOMS\Application\ApplicationManager::class)]
#[\PHPUnit\Framework\Attributes\CoversClass(\phpOMS\Application\InstallerAbstract::class)]
#[\PHPUnit\Framework\Attributes\CoversClass(\phpOMS\Application\StatusAbstract::class)]
#[\PHPUnit\Framework\Attributes\CoversClass(\phpOMS\Application\UninstallerAbstract::class)]
#[\PHPUnit\Framework\Attributes\TestDox('phpOMS\tests\Application\ApplicationManagerTest: Application manager')]
final class ApplicationManagerTest extends \PHPUnit\Framework\TestCase
{
protected ApplicationManager $appManager;
@ -84,14 +87,8 @@ final class ApplicationManagerTest extends \PHPUnit\Framework\TestCase
$this->appManager = new ApplicationManager($app);
}
/**
* @testdox An application can be installed and uninstalled
* @covers \phpOMS\Application\ApplicationManager
* @covers \phpOMS\Application\InstallerAbstract
* @covers \phpOMS\Application\StatusAbstract
* @covers \phpOMS\Application\UninstallerAbstract
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('An application can be installed and uninstalled')]
public function testInstallUninstall() : void
{
self::assertTrue($this->appManager->install(__DIR__ . '/Testapp', __DIR__ . '/Apps/Testapp'));
@ -110,14 +107,8 @@ final class ApplicationManagerTest extends \PHPUnit\Framework\TestCase
self::assertFalse(\is_dir(__DIR__ . '/Apps/Testapp'));
}
/**
* @testdox An application can be re-initialized
* @testdox A module can be re-initialized
* @covers \phpOMS\Application\ApplicationManager
* @covers \phpOMS\Application\InstallerAbstract
* @covers \phpOMS\Application\StatusAbstract
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('An application can be re-initialized')]
public function testReInit() : void
{
Directory::delete(__DIR__ . '/Apps/Testapp');
@ -140,53 +131,38 @@ final class ApplicationManagerTest extends \PHPUnit\Framework\TestCase
Directory::delete(__DIR__ . '/Apps/Testapp');
}
/**
* @testdox A invalid application path results in no installation
* @covers \phpOMS\Application\ApplicationManager
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('A invalid application path results in no installation')]
public function testInvalidSourceDestinationInstallPath() : void
{
self::assertFalse($this->appManager->install(__DIR__ . '/invalid', __DIR__));
self::assertFalse($this->appManager->install(__DIR__, __DIR__));
}
/**
* @testdox A missing installation file results in no installation
* @covers \phpOMS\Application\ApplicationManager
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('A missing installation file results in no installation')]
public function testMissingInstallerPath() : void
{
self::assertFalse($this->appManager->install(__DIR__ . '/MissingInstaller', __DIR__ . '/Apps/MissingInstaller'));
}
/**
* @testdox A missing info file results in no installation
* @covers \phpOMS\Application\ApplicationManager
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('A missing info file results in no installation')]
public function testMissingApplicationInfoFile() : void
{
self::assertFalse($this->appManager->install(__DIR__ . '/MissingInfo', __DIR__ . '/Apps/MissingInfo'));
}
/**
* @testdox A invalid application path results in no uninstall
* @covers \phpOMS\Application\ApplicationManager
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('A invalid application path results in no uninstall')]
public function testInvalidSourceUninstallPath() : void
{
self::assertFalse($this->appManager->uninstall(__DIR__ . '/invalid'));
self::assertFalse($this->appManager->uninstall(__DIR__));
}
/**
* @testdox A missing uninstall file results in no uninstall
* @covers \phpOMS\Application\ApplicationManager
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('A missing uninstall file results in no uninstall')]
public function testMissingUninstallerPath() : void
{
self::assertFalse($this->appManager->uninstall(__DIR__ . '/Apps/MissingInstaller'));

View File

@ -19,10 +19,10 @@ require_once __DIR__ . '/../Autoloader.php';
use phpOMS\Application\InstallerAbstract;
/**
* @testdox phpOMS\tests\Application\InstallerAbstractTest: Abstract application installer
*
* @internal
*/
#[\PHPUnit\Framework\Attributes\CoversClass(\phpOMS\Application\InstallerAbstract::class)]
#[\PHPUnit\Framework\Attributes\TestDox('phpOMS\tests\Application\InstallerAbstractTest: Abstract application installer')]
final class InstallerAbstractTest extends \PHPUnit\Framework\TestCase
{
protected InstallerAbstract $installer;
@ -37,11 +37,8 @@ final class InstallerAbstractTest extends \PHPUnit\Framework\TestCase
};
}
/**
* @testdox An invalid theme cannot be installed
* @covers \phpOMS\Application\InstallerAbstract
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('An invalid theme cannot be installed')]
public function testInvalidTheme() : void
{
$this->installer::installTheme(__DIR__, 'Invalid');

View File

@ -19,10 +19,10 @@ require_once __DIR__ . '/../Autoloader.php';
use phpOMS\Application\StatusAbstract;
/**
* @testdox phpOMS\tests\Application\StatusAbstractTest: Abstract application status
*
* @internal
*/
#[\PHPUnit\Framework\Attributes\CoversClass(\phpOMS\Application\StatusAbstract::class)]
#[\PHPUnit\Framework\Attributes\TestDox('phpOMS\tests\Application\StatusAbstractTest: Abstract application status')]
final class StatusAbstractTest extends \PHPUnit\Framework\TestCase
{
protected StatusAbstract $status;
@ -38,11 +38,8 @@ final class StatusAbstractTest extends \PHPUnit\Framework\TestCase
};
}
/**
* @testdox A invalid application path cannot be activated
* @covers \phpOMS\Application\StatusAbstract
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('A invalid application path cannot be activated')]
public function testInvalidAppPathActivation() : void
{
$this->status::activateRoutes();

View File

@ -21,10 +21,10 @@ use phpOMS\Application\UninstallerAbstract;
use phpOMS\DataStorage\Database\DatabasePool;
/**
* @testdox phpOMS\tests\Application\UninstallerAbstractTest: Abstract application uninstaller
*
* @internal
*/
#[\PHPUnit\Framework\Attributes\CoversClass(\phpOMS\Application\UninstallerAbstract::class)]
#[\PHPUnit\Framework\Attributes\TestDox('phpOMS\tests\Application\UninstallerAbstractTest: Abstract application uninstaller')]
final class UninstallerAbstractTest extends \PHPUnit\Framework\TestCase
{
protected UninstallerAbstract $uninstaller;
@ -40,11 +40,8 @@ final class UninstallerAbstractTest extends \PHPUnit\Framework\TestCase
};
}
/**
* @testdox A missing database schema will not perform any database operations
* @covers \phpOMS\Application\UninstallerAbstract
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('A missing database schema will not perform any database operations')]
public function testMissingDbFileUninstall() : void
{
$this->uninstaller::dropTables(

View File

@ -19,10 +19,9 @@ use phpOMS\Asset\AssetManager;
require_once __DIR__ . '/../Autoloader.php';
/**
* @testdox phpOMS\tests\Asset\AssetManagerTest: Asset manager to handle/access assets
*
* @internal
*/
#[\PHPUnit\Framework\Attributes\TestDox('phpOMS\tests\Asset\AssetManagerTest: Asset manager to handle/access assets')]
final class AssetManagerTest extends \PHPUnit\Framework\TestCase
{
protected $manager = null;
@ -35,20 +34,16 @@ final class AssetManagerTest extends \PHPUnit\Framework\TestCase
$this->manager = new AssetManager();
}
/**
* @testdox The manager has the expected default values after initialization
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The manager has the expected default values after initialization')]
public function testDefault() : void
{
self::assertNull($this->manager->get('myAsset'));
self::assertEquals(0, $this->manager->count());
}
/**
* @testdox An asset can be added to the manager
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('An asset can be added to the manager')]
public function testAddAsset() : void
{
$this->manager->set('first', 'FirstUri');
@ -58,20 +53,16 @@ final class AssetManagerTest extends \PHPUnit\Framework\TestCase
self::assertEquals(2, $this->manager->count());
}
/**
* @testdox An asset can be retrieved from the manager
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('An asset can be retrieved from the manager')]
public function testRetrieveAsset() : void
{
$this->manager->set('myAsset', 'AssetUri');
self::assertEquals('AssetUri', $this->manager->get('myAsset'));
}
/**
* @testdox An asset can only be added once to the manager (no duplication unless overwritten)
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('An asset can only be added once to the manager (no duplication unless overwritten)')]
public function testInvalidAssetReplacement() : void
{
$this->manager->set('myAsset', 'AssetUri');
@ -82,10 +73,8 @@ final class AssetManagerTest extends \PHPUnit\Framework\TestCase
self::assertEquals(1, $this->manager->count());
}
/**
* @testdox An asset can be replaced upon request
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('An asset can be replaced upon request')]
public function testAssetReplacement() : void
{
$this->manager->set('myAsset', 'AssetUri');
@ -101,10 +90,8 @@ final class AssetManagerTest extends \PHPUnit\Framework\TestCase
self::assertEquals(1, $this->manager->count());
}
/**
* @testdox An asset can be removed from the manager
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('An asset can be removed from the manager')]
public function testAssetRemove() : void
{
$this->manager->set('myAsset', 'AssetUri');

View File

@ -19,36 +19,30 @@ require_once __DIR__ . '/../Autoloader.php';
use phpOMS\Asset\AssetType;
/**
* @testdox phpOMS\tests\Asset\AssetType: Asset type
* @internal
*/
#[\PHPUnit\Framework\Attributes\TestDox('phpOMS\tests\Asset\AssetType: Asset type')]
final class AssetTypeTest extends \PHPUnit\Framework\TestCase
{
/**
* @testdox The asset type enum has the correct number of status codes
* @group framework
* @coversNothing
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The asset type enum has the correct number of status codes')]
#[\PHPUnit\Framework\Attributes\CoversNothing]
public function testEnumCount() : void
{
self::assertCount(3, AssetType::getConstants());
}
/**
* @testdox The asset type enum has only unique values
* @group framework
* @coversNothing
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The asset type enum has only unique values')]
#[\PHPUnit\Framework\Attributes\CoversNothing]
public function testUnique() : void
{
self::assertEquals(AssetType::getConstants(), \array_unique(AssetType::getConstants()));
}
/**
* @testdox The asset type enum has the correct values
* @group framework
* @coversNothing
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The asset type enum has the correct values')]
#[\PHPUnit\Framework\Attributes\CoversNothing]
public function testEnums() : void
{
self::assertEquals(0, AssetType::CSS);

View File

@ -19,21 +19,18 @@ use phpOMS\Auth\Auth;
require_once __DIR__ . '/../Autoloader.php';
/**
* @testdox phpOMS\tests\Auth\AuthTest: Account and session authentication
*
* @internal
*/
#[\PHPUnit\Framework\Attributes\TestDox('phpOMS\tests\Auth\AuthTest: Account and session authentication')]
final class AuthTest extends \PHPUnit\Framework\TestCase
{
/**
* @testdox The default http session doesn't authenticate an account
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox("The default http session doesn't authenticate an account")]
public function testAuthWithEmptyHttpSession() : void
{
self::assertEquals(0, Auth::authenticate($GLOBALS['httpSession']));
self::assertEquals(0, Auth::authenticate($GLOBALS['session']));
Auth::logout($GLOBALS['httpSession']);
self::assertEquals(0, Auth::authenticate($GLOBALS['httpSession']));
Auth::logout($GLOBALS['session']);
self::assertEquals(0, Auth::authenticate($GLOBALS['session']));
}
}

View File

@ -19,36 +19,30 @@ require_once __DIR__ . '/../Autoloader.php';
use phpOMS\Auth\LoginReturnType;
/**
* @testdox phpOMS\tests\Auth\LoginReturnType: Login return type
* @internal
*/
#[\PHPUnit\Framework\Attributes\TestDox('phpOMS\tests\Auth\LoginReturnType: Login return type')]
final class LoginReturnTypeTest extends \PHPUnit\Framework\TestCase
{
/**
* @testdox The login return type enum has the correct number of type codes
* @group framework
* @coversNothing
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The login return type enum has the correct number of type codes')]
#[\PHPUnit\Framework\Attributes\CoversNothing]
public function testEnumCount() : void
{
self::assertCount(11, LoginReturnType::getConstants());
}
/**
* @testdox The login return type enum has only unique values
* @group framework
* @coversNothing
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The login return type enum has only unique values')]
#[\PHPUnit\Framework\Attributes\CoversNothing]
public function testUnique() : void
{
self::assertEquals(LoginReturnType::getConstants(), \array_unique(LoginReturnType::getConstants()));
}
/**
* @testdox The login return type enum has the correct values
* @group framework
* @coversNothing
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The login return type enum has the correct values')]
#[\PHPUnit\Framework\Attributes\CoversNothing]
public function testEnums() : void
{
self::assertEquals(0, LoginReturnType::OK);

View File

@ -19,12 +19,10 @@ use phpOMS\AutoloadException;
/**
* @internal
*/
#[\PHPUnit\Framework\Attributes\CoversClass(\phpOMS\AutoloadException::class)]
final class AutoloadExceptionTest extends \PHPUnit\Framework\TestCase
{
/**
* @covers \phpOMS\AutoloadException
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
public function testException() : void
{
self::assertInstanceOf(\RuntimeException::class, new AutoloadException(''));

View File

@ -17,27 +17,21 @@ namespace phpOMS\tests;
use phpOMS\Autoloader;
/**
* @testdox phpOMS\tests\AutoloaderTest: Class autoloader
*
* @internal
*/
#[\PHPUnit\Framework\Attributes\CoversClass(\phpOMS\Autoloader::class)]
#[\PHPUnit\Framework\Attributes\TestDox('phpOMS\tests\AutoloaderTest: Class autoloader')]
final class AutoloaderTest extends \PHPUnit\Framework\TestCase
{
/**
* @testdox Classes can be checked for existence
* @covers \phpOMS\Autoloader
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('Classes can be checked for existence')]
public function testAutoloader() : void
{
self::assertTrue(Autoloader::exists('\phpOMS\Autoloader'));
self::assertFalse(Autoloader::exists('\Does\Not\Exist'));
}
/**
* @covers \phpOMS\Autoloader
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
public function testLoading() : void
{
Autoloader::defaultAutoloader('\phpOMS\tests\TestLoad');
@ -46,10 +40,7 @@ final class AutoloaderTest extends \PHPUnit\Framework\TestCase
self::assertTrue(\in_array(\realpath(__DIR__ . '/TestLoad.php'), $includes));
}
/**
* @covers \phpOMS\Autoloader
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
public function testManualPathLoading() : void
{
Autoloader::addPath(__DIR__ . '/../');
@ -65,10 +56,7 @@ final class AutoloaderTest extends \PHPUnit\Framework\TestCase
self::assertCount(1, Autoloader::findPaths('\phpOMS\Autoloader'));
}
/**
* @covers \phpOMS\Autoloader
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
public function testOpcodeCacheInvalidation() : void
{
if (!\extension_loaded('zend opcache')
@ -88,10 +76,7 @@ final class AutoloaderTest extends \PHPUnit\Framework\TestCase
self::assertTrue(\opcache_is_script_cached(__DIR__ . '/TestLoad3.php'));
}
/**
* @covers \phpOMS\Autoloader
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
public function testUncachedInvalidation() : void
{
self::assertFalse(\opcache_is_script_cached(__DIR__ . '/TestLoad4.php'));

View File

@ -421,6 +421,8 @@ if (\extension_loaded('pdo_sqlsrv')) {
}
}
$GLOBALS['CONFIG'] = $CONFIG;
$httpSession = new HttpSession();
$GLOBALS['session'] = $httpSession;

View File

@ -17,16 +17,13 @@ namespace phpOMS\tests\Business\Finance;
use phpOMS\Business\Finance\Depreciation;
/**
* @testdox phpOMS\tests\Business\Finance\DepreciationTest: Depreciation calculations
*
* @internal
*/
#[\PHPUnit\Framework\Attributes\TestDox('phpOMS\tests\Business\Finance\DepreciationTest: Depreciation calculations')]
final class DepreciationTest extends \PHPUnit\Framework\TestCase
{
/**
* @testdox The straight line depreciation and reverse value calculations are correct
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The straight line depreciation and reverse value calculations are correct')]
public function testStraightLine() : void
{
$start = 23280;
@ -37,10 +34,8 @@ final class DepreciationTest extends \PHPUnit\Framework\TestCase
self::assertEqualsWithDelta(23280 - 3880 * $t, Depreciation::getStraightLineResidualInT($start, $duration, $t), 5);
}
/**
* @testdox The arithmetic degressive depreciation and reverse value calculations are correct
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The arithmetic degressive depreciation and reverse value calculations are correct')]
public function testArithmeticDegressiveDepreciation() : void
{
$start = 150000;
@ -53,10 +48,8 @@ final class DepreciationTest extends \PHPUnit\Framework\TestCase
self::assertEqualsWithDelta(70800, Depreciation::getArithmeticDegressiveDepreciationResidualInT($start, $residual, $duration, $t), 5);
}
/**
* @testdox The arithmetic progressive depreciation and reverse value calculations are correct
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The arithmetic progressive depreciation and reverse value calculations are correct')]
public function testArithmeticProgressiveDepreciation() : void
{
$start = 40000;
@ -69,10 +62,8 @@ final class DepreciationTest extends \PHPUnit\Framework\TestCase
self::assertEqualsWithDelta(29410, Depreciation::getArithmeticProgressiveDepreciationResidualInT($start, $residual, $duration, $t), 5);
}
/**
* @testdox The geometric progressive depreciation and reverse value calculations are correct
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The geometric progressive depreciation and reverse value calculations are correct')]
public function testGeometricProgressiveDepreciation() : void
{
$start = 150000;
@ -85,10 +76,8 @@ final class DepreciationTest extends \PHPUnit\Framework\TestCase
self::assertEqualsWithDelta(125965, Depreciation::getGeometicProgressiveDepreciationResidualInT($start, $residual, $duration, $t), 5);
}
/**
* @testdox The geometric degressive depreciation and reverse value calculations are correct
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The geometric degressive depreciation and reverse value calculations are correct')]
public function testGeometricDegressiveDepreciation() : void
{
$start = 150000;

View File

@ -17,17 +17,14 @@ namespace phpOMS\tests\Business\Finance;
use phpOMS\Business\Finance\FinanceFormulas;
/**
* @testdox phpOMS\tests\Business\Finance\FinanceFormulasTest: Finance formulas
*
* @internal
*/
#[\PHPUnit\Framework\Attributes\CoversClass(\phpOMS\Business\Finance\FinanceFormulas::class)]
#[\PHPUnit\Framework\Attributes\TestDox('phpOMS\tests\Business\Finance\FinanceFormulasTest: Finance formulas')]
final class FinanceFormulasTest extends \PHPUnit\Framework\TestCase
{
/**
* @testdox The annual percentage yield (APY) and reverse value calculations are correct
* @covers \phpOMS\Business\Finance\FinanceFormulas
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The annual percentage yield (APY) and reverse value calculations are correct')]
public function testAnnualPercentageYield() : void
{
$expected = 0.06168;
@ -40,11 +37,8 @@ final class FinanceFormulasTest extends \PHPUnit\Framework\TestCase
self::assertEqualsWithDelta(\round($r, 2), FinanceFormulas::getStateAnnualInterestRateOfAPY($apy, $n), 0.01);
}
/**
* @testdox The future value of annuity (FVA) and reverse value calculations are correct
* @covers \phpOMS\Business\Finance\FinanceFormulas
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The future value of annuity (FVA) and reverse value calculations are correct')]
public function testFutureValueOfAnnuity() : void
{
$expected = 5204.04;
@ -59,11 +53,8 @@ final class FinanceFormulasTest extends \PHPUnit\Framework\TestCase
self::assertEqualsWithDelta(\round($P, 2), \round(FinanceFormulas::getPeriodicPaymentOfFVA($fva, $r, $n), 2), 0.01);
}
/**
* @testdox The future value of annuity continuous compounding (FVACC) and reverse value calculations are correct
* @covers \phpOMS\Business\Finance\FinanceFormulas
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The future value of annuity continuous compounding (FVACC) and reverse value calculations are correct')]
public function testFutureValueOfAnnuityContinuousCompounding() : void
{
$expected = 12336.42;
@ -78,11 +69,8 @@ final class FinanceFormulasTest extends \PHPUnit\Framework\TestCase
self::assertEqualsWithDelta($t, FinanceFormulas::getTimeOfFVACC($fvacc, $cf, $r), 0.01);
}
/**
* @testdox The annuity payment from the present value (PV) and reverse value calculations are correct
* @covers \phpOMS\Business\Finance\FinanceFormulas
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The annuity payment from the present value (PV) and reverse value calculations are correct')]
public function testAnnuityPaymentPV() : void
{
$expected = 212.16;
@ -97,11 +85,8 @@ final class FinanceFormulasTest extends \PHPUnit\Framework\TestCase
self::assertEqualsWithDelta(\round($pv, 2), \round(FinanceFormulas::getPresentValueOfAPPV($p, $r, $n), 2), 0.01);
}
/**
* @testdox The annuity payment from the future value (FV) and reverse value calculations are correct
* @covers \phpOMS\Business\Finance\FinanceFormulas
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The annuity payment from the future value (FV) and reverse value calculations are correct')]
public function testAnnuityPaymentFV() : void
{
$expected = 192.16;
@ -116,11 +101,8 @@ final class FinanceFormulasTest extends \PHPUnit\Framework\TestCase
self::assertEqualsWithDelta(\round($fv, 2), \round(FinanceFormulas::getFutureValueOfAPFV($p, $r, $n), 2), 0.01);
}
/**
* @testdox The annuity payment from the present value (PV) and reverse value calculations are correct
* @covers \phpOMS\Business\Finance\FinanceFormulas
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The annuity payment from the present value (PV) and reverse value calculations are correct')]
public function testAnnuityPaymentFactorPV() : void
{
$expected = 0.21216;
@ -133,11 +115,8 @@ final class FinanceFormulasTest extends \PHPUnit\Framework\TestCase
self::assertEqualsWithDelta($n, FinanceFormulas::getNumberOfAPFPV($p, $r), 0.01);
}
/**
* @testdox The present value of the annuity is correct
* @covers \phpOMS\Business\Finance\FinanceFormulas
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The present value of the annuity is correct')]
public function testPresentValueOfAnnuity() : void
{
$expected = 4713.46;
@ -152,11 +131,8 @@ final class FinanceFormulasTest extends \PHPUnit\Framework\TestCase
self::assertEqualsWithDelta(\round($P, 2), \round(FinanceFormulas::getPeriodicPaymentOfPVA($pva, $r, $n), 2), 0.01);
}
/**
* @testdox The present value annuity factor of the annuity is correct
* @covers \phpOMS\Business\Finance\FinanceFormulas
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The present value annuity factor of the annuity is correct')]
public function testPresentValueAnnuityFactor() : void
{
$expected = 4.7135;
@ -169,11 +145,8 @@ final class FinanceFormulasTest extends \PHPUnit\Framework\TestCase
self::assertEqualsWithDelta($n, FinanceFormulas::getPeriodsOfPVAF($p, $r), 0.01);
}
/**
* @testdox The due present value the annuity is correct
* @covers \phpOMS\Business\Finance\FinanceFormulas
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The due present value the annuity is correct')]
public function testPresentValueOfAnnuityDue() : void
{
$expected = 454.60;
@ -189,11 +162,8 @@ final class FinanceFormulasTest extends \PHPUnit\Framework\TestCase
self::assertEqualsWithDelta($n, FinanceFormulas::getPeriodsOfPVAD($PV, $P, $r), 0.01);
}
/**
* @testdox The due future value the annuity is correct
* @covers \phpOMS\Business\Finance\FinanceFormulas
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The due future value the annuity is correct')]
public function testFutureValueOfAnnuityDue() : void
{
$expected = 580.19;
@ -209,33 +179,24 @@ final class FinanceFormulasTest extends \PHPUnit\Framework\TestCase
self::assertEqualsWithDelta($n, FinanceFormulas::getPeriodsOfFVAD($FV, $P, $r), 0.01);
}
/**
* @testdox The relative market share calculations by shares and ales are correct
* @covers \phpOMS\Business\Finance\FinanceFormulas
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The relative market share calculations by shares and ales are correct')]
public function testRelativeMarketShare() : void
{
self::assertEqualsWithDelta(300 / 400, FinanceFormulas::getRelativeMarketShareByShare(300, 400), 0.01);
self::assertEqualsWithDelta(300 / 400, FinanceFormulas::getRelativeMarketShareBySales(300, 400), 0.01);
}
/**
* @testdox The asset ratio calculations are correct
* @covers \phpOMS\Business\Finance\FinanceFormulas
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The asset ratio calculations are correct')]
public function testAssetRatios() : void
{
self::assertEqualsWithDelta(3 / 2, FinanceFormulas::getAssetToSalesRatio(3, 2), 0.01);
self::assertEqualsWithDelta(2 / 3, FinanceFormulas::getAssetTurnoverRatio(3, 2), 0.01);
}
/**
* @testdox Balance ratio calculations for DII, Receivables/Turnover, and more are correct
* @covers \phpOMS\Business\Finance\FinanceFormulas
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('Balance ratio calculations for DII, Receivables/Turnover, and more are correct')]
public function testBalanceRatios() : void
{
self::assertEqualsWithDelta(365 / 1000, FinanceFormulas::getDaysInInventory(1000), 0.01);
@ -244,11 +205,8 @@ final class FinanceFormulasTest extends \PHPUnit\Framework\TestCase
self::assertEqualsWithDelta(500 / 1000, FinanceFormulas::getCurrentRatio(500, 1000), 0.01);
}
/**
* @testdox Dept ratios for dept coverage, dept to equity and dept to income are correct
* @covers \phpOMS\Business\Finance\FinanceFormulas
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('Dept ratios for dept coverage, dept to equity and dept to income are correct')]
public function testDeptRatios() : void
{
self::assertEqualsWithDelta(500 / 1000, FinanceFormulas::getDebtCoverageRatio(500, 1000), 0.01);
@ -257,11 +215,8 @@ final class FinanceFormulasTest extends \PHPUnit\Framework\TestCase
self::assertEqualsWithDelta(500 / 1000, FinanceFormulas::getDebtToIncomeRatio(500, 1000), 0.01);
}
/**
* @testdox Return on balance statement positions are correct (e.g. return on assets, on equity)
* @covers \phpOMS\Business\Finance\FinanceFormulas
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('Return on balance statement positions are correct (e.g. return on assets, on equity)')]
public function testReturnOnBalancePositions() : void
{
self::assertEqualsWithDelta(500 / 1000, FinanceFormulas::getReturnOnAssets(500, 1000), 0.01);
@ -269,11 +224,8 @@ final class FinanceFormulasTest extends \PHPUnit\Framework\TestCase
self::assertEqualsWithDelta(500 / 1000 - 1, FinanceFormulas::getReturnOnInvestment(500, 1000), 0.01);
}
/**
* @testdox Balance / P&L ratios are correct (e.g. inventory turnover, net profit margin)
* @covers \phpOMS\Business\Finance\FinanceFormulas
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('Balance / P&L ratios are correct (e.g. inventory turnover, net profit margin)')]
public function testBalancePLRatios() : void
{
self::assertEqualsWithDelta(500 / 1000, FinanceFormulas::getInventoryTurnoverRatio(500, 1000), 0.01);
@ -281,11 +233,8 @@ final class FinanceFormulasTest extends \PHPUnit\Framework\TestCase
self::assertEqualsWithDelta(500 / 1000, FinanceFormulas::getReceivablesTurnoverRatio(500, 1000), 0.01);
}
/**
* @testdox Various ratios are correct (e.g. interest coverage, quick ratio, rate of inflation)
* @covers \phpOMS\Business\Finance\FinanceFormulas
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('Various ratios are correct (e.g. interest coverage, quick ratio, rate of inflation)')]
public function testRatios() : void
{
self::assertEqualsWithDelta(500 / 1000, FinanceFormulas::getInterestCoverageRatio(500, 1000), 0.01);
@ -298,11 +247,8 @@ final class FinanceFormulasTest extends \PHPUnit\Framework\TestCase
self::assertEqualsWithDelta(100 / 0.15, FinanceFormulas::getPresentValueOfPerpetuity(100, 0.15), 0.01);
}
/**
* @testdox Compound calculations for interest, principal and periods are correct
* @covers \phpOMS\Business\Finance\FinanceFormulas
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('Compound calculations for interest, principal and periods are correct')]
public function testCompound() : void
{
$expected = 15.76;
@ -318,11 +264,8 @@ final class FinanceFormulasTest extends \PHPUnit\Framework\TestCase
self::assertEqualsWithDelta($t, (int) \round(FinanceFormulas::getPeriodsOfCompoundInterest($P, $C, $r), 0), 0.01);
}
/**
* @testdox Continuous compound calculations for interest, principal and periods are correct
* @covers \phpOMS\Business\Finance\FinanceFormulas
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('Continuous compound calculations for interest, principal and periods are correct')]
public function testContinuousCompounding() : void
{
$expected = 116.18;
@ -339,11 +282,8 @@ final class FinanceFormulasTest extends \PHPUnit\Framework\TestCase
self::assertEqualsWithDelta($r, FinanceFormulas::getRateOfContinuousCompounding($P, $C, $t), 0.01);
}
/**
* @testdox Calculations for interest, principal and periods are correct
* @covers \phpOMS\Business\Finance\FinanceFormulas
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('Calculations for interest, principal and periods are correct')]
public function testSimpleInterest() : void
{
$P = 100.00;
@ -358,11 +298,8 @@ final class FinanceFormulasTest extends \PHPUnit\Framework\TestCase
self::assertEqualsWithDelta($t, FinanceFormulas::getSimpleInterestTime($I, $P, $r), 0.01);
}
/**
* @testdox The discounted payback period is correct
* @covers \phpOMS\Business\Finance\FinanceFormulas
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The discounted payback period is correct')]
public function testDiscountedPaybackPeriod() : void
{
$O1 = 5000;
@ -372,11 +309,8 @@ final class FinanceFormulasTest extends \PHPUnit\Framework\TestCase
self::assertEqualsWithDelta(5.896, FinanceFormulas::getDiscountedPaybackPeriod($CF, $O1, $r), 0.01);
}
/**
* @testdox Test the correct calculation of the growth rate in order to double and vice versa
* @covers \phpOMS\Business\Finance\FinanceFormulas
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('Test the correct calculation of the growth rate in order to double and vice versa')]
public function testDoublingTime() : void
{
$r = 0.05;
@ -385,11 +319,8 @@ final class FinanceFormulasTest extends \PHPUnit\Framework\TestCase
self::assertEqualsWithDelta($r, FinanceFormulas::getDoublingRate(14.207), 0.01);
}
/**
* @testdox Test the correct calculation of the growth rate in order to double and vice versa with continuous compounding
* @covers \phpOMS\Business\Finance\FinanceFormulas
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('Test the correct calculation of the growth rate in order to double and vice versa with continuous compounding')]
public function testDoublingTimeContinuousCompounding() : void
{
$r = 0.05;
@ -398,11 +329,8 @@ final class FinanceFormulasTest extends \PHPUnit\Framework\TestCase
self::assertEqualsWithDelta($r, FinanceFormulas::getDoublingContinuousCompoundingRate(13.863), 0.01);
}
/**
* @testdox Calculations for equivalent annual annuity are correct
* @covers \phpOMS\Business\Finance\FinanceFormulas
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('Calculations for equivalent annual annuity are correct')]
public function testEquivalentAnnualAnnuity() : void
{
$npv = 1000;
@ -414,11 +342,8 @@ final class FinanceFormulasTest extends \PHPUnit\Framework\TestCase
self::assertEqualsWithDelta($npv, FinanceFormulas::getNetPresentValueOfEAA(240.36, $r, $n), 0.01);
}
/**
* @testdox The free cash flow to equity calculation is correct (how much cash is available after expenses and dept payments)
* @covers \phpOMS\Business\Finance\FinanceFormulas
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The free cash flow to equity calculation is correct (how much cash is available after expenses and dept payments)')]
public function testFreeCashFlowToEquity() : void
{
$income = 1000;
@ -430,11 +355,8 @@ final class FinanceFormulasTest extends \PHPUnit\Framework\TestCase
self::assertEqualsWithDelta(1200, FinanceFormulas::getFreeCashFlowToEquity($income, $depamo, $capital, $wc, $borrowing), 0.01);
}
/**
* @testdox The free cash flow to firm calculation is correct (how much cash is available after expenses)
* @covers \phpOMS\Business\Finance\FinanceFormulas
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The free cash flow to firm calculation is correct (how much cash is available after expenses)')]
public function testFreeCashFlowToFirm() : void
{
$ebit = 1000;
@ -446,11 +368,8 @@ final class FinanceFormulasTest extends \PHPUnit\Framework\TestCase
self::assertEqualsWithDelta(550, FinanceFormulas::getFreeCashFlowToFirm($ebit, $t, $depamo, $capital, $wc), 0.01);
}
/**
* @testdox The future value calculation is correct
* @covers \phpOMS\Business\Finance\FinanceFormulas
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The future value calculation is correct')]
public function testFutureValue() : void
{
$c = 1000;
@ -460,11 +379,8 @@ final class FinanceFormulasTest extends \PHPUnit\Framework\TestCase
self::assertEqualsWithDelta(2660.02, FinanceFormulas::getFutureValue($c, $r, $n), 0.01);
}
/**
* @testdox The future value calculation including continuous compounding is correct
* @covers \phpOMS\Business\Finance\FinanceFormulas
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The future value calculation including continuous compounding is correct')]
public function testFutureValueContinuousCompounding() : void
{
$pv = 1000;
@ -474,11 +390,8 @@ final class FinanceFormulasTest extends \PHPUnit\Framework\TestCase
self::assertEqualsWithDelta(2857.65, FinanceFormulas::getFutureValueContinuousCompounding($pv, $r, $t), 0.01);
}
/**
* @testdox The future value factor calculation is correct
* @covers \phpOMS\Business\Finance\FinanceFormulas
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The future value factor calculation is correct')]
public function testValueFactor() : void
{
$r = 0.15;
@ -488,11 +401,8 @@ final class FinanceFormulasTest extends \PHPUnit\Framework\TestCase
self::assertEqualsWithDelta(0.37594, FinanceFormulas::getPresentValueFactor($r, $n), 0.01);
}
/**
* @testdox The calculation of the geometric mean of multiple return rates is correct
* @covers \phpOMS\Business\Finance\FinanceFormulas
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The calculation of the geometric mean of multiple return rates is correct')]
public function testGeometricMeanReturn() : void
{
$r = [0.01, 0.02, 0.03, 0.04, 0.05, 0.06, 0.07];
@ -500,11 +410,8 @@ final class FinanceFormulasTest extends \PHPUnit\Framework\TestCase
self::assertEqualsWithDelta(0.04123, FinanceFormulas::getGeometricMeanReturn($r), 0.01);
}
/**
* @testdox The calculation of the future value of the growing annuity is correct
* @covers \phpOMS\Business\Finance\FinanceFormulas
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The calculation of the future value of the growing annuity is correct')]
public function testGrowingAnnuityFV() : void
{
$p = 1000;
@ -515,11 +422,8 @@ final class FinanceFormulasTest extends \PHPUnit\Framework\TestCase
self::assertEqualsWithDelta(14226.06, FinanceFormulas::getGrowingAnnuityFV($p, $r, $g, $n), 0.01);
}
/**
* @testdox The calculation of the payment based on the present value of the growing annuity is correct
* @covers \phpOMS\Business\Finance\FinanceFormulas
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The calculation of the payment based on the present value of the growing annuity is correct')]
public function testGrowingAnnuityPaymentPV() : void
{
$p = 1000;
@ -530,11 +434,8 @@ final class FinanceFormulasTest extends \PHPUnit\Framework\TestCase
self::assertEqualsWithDelta(186.98, FinanceFormulas::getGrowingAnnuityPaymentPV($p, $r, $g, $n), 0.01);
}
/**
* @testdox The calculation of the payment based on the future value of the growing annuity is correct
* @covers \phpOMS\Business\Finance\FinanceFormulas
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The calculation of the payment based on the future value of the growing annuity is correct')]
public function testGrowingAnnuityPaymentFV() : void
{
$fv = 1000;
@ -545,11 +446,8 @@ final class FinanceFormulasTest extends \PHPUnit\Framework\TestCase
self::assertEqualsWithDelta(70.29, FinanceFormulas::getGrowingAnnuityPaymentFV($fv, $r, $g, $n), 0.01);
}
/**
* @testdox The calculation of the present value of the growing annuity is correct
* @covers \phpOMS\Business\Finance\FinanceFormulas
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The calculation of the present value of the growing annuity is correct')]
public function testGrowingAnnuityPV() : void
{
$p = 1000;
@ -560,11 +458,8 @@ final class FinanceFormulasTest extends \PHPUnit\Framework\TestCase
self::assertEqualsWithDelta(5348.1, FinanceFormulas::getGrowingAnnuityPV($p, $r, $g, $n), 0.01);
}
/**
* @testdox The calculation of the present value of the growing perpetuity is correct
* @covers \phpOMS\Business\Finance\FinanceFormulas
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The calculation of the present value of the growing perpetuity is correct')]
public function testGrowingPerpetuityPV() : void
{
$d = 1000;
@ -574,11 +469,8 @@ final class FinanceFormulasTest extends \PHPUnit\Framework\TestCase
self::assertEqualsWithDelta(20000, FinanceFormulas::getGrowingPerpetuityPV($d, $r, $g), 0.01);
}
/**
* @testdox The calculation of the net present value is correct
* @covers \phpOMS\Business\Finance\FinanceFormulas
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The calculation of the net present value is correct')]
public function testNetPresentValue() : void
{
$c = [1000, 100, 200, 300, 400, 500, 600];
@ -587,21 +479,15 @@ final class FinanceFormulasTest extends \PHPUnit\Framework\TestCase
self::assertEqualsWithDelta(172.13, FinanceFormulas::getNetPresentValue($c, $r), 0.01);
}
/**
* @testdox No cash flows in the net present value calculation result in 0
* @covers \phpOMS\Business\Finance\FinanceFormulas
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('No cash flows in the net present value calculation result in 0')]
public function testEmptyNetPresentValue() : void
{
self::assertEqualsWithDelta(0.0, FinanceFormulas::getNetPresentValue([], 0.1), 0.01);
}
/**
* @testdox The calculation of the real rate of return is correct
* @covers \phpOMS\Business\Finance\FinanceFormulas
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The calculation of the real rate of return is correct')]
public function testRealRateOfReturn() : void
{
$nominal = 0.15;
@ -610,21 +496,15 @@ final class FinanceFormulasTest extends \PHPUnit\Framework\TestCase
self::assertEqualsWithDelta(0.09524, FinanceFormulas::getRealRateOfReturn($nominal, $inflation), 0.01);
}
/**
* @testdox The calculation of the net working capital is correct
* @covers \phpOMS\Business\Finance\FinanceFormulas
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The calculation of the net working capital is correct')]
public function testNetWorkingCapital() : void
{
self::assertEqualsWithDelta(1000 - 600, FinanceFormulas::getNetWorkingCapital(1000, 600), 0.01);
}
/**
* @testdox The periods to reach a future value based on the present value is calculated correctly
* @covers \phpOMS\Business\Finance\FinanceFormulas
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The periods to reach a future value based on the present value is calculated correctly')]
public function testNumberOfPeriodsPVFV() : void
{
$fv = 1200;
@ -634,11 +514,8 @@ final class FinanceFormulasTest extends \PHPUnit\Framework\TestCase
self::assertEqualsWithDelta(6.1681, FinanceFormulas::getNumberOfPeriodsPVFV($fv, $pv, $r), 0.01);
}
/**
* @testdox The calculation of the present value is correct
* @covers \phpOMS\Business\Finance\FinanceFormulas
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The calculation of the present value is correct')]
public function testPresentValue() : void
{
$c = 1000;
@ -648,11 +525,8 @@ final class FinanceFormulasTest extends \PHPUnit\Framework\TestCase
self::assertEqualsWithDelta(375.94, FinanceFormulas::getPresentValue($c, $r, $n), 0.01);
}
/**
* @testdox The calculation of the present value using continuous compounding is correct
* @covers \phpOMS\Business\Finance\FinanceFormulas
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The calculation of the present value using continuous compounding is correct')]
public function testPresentValueContinuousCompounding() : void
{
$c = 1000;

View File

@ -17,10 +17,9 @@ namespace phpOMS\tests\Business\Finance;
use phpOMS\Business\Finance\Forensics;
/**
* @testdox phpOMS\tests\Business\Finance\ForensicsTest: Forensics formulas
*
* @internal
*/
#[\PHPUnit\Framework\Attributes\TestDox('phpOMS\tests\Business\Finance\ForensicsTest: Forensics formulas')]
final class ForensicsTest extends \PHPUnit\Framework\TestCase
{
public function testBenfordAnalysis() : void

View File

@ -17,34 +17,27 @@ namespace phpOMS\tests\Business\Finance;
use phpOMS\Business\Finance\Loan;
/**
* @testdox phpOMS\tests\Business\Finance\LoanTest: Loan formulas
*
* @internal
*/
#[\PHPUnit\Framework\Attributes\TestDox('phpOMS\tests\Business\Finance\LoanTest: Loan formulas')]
final class LoanTest extends \PHPUnit\Framework\TestCase
{
/**
* @testdox The loan to deposit ratio is correct
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The loan to deposit ratio is correct')]
public function testLoanToDepositRatio() : void
{
self::assertEquals(100 / 50, Loan::getLoanToDepositRatio(100, 50));
}
/**
* @testdox The loan to value ratio is correct
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The loan to value ratio is correct')]
public function testLoanToValueRatio() : void
{
self::assertEquals(100 / 50, Loan::getLoanToValueRatio(100, 50));
}
/**
* @testdox The balloon loan payments are correct for a given balloon
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The balloon loan payments are correct for a given balloon')]
public function testPaymentsOnBalloonLoan() : void
{
$pv = 1000;
@ -55,10 +48,8 @@ final class LoanTest extends \PHPUnit\Framework\TestCase
self::assertEqualsWithDelta(213.25, Loan::getPaymentsOnBalloonLoan($pv, $r, $n, $balloon), 0.01);
}
/**
* @testdox The balloon loan residual value (balloon) is correct for given payments
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The balloon loan residual value (balloon) is correct for given payments')]
public function testBalloonBalanceOfLoan() : void
{
$pv = 1000;
@ -69,10 +60,8 @@ final class LoanTest extends \PHPUnit\Framework\TestCase
self::assertEqualsWithDelta(-660.02, Loan::getBalloonBalanceOfLoan($pv, $p, $r, $n), 0.01);
}
/**
* @testdox The loan payments are correct for a given interest rate and period [continuous compounding]
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The loan payments are correct for a given interest rate and period [continuous compounding]')]
public function testLoanPayment() : void
{
$pv = 1000;
@ -82,10 +71,8 @@ final class LoanTest extends \PHPUnit\Framework\TestCase
self::assertEqualsWithDelta(240.36, Loan::getLoanPayment($pv, $r, $n), 0.01);
}
/**
* @testdox The residual value is correct for a given payment amount, interest rate and period [continuous compounding]
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The residual value is correct for a given payment amount, interest rate and period [continuous compounding]')]
public function testRemainingBalanceLoan() : void
{
$pv = 1000;

View File

@ -17,16 +17,13 @@ namespace phpOMS\tests\Business\Finance;
use phpOMS\Business\Finance\Lorenzkurve;
/**
* @testdox phpOMS\tests\Business\Finance\LorenzkurveTest: Lorenz kurve
*
* @internal
*/
#[\PHPUnit\Framework\Attributes\TestDox('phpOMS\tests\Business\Finance\LorenzkurveTest: Lorenz kurve')]
final class LorenzkurveTest extends \PHPUnit\Framework\TestCase
{
/**
* @testdox The gini coefficient calculation is correct
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The gini coefficient calculation is correct')]
public function testGiniCoefficient() : void
{
$arr = [1, 1, 1, 1, 1, 1, 1, 10, 33, 50];

View File

@ -17,16 +17,13 @@ namespace phpOMS\tests\Business\Finance;
use phpOMS\Business\Finance\StockBonds;
/**
* @testdox phpOMS\tests\Business\Finance\StockBondsTest: Stock & bond related formulas
*
* @internal
*/
#[\PHPUnit\Framework\Attributes\TestDox('phpOMS\tests\Business\Finance\StockBondsTest: Stock & bond related formulas')]
final class StockBondsTest extends \PHPUnit\Framework\TestCase
{
/**
* @testdox The calculation of various stock/bond related ratios/yields is correct
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The calculation of various stock/bond related ratios/yields is correct')]
public function testRatios() : void
{
self::assertEquals(100 / 50, StockBonds::getBookValuePerShare(100, 50));
@ -41,46 +38,36 @@ final class StockBondsTest extends \PHPUnit\Framework\TestCase
self::assertEquals(100 / 50, StockBonds::getPriceToSalesRatio(100, 50));
}
/**
* @testdox The calculation of the bond yield based on face value and price is correct
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The calculation of the bond yield based on face value and price is correct')]
public function testBondEquivalentYield() : void
{
self::assertEqualsWithDelta(0.40556, StockBonds::getBondEquivalentYield(100, 90, 100), 0.01);
}
/**
* @testdox The calculation of the return of the capital asset pricing model is correct
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The calculation of the return of the capital asset pricing model is correct')]
public function testExpectedReturnCAPM() : void
{
self::assertEqualsWithDelta(7, StockBonds::getExpectedReturnCAPM(3, 2, 5), 0.01);
}
/**
* @testdox The capital gains yield calculation is correct
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The capital gains yield calculation is correct')]
public function testCapitalGainsYield() : void
{
self::assertEqualsWithDelta(0.1, StockBonds::getCapitalGainsYield(100, 110), 0.01);
}
/**
* @testdox The diluted earnings per share calculation is correct
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The diluted earnings per share calculation is correct')]
public function testDilutedEarningsPerShare() : void
{
self::assertEqualsWithDelta(9.09, StockBonds::getDilutedEarningsPerShare(1000, 100, 10), 0.1);
}
/**
* @testdox The calculation of the absolute return for multiple holding periods is correct
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The calculation of the absolute return for multiple holding periods is correct')]
public function testHoldingPeriodReturn() : void
{
$r = [0.01, 0.02, 0.03, 0.04];
@ -88,10 +75,8 @@ final class StockBondsTest extends \PHPUnit\Framework\TestCase
self::assertEqualsWithDelta(0.10355, StockBonds::getHoldingPeriodReturn($r), 0.01);
}
/**
* @testdox The tax equivalent yield is calculated correctly
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The tax equivalent yield is calculated correctly')]
public function testTaxEquivalentYield() : void
{
$free = 0.15;
@ -100,10 +85,8 @@ final class StockBondsTest extends \PHPUnit\Framework\TestCase
self::assertEqualsWithDelta(0.15789, StockBonds::getTaxEquivalentYield($free, $rate), 0.01);
}
/**
* @testdox The net asset value is calculated correctly
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The net asset value is calculated correctly')]
public function testNetAssetValue() : void
{
$assets = 1000;
@ -113,10 +96,8 @@ final class StockBondsTest extends \PHPUnit\Framework\TestCase
self::assertEqualsWithDelta(1.75, StockBonds::getNetAssetValue($assets, $liabilities, $shares), 0.01);
}
/**
* @testdox The calculation of the present value of a stock with constant growth rate is correct
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The calculation of the present value of a stock with constant growth rate is correct')]
public function testPresentValueOfStockConstantGrowth() : void
{
$div = 500;
@ -126,10 +107,8 @@ final class StockBondsTest extends \PHPUnit\Framework\TestCase
self::assertEqualsWithDelta(5000, StockBonds::getPresentValueOfStockConstantGrowth($div, $r, $g), 0.01);
}
/**
* @testdox The total stock return including dividends and sales price is correct
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The total stock return including dividends and sales price is correct')]
public function testTotalStockReturn() : void
{
$p0 = 1000;
@ -139,10 +118,8 @@ final class StockBondsTest extends \PHPUnit\Framework\TestCase
self::assertEqualsWithDelta(0.3, StockBonds::getTotalStockReturn($p0, $p1, $d), 0.01);
}
/**
* @testdox The calculation of the yield of a bond is correct
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The calculation of the yield of a bond is correct')]
public function testYieldToMaturity() : void
{
$c = 100;
@ -153,10 +130,8 @@ final class StockBondsTest extends \PHPUnit\Framework\TestCase
self::assertEqualsWithDelta(0.1138, StockBonds::getYieldToMaturity($c, $f, $p, $n), 0.01);
}
/**
* @testdox The calculation of value of the zero coupon bond is correct
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The calculation of value of the zero coupon bond is correct')]
public function testZeroCouponBondValue() : void
{
$f = 100;
@ -166,10 +141,8 @@ final class StockBondsTest extends \PHPUnit\Framework\TestCase
self::assertEqualsWithDelta(74.73, StockBonds::getZeroCouponBondValue($f, $r, $t), 0.01);
}
/**
* @testdox The calculation of the yield of a zero coupon bond is correct
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The calculation of the yield of a zero coupon bond is correct')]
public function testZeroCouponBondEffectiveYield() : void
{
$f = 100;

View File

@ -17,16 +17,13 @@ namespace phpOMS\tests\Business\Marketing;
use phpOMS\Business\Marketing\CustomerValue;
/**
* @testdox phpOMS\tests\Business\Marketing\CustomerValueTest: Customer value
*
* @internal
*/
#[\PHPUnit\Framework\Attributes\TestDox('phpOMS\tests\Business\Marketing\CustomerValueTest: Customer value')]
final class CustomerValueTest extends \PHPUnit\Framework\TestCase
{
/**
* @testdox The simple customer life time value is correctly calculated
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The simple customer life time value is correctly calculated')]
public function testSimpleCLV() : void
{
$margin = 3000;
@ -35,10 +32,8 @@ final class CustomerValueTest extends \PHPUnit\Framework\TestCase
self::assertEqualsWithDelta(30000, CustomerValue::getSimpleCLV($margin, $retention, 0.0), 0.1);
}
/**
* @testdox The monthly recurring revenue (MRR) is correctly calculated
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The monthly recurring revenue (MRR) is correctly calculated')]
public function testMRR() : void
{
$revenues = [

View File

@ -17,25 +17,20 @@ namespace phpOMS\tests\Business\Marketing;
use phpOMS\Business\Marketing\Metrics;
/**
* @testdox phpOMS\tests\Business\Marketing\MetricsTest: General marketing metrics
*
* @internal
*/
#[\PHPUnit\Framework\Attributes\TestDox('phpOMS\tests\Business\Marketing\MetricsTest: General marketing metrics')]
final class MetricsTest extends \PHPUnit\Framework\TestCase
{
/**
* @testdox Test the correctness of the customer retention calculation
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('Test the correctness of the customer retention calculation')]
public function testCustomerRetention() : void
{
self::assertEqualsWithDelta(0.85, Metrics::getCustomerRetention(105, 20, 100), 0.01);
}
/**
* @testdox The profit according to Berry can be correctly calculated
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The profit according to Berry can be correctly calculated')]
public function testBerrysCustomerProfits() : void
{
$acquisitionCost = 30.0;
@ -52,10 +47,8 @@ final class MetricsTest extends \PHPUnit\Framework\TestCase
);
}
/**
* @testdox The purchase probability of customers can be calculated based on historic information using the migration model
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The purchase probability of customers can be calculated based on historic information using the migration model')]
public function testMigrationModelPurchaseMatrix() : void
{
// Basis:
@ -82,10 +75,8 @@ final class MetricsTest extends \PHPUnit\Framework\TestCase
);
}
/**
* @testdox The CLTV can be calculated using the migration model
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The CLTV can be calculated using the migration model')]
public function testMigrationModel() : void
{
// The first element in the migration model result is the CLTV
@ -100,10 +91,8 @@ final class MetricsTest extends \PHPUnit\Framework\TestCase
);
}
/**
* @testdox The migration model can be used in order to determin which buying/none-buying customer group should receive a mailing
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The migration model can be used in order to determin which buying/none-buying customer group should receive a mailing')]
public function testMailingSuccessEstimation() : void
{
self::assertEqualsWithDelta(
@ -117,10 +106,8 @@ final class MetricsTest extends \PHPUnit\Framework\TestCase
);
}
/**
* @testdox The probability of a customer buying can be calculated based on his previous purchase behavior
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The probability of a customer buying can be calculated based on his previous purchase behavior')]
public function testCustomerActiveProbability() : void
{
$purchases = 10;

View File

@ -17,16 +17,13 @@ namespace phpOMS\tests\Business\Marketing;
use phpOMS\Business\Marketing\NetPromoterScore;
/**
* @testdox phpOMS\tests\Business\Marketing\NetPromoterScoreTest: Net promoter
*
* @internal
*/
#[\PHPUnit\Framework\Attributes\TestDox('phpOMS\tests\Business\Marketing\NetPromoterScoreTest: Net promoter')]
final class NetPromoterScoreTest extends \PHPUnit\Framework\TestCase
{
/**
* @testdox The net promoter has the expected default values after initialization
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The net promoter has the expected default values after initialization')]
public function testDefault() : void
{
$nps = new NetPromoterScore();
@ -34,10 +31,8 @@ final class NetPromoterScoreTest extends \PHPUnit\Framework\TestCase
self::assertEquals(0, $nps->getScore());
}
/**
* @testdox The net promoter score, detractors, passives and promoters are correct
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The net promoter score, detractors, passives and promoters are correct')]
public function testScoreDetractorPassivePromotor() : void
{
$nps = new NetPromoterScore();

View File

@ -17,16 +17,13 @@ namespace phpOMS\tests\Business\Marketing;
use phpOMS\Business\Marketing\PageRank;
/**
* @testdox phpOMS\tests\Business\Marketing\PageRankTest: Page rank algorithm
*
* @internal
*/
#[\PHPUnit\Framework\Attributes\TestDox('phpOMS\tests\Business\Marketing\PageRankTest: Page rank algorithm')]
final class PageRankTest extends \PHPUnit\Framework\TestCase
{
/**
* @testdox Test the correctness of the page rank algorithm
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('Test the correctness of the page rank algorithm')]
public function testPageRank() : void
{
$relations = [
@ -50,10 +47,8 @@ final class PageRankTest extends \PHPUnit\Framework\TestCase
);
}
/**
* @testdox Test the correctness of the page rank algorithm with custom damping and starting values
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('Test the correctness of the page rank algorithm with custom damping and starting values')]
public function testPageRankCustomDampingAndStart() : void
{
$relations = [

View File

@ -17,25 +17,20 @@ namespace phpOMS\tests\Business\Programming;
use phpOMS\Business\Programming\Metrics;
/**
* @testdox phpOMS\tests\Business\Programming\MetricsTest: General programming metrics
*
* @internal
*/
#[\PHPUnit\Framework\Attributes\TestDox('phpOMS\tests\Business\Programming\MetricsTest: General programming metrics')]
final class MetricsTest extends \PHPUnit\Framework\TestCase
{
/**
* @testdox Test correctness of the ABC calculation
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('Test correctness of the ABC calculation')]
public function testABCMetric() : void
{
self::assertEquals((int) \sqrt(5 * 5 + 11 * 11 + 9 * 9), Metrics::abcScore(5, 11, 9));
}
/**
* @testdox Test correctness of CRAP score
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('Test correctness of CRAP score')]
public function testCRAPMetric() : void
{
self::assertEquals(1, Metrics::CRAP(1, 1.0));

View File

@ -17,16 +17,13 @@ namespace phpOMS\tests\Business\Recommendation;
use phpOMS\Business\Recommendation\ArticleCorrelationAffinity;
/**
* @testdox phpOMS\tests\Business\Recommendation\ArticleCorrelationAffinityTest: Article affinity/correlation
*
* @internal
*/
#[\PHPUnit\Framework\Attributes\TestDox('phpOMS\tests\Business\Recommendation\ArticleCorrelationAffinityTest: Article affinity/correlation')]
final class ArticleCorrelationAffinityTest extends \PHPUnit\Framework\TestCase
{
/**
* @testdox The highest affinities between articles purchased are calculated correctly
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The highest affinities between articles purchased are calculated correctly')]
public function testAffinity() : void
{
$orders = [
@ -69,10 +66,8 @@ final class ArticleCorrelationAffinityTest extends \PHPUnit\Framework\TestCase
);
}
/**
* @testdox The affinity of a new article is empty
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The affinity of a new article is empty')]
public function testInvalidItemAffinity() : void
{
$orders = [

View File

@ -15,10 +15,9 @@ declare(strict_types=1);
namespace phpOMS\tests\Business\Recommendation;
/**
* @testdox phpOMS\tests\Business\Recommendation\BayesianPersonalizedRankingTest: Article affinity/correlation
*
* @internal
*/
#[\PHPUnit\Framework\Attributes\TestDox('phpOMS\tests\Business\Recommendation\BayesianPersonalizedRankingTest: Article affinity/correlation')]
final class BayesianPersonalizedRankingTest extends \PHPUnit\Framework\TestCase
{
}

View File

@ -17,10 +17,9 @@ namespace phpOMS\tests\Business\Recommendation;
use phpOMS\Business\Recommendation\MemoryCF;
/**
* @testdox phpOMS\tests\Business\Recommendation\MemoryCFTest: Article affinity/correlation
*
* @internal
*/
#[\PHPUnit\Framework\Attributes\TestDox('phpOMS\tests\Business\Recommendation\MemoryCFTest: Article affinity/correlation')]
final class MemoryCFTest extends \PHPUnit\Framework\TestCase
{
public function testBestMatch() : void

View File

@ -17,10 +17,9 @@ namespace phpOMS\tests\Business\Recommendation;
use phpOMS\Business\Recommendation\ModelCF;
/**
* @testdox phpOMS\tests\Business\Recommendation\ModelCFTest: Article affinity/correlation
*
* @internal
*/
#[\PHPUnit\Framework\Attributes\TestDox('phpOMS\tests\Business\Recommendation\ModelCFTest: Article affinity/correlation')]
final class ModelCFTest extends \PHPUnit\Framework\TestCase
{
public function testScore() : void

View File

@ -17,16 +17,13 @@ namespace phpOMS\tests\Business\Sales;
use phpOMS\Business\Sales\MarketShareEstimation;
/**
* @testdox phpOMS\tests\Business\Sales\MarketShareEstimationTest: Market share calculations
*
* @internal
*/
#[\PHPUnit\Framework\Attributes\TestDox('phpOMS\tests\Business\Sales\MarketShareEstimationTest: Market share calculations')]
final class MarketShareEstimationTest extends \PHPUnit\Framework\TestCase
{
/**
* @testdox The rank calculated with Zipf is correct
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The rank calculated with Zipf is correct')]
public function testZipfRank() : void
{
self::assertEquals(13, MarketShareEstimation::getRankFromMarketShare(1000, 0.01));
@ -34,10 +31,8 @@ final class MarketShareEstimationTest extends \PHPUnit\Framework\TestCase
self::assertEquals(8, MarketShareEstimation::getRankFromMarketShare(100000, 0.01));
}
/**
* @testdox The market share by rank calculated with Zipf is correct
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The market share by rank calculated with Zipf is correct')]
public function testZipfShare() : void
{
self::assertTrue(\abs(0.01 - MarketShareEstimation::getMarketShareFromRank(1000, 13)) < 0.01);

View File

@ -19,16 +19,13 @@ use phpOMS\Config\OptionsTrait;
require_once __DIR__ . '/../Autoloader.php';
/**
* @testdox phpOMS\tests\Config\OptionsTrait: Helper for managing options
*
* @internal
*/
#[\PHPUnit\Framework\Attributes\TestDox('phpOMS\tests\Config\OptionsTrait: Helper for managing options')]
final class OptionsTraitTest extends \PHPUnit\Framework\TestCase
{
/**
* @testdox The option helper has the expected default values after initialization
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The option helper has the expected default values after initialization')]
public function testDefault() : void
{
$class = new class() {
@ -39,10 +36,8 @@ final class OptionsTraitTest extends \PHPUnit\Framework\TestCase
self::assertNull($class->getOption('someKey'));
}
/**
* @testdox Options can be added to the helper
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('Options can be added to the helper')]
public function testAdd() : void
{
$class = new class() {
@ -54,10 +49,8 @@ final class OptionsTraitTest extends \PHPUnit\Framework\TestCase
self::assertEquals('value1', $class->getOption('a'));
}
/**
* @testdox Options can be overwritten/changed
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('Options can be overwritten/changed')]
public function testOverwrite() : void
{
$class = new class() {
@ -81,10 +74,8 @@ final class OptionsTraitTest extends \PHPUnit\Framework\TestCase
self::assertEquals('value3', $class->getOption('a'));
}
/**
* @testdox Multiple options can be added to the helper in one go
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('Multiple options can be added to the helper in one go')]
public function testAddMultiple() : void
{
$class = new class() {
@ -106,10 +97,8 @@ final class OptionsTraitTest extends \PHPUnit\Framework\TestCase
self::assertEquals(3, $class->getOption('c'));
}
/**
* @testdox Multiple options can be retrieved
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('Multiple options can be retrieved')]
public function testGetMultiple() : void
{
$class = new class() {

View File

@ -18,16 +18,13 @@ use phpOMS\DataStorage\Cache\CachePool;
use phpOMS\DataStorage\Cache\Connection\FileCache;
/**
* @testdox phpOMS\tests\DataStorage\Cache\CachePoolTest: Pool for caches
*
* @internal
*/
#[\PHPUnit\Framework\Attributes\TestDox('phpOMS\tests\DataStorage\Cache\CachePoolTest: Pool for caches')]
final class CachePoolTest extends \PHPUnit\Framework\TestCase
{
/**
* @testdox The pool has the expected default values after initialization
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The pool has the expected default values after initialization')]
public function testDefault() : void
{
$pool = new CachePool();
@ -36,10 +33,8 @@ final class CachePoolTest extends \PHPUnit\Framework\TestCase
self::assertInstanceOf('\phpOMS\DataStorage\Cache\Connection\NullCache', $pool->get());
}
/**
* @testdox New cache connections can be added to the pool
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('New cache connections can be added to the pool')]
public function testAdd() : void
{
$pool = new CachePool();
@ -47,10 +42,8 @@ final class CachePoolTest extends \PHPUnit\Framework\TestCase
self::assertTrue($pool->add('test', new FileCache(__DIR__)));
}
/**
* @testdox Cache connections cannot be overwritten with a different cache connection
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('Cache connections cannot be overwritten with a different cache connection')]
public function testOverwrite() : void
{
$pool = new CachePool();
@ -59,10 +52,8 @@ final class CachePoolTest extends \PHPUnit\Framework\TestCase
self::assertFalse($pool->add('test', new FileCache(__DIR__)));
}
/**
* @testdox Cache connections can be accessed with an identifier
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('Cache connections can be accessed with an identifier')]
public function testGet() : void
{
$pool = new CachePool();
@ -72,10 +63,8 @@ final class CachePoolTest extends \PHPUnit\Framework\TestCase
self::assertInstanceOf('\phpOMS\DataStorage\Cache\Connection\ConnectionInterface', $pool->get());
}
/**
* @testdox By default a null cache is returned if no cache connection exists for the identifier
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('By default a null cache is returned if no cache connection exists for the identifier')]
public function testGetDefault() : void
{
$pool = new CachePool();
@ -83,10 +72,8 @@ final class CachePoolTest extends \PHPUnit\Framework\TestCase
self::assertInstanceOf('\phpOMS\DataStorage\Cache\Connection\NullCache', $pool->get('abc'));
}
/**
* @testdox Cache connections can created by the pool and automatically get added but not overwritten
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('Cache connections can created by the pool and automatically get added but not overwritten')]
public function testCreate() : void
{
$pool = new CachePool();
@ -96,10 +83,8 @@ final class CachePoolTest extends \PHPUnit\Framework\TestCase
self::assertInstanceOf('\phpOMS\DataStorage\Cache\Connection\ConnectionInterface', $pool->get('abc'));
}
/**
* @testdox Cache connections can be removed from the pool
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('Cache connections can be removed from the pool')]
public function testRemove() : void
{
$pool = new CachePool();
@ -111,10 +96,8 @@ final class CachePoolTest extends \PHPUnit\Framework\TestCase
self::assertInstanceOf('\phpOMS\DataStorage\Cache\Connection\ConnectionInterface', $pool->get('test'));
}
/**
* @testdox Removing a cache with an invalid identifier will result in no actions
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('Removing a cache with an invalid identifier will result in no actions')]
public function testRemoveInvalid() : void
{
$pool = new CachePool();

View File

@ -21,28 +21,22 @@ use phpOMS\DataStorage\Cache\CacheStatus;
*/
final class CacheStatusTest extends \PHPUnit\Framework\TestCase
{
/**
* @group framework
* @coversNothing
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\CoversNothing]
public function testEnumCount() : void
{
self::assertCount(4, CacheStatus::getConstants());
}
/**
* @group framework
* @coversNothing
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\CoversNothing]
public function testUnique() : void
{
self::assertEquals(CacheStatus::getConstants(), \array_unique(CacheStatus::getConstants()));
}
/**
* @group framework
* @coversNothing
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\CoversNothing]
public function testEnums() : void
{
self::assertEquals(0, CacheStatus::OK);

View File

@ -21,28 +21,22 @@ use phpOMS\DataStorage\Cache\CacheType;
*/
final class CacheTypeTest extends \PHPUnit\Framework\TestCase
{
/**
* @group framework
* @coversNothing
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\CoversNothing]
public function testEnumCount() : void
{
self::assertCount(4, CacheType::getConstants());
}
/**
* @group framework
* @coversNothing
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\CoversNothing]
public function testUnique() : void
{
self::assertEquals(CacheType::getConstants(), \array_unique(CacheType::getConstants()));
}
/**
* @group framework
* @coversNothing
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\CoversNothing]
public function testEnums() : void
{
self::assertEquals('file', CacheType::FILE);

View File

@ -21,28 +21,22 @@ use phpOMS\DataStorage\Cache\Connection\CacheValueType;
*/
final class CacheValueTypeTest extends \PHPUnit\Framework\TestCase
{
/**
* @group framework
* @coversNothing
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\CoversNothing]
public function testEnumCount() : void
{
self::assertCount(8, CacheValueType::getConstants());
}
/**
* @group framework
* @coversNothing
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\CoversNothing]
public function testUnique() : void
{
self::assertEquals(CacheValueType::getConstants(), \array_unique(CacheValueType::getConstants()));
}
/**
* @group framework
* @coversNothing
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\CoversNothing]
public function testEnums() : void
{
self::assertEquals(0, CacheValueType::_INT);

View File

@ -18,16 +18,13 @@ use phpOMS\DataStorage\Cache\CacheType;
use phpOMS\DataStorage\Cache\Connection\ConnectionFactory;
/**
* @testdox phpOMS\tests\DataStorage\Cache\Connection\ConnectionFactoryTest: Factory for generating cache connections
*
* @internal
*/
#[\PHPUnit\Framework\Attributes\TestDox('phpOMS\tests\DataStorage\Cache\Connection\ConnectionFactoryTest: Factory for generating cache connections')]
final class ConnectionFactoryTest extends \PHPUnit\Framework\TestCase
{
/**
* @testdox The file cache can be created
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The file cache can be created')]
public function testCreateFileCache() : void
{
self::assertInstanceOf(
@ -36,10 +33,8 @@ final class ConnectionFactoryTest extends \PHPUnit\Framework\TestCase
);
}
/**
* @testdox The memcached cache can be created
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The memcached cache can be created')]
public function testCreateMemCached() : void
{
if (!\extension_loaded('memcached')) {
@ -54,10 +49,8 @@ final class ConnectionFactoryTest extends \PHPUnit\Framework\TestCase
);
}
/**
* @testdox The redis cache can be created
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The redis cache can be created')]
public function testCreateRedisCache() : void
{
if (!\extension_loaded('redis')) {
@ -72,10 +65,8 @@ final class ConnectionFactoryTest extends \PHPUnit\Framework\TestCase
);
}
/**
* @testdox A invalid cache type results in an exception
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('A invalid cache type results in an exception')]
public function testInvalidCacheType() : void
{
$this->expectException(\InvalidArgumentException::class);

View File

@ -20,10 +20,10 @@ use phpOMS\DataStorage\Cache\Connection\FileCache;
use phpOMS\Utils\TestUtils;
/**
* @testdox phpOMS\tests\DataStorage\Cache\Connection\FileCacheTest: File cache connection
*
* @internal
*/
#[\PHPUnit\Framework\Attributes\CoversClass(\phpOMS\DataStorage\Cache\Connection\FileCache::class)]
#[\PHPUnit\Framework\Attributes\TestDox('phpOMS\tests\DataStorage\Cache\Connection\FileCacheTest: File cache connection')]
final class FileCacheTest extends \PHPUnit\Framework\TestCase
{
protected FileCache $cache;
@ -49,11 +49,8 @@ final class FileCacheTest extends \PHPUnit\Framework\TestCase
}
}
/**
* @testdox The file cache connection has the expected default values after initialization
* @covers \phpOMS\DataStorage\Cache\Connection\FileCache<extended>
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The file cache connection has the expected default values after initialization')]
public function testDefault() : void
{
self::assertEquals(CacheType::FILE, $this->cache->getType());
@ -74,21 +71,15 @@ final class FileCacheTest extends \PHPUnit\Framework\TestCase
);
}
/**
* @testdox The connection to a dedicated cache directory can be established (none-existing directories get created)
* @covers \phpOMS\DataStorage\Cache\Connection\FileCache<extended>
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The connection to a dedicated cache directory can be established (none-existing directories get created)')]
public function testConnect() : void
{
self::assertEquals(CacheStatus::OK, $this->cache->getStatus());
}
/**
* @testdox Different cache data (types) can be set and returned
* @covers \phpOMS\DataStorage\Cache\Connection\FileCache<extended>
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('Different cache data (types) can be set and returned')]
public function testSetInputOutput() : void
{
$this->cache->set('key1', 'testVal');
@ -116,11 +107,8 @@ final class FileCacheTest extends \PHPUnit\Framework\TestCase
self::assertEquals('asdf', $this->cache->get('key8')->val);
}
/**
* @testdox Cache data can bet added and returned
* @covers \phpOMS\DataStorage\Cache\Connection\FileCache<extended>
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('Cache data can bet added and returned')]
public function testAddInputOutput() : void
{
self::assertTrue($this->cache->add('addKey', 'testValAdd'));
@ -269,11 +257,8 @@ final class FileCacheTest extends \PHPUnit\Framework\TestCase
self::assertFalse($this->cache->updateExpire('invalid', 2));
}
/**
* @testdox Cache data cannot be added if it already exists
* @covers \phpOMS\DataStorage\Cache\Connection\FileCache<extended>
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('Cache data cannot be added if it already exists')]
public function testInvalidOverwrite() : void
{
self::assertTrue($this->cache->add('addKey', 'testValAdd'));
@ -281,11 +266,8 @@ final class FileCacheTest extends \PHPUnit\Framework\TestCase
self::assertEquals('testValAdd', $this->cache->get('addKey'));
}
/**
* @testdox Existing cache data can be replaced
* @covers \phpOMS\DataStorage\Cache\Connection\FileCache<extended>
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('Existing cache data can be replaced')]
public function testReplace() : void
{
$this->cache->set('key4', 4);
@ -295,21 +277,15 @@ final class FileCacheTest extends \PHPUnit\Framework\TestCase
self::assertEquals(5, $this->cache->get('key4'));
}
/**
* @testdox None-existing cache data cannot be replaced
* @covers \phpOMS\DataStorage\Cache\Connection\FileCache<extended>
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('None-existing cache data cannot be replaced')]
public function testInvalidReplace() : void
{
self::assertFalse($this->cache->replace('keyInvalid', 5));
}
/**
* @testdox Existing cache data can be deleted
* @covers \phpOMS\DataStorage\Cache\Connection\FileCache<extended>
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('Existing cache data can be deleted')]
public function testDelete() : void
{
$this->cache->set('key4', 4);
@ -324,11 +300,8 @@ final class FileCacheTest extends \PHPUnit\Framework\TestCase
self::assertTrue($this->cache->delete('invalid'));
}
/**
* @testdox The cache correctly handles general cache information
* @covers \phpOMS\DataStorage\Cache\Connection\FileCache<extended>
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The cache correctly handles general cache information')]
public function testStats() : void
{
$this->cache->set('key1', 'testVal');
@ -347,11 +320,8 @@ final class FileCacheTest extends \PHPUnit\Framework\TestCase
);
}
/**
* @testdox The cache can be flushed
* @covers \phpOMS\DataStorage\Cache\Connection\FileCache<extended>
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The cache can be flushed')]
public function testFlush() : void
{
$this->cache->set('key1', 'testVal');
@ -373,22 +343,16 @@ final class FileCacheTest extends \PHPUnit\Framework\TestCase
);
}
/**
* @testdox Cache data can be set and returned with expiration limits
* @covers \phpOMS\DataStorage\Cache\Connection\FileCache<extended>
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('Cache data can be set and returned with expiration limits')]
public function testUnexpiredInputOutput() : void
{
$this->cache->set('key1', 'testVal', 1);
self::assertEquals('testVal', $this->cache->get('key1'));
}
/**
* @testdox Expired cache data cannot be returned
* @covers \phpOMS\DataStorage\Cache\Connection\FileCache<extended>
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('Expired cache data cannot be returned')]
public function testExpiredInputOutput() : void
{
$this->cache->set('key2', 'testVal2', 1);
@ -398,11 +362,8 @@ final class FileCacheTest extends \PHPUnit\Framework\TestCase
self::assertNull($this->cache->get('key2')); // this causes a side effect of deleting the outdated cache element!!!
}
/**
* @testdox Expired cache data can be forced to return
* @covers \phpOMS\DataStorage\Cache\Connection\FileCache<extended>
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('Expired cache data can be forced to return')]
public function testForceExpiredInputOutput() : void
{
$this->cache->set('key2', 'testVal2', 1);
@ -410,22 +371,16 @@ final class FileCacheTest extends \PHPUnit\Framework\TestCase
self::assertEquals('testVal2', $this->cache->get('key2', 10));
}
/**
* @testdox Unexpired cache data cannot be delete if lower expiration is defined
* @covers \phpOMS\DataStorage\Cache\Connection\FileCache<extended>
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('Unexpired cache data cannot be delete if lower expiration is defined')]
public function testInvalidDeleteUnexpired() : void
{
$this->cache->set('key4', 'testVal4', 60);
self::assertFalse($this->cache->delete('key4', 0));
}
/**
* @testdox Expired cache data can be deleted if equal expiration is defined
* @covers \phpOMS\DataStorage\Cache\Connection\FileCache<extended>
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('Expired cache data can be deleted if equal expiration is defined')]
public function testDeleteExpired() : void
{
$this->cache->set('key4', 'testVal4', 1);
@ -433,11 +388,8 @@ final class FileCacheTest extends \PHPUnit\Framework\TestCase
self::assertTrue($this->cache->delete('key4', 1));
}
/**
* @testdox Unexpired data can be force deleted with lower expiration date
* @covers \phpOMS\DataStorage\Cache\Connection\FileCache<extended>
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('Unexpired data can be force deleted with lower expiration date')]
public function testForceDeleteUnexpired() : void
{
$this->cache->set('key5', 'testVal5', 10000);
@ -446,11 +398,8 @@ final class FileCacheTest extends \PHPUnit\Framework\TestCase
self::assertTrue($this->cache->delete('key5', 1));
}
/**
* @testdox Cache data can be flushed by expiration date
* @covers \phpOMS\DataStorage\Cache\Connection\FileCache<extended>
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('Cache data can be flushed by expiration date')]
public function testFlushExpired() : void
{
$this->cache->set('key6', 'testVal6', 1);
@ -460,11 +409,8 @@ final class FileCacheTest extends \PHPUnit\Framework\TestCase
self::assertNull($this->cache->get('key6', 0));
}
/**
* @testdox A bad cache status will prevent all cache actions
* @covers \phpOMS\DataStorage\Cache\Connection\FileCache<extended>
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('A bad cache status will prevent all cache actions')]
public function testBadCacheStatus() : void
{
TestUtils::setMember($this->cache, 'status', CacheStatus::FAILURE);
@ -479,11 +425,8 @@ final class FileCacheTest extends \PHPUnit\Framework\TestCase
self::assertEquals([], $this->cache->stats());
}
/**
* @testdox A invalid cache connection will throw an InvalidConnectionConfigException
* @covers \phpOMS\DataStorage\Cache\Connection\FileCache<extended>
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('A invalid cache connection will throw an InvalidConnectionConfigException')]
public function testInvalidCachePath() : void
{
$this->expectException(\phpOMS\DataStorage\Cache\Exception\InvalidConnectionConfigException::class);
@ -491,11 +434,8 @@ final class FileCacheTest extends \PHPUnit\Framework\TestCase
$this->cache = new FileCache("/root/etc/invalidPathOrPermission^$:?><");
}
/**
* @testdox Adding a invalid data type will throw an InvalidArgumentException
* @covers \phpOMS\DataStorage\Cache\Connection\FileCache<extended>
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('Adding a invalid data type will throw an InvalidArgumentException')]
public function testInvalidDataTypeAdd() : void
{
$this->expectException(\InvalidArgumentException::class);
@ -503,11 +443,8 @@ final class FileCacheTest extends \PHPUnit\Framework\TestCase
$this->cache->add('invalid', $this->cache);
}
/**
* @testdox Setting a invalid data type will throw an InvalidArgumentException
* @covers \phpOMS\DataStorage\Cache\Connection\FileCache<extended>
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('Setting a invalid data type will throw an InvalidArgumentException')]
public function testInvalidDataTypeSet() : void
{
$this->expectException(\InvalidArgumentException::class);

View File

@ -20,10 +20,10 @@ use phpOMS\DataStorage\Cache\Connection\MemCached;
use phpOMS\Utils\TestUtils;
/**
* @testdox phpOMS\tests\DataStorage\Cache\Connection\MemCachedTest: Memcache connection
*
* @internal
*/
#[\PHPUnit\Framework\Attributes\CoversClass(\phpOMS\DataStorage\Cache\Connection\MemCached::class)]
#[\PHPUnit\Framework\Attributes\TestDox('phpOMS\tests\DataStorage\Cache\Connection\MemCachedTest: Memcache connection')]
final class MemCachedTest extends \PHPUnit\Framework\TestCase
{
protected MemCached $cache;
@ -47,11 +47,8 @@ final class MemCachedTest extends \PHPUnit\Framework\TestCase
$this->cache->flushAll();
}
/**
* @testdox The memcached connection has the expected default values after initialization
* @covers \phpOMS\DataStorage\Cache\Connection\MemCached<extended>
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The memcached connection has the expected default values after initialization')]
public function testDefault() : void
{
self::assertEquals(CacheType::MEMCACHED, $this->cache->getType());
@ -71,11 +68,8 @@ final class MemCachedTest extends \PHPUnit\Framework\TestCase
);
}
/**
* @testdox The connection to a cache can be established (none-existing directories get created)
* @covers \phpOMS\DataStorage\Cache\Connection\MemCached<extended>
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The connection to a cache can be established (none-existing directories get created)')]
public function testConnect() : void
{
$cache = new MemCached($GLOBALS['CONFIG']['cache']['memcached']);
@ -85,11 +79,8 @@ final class MemCachedTest extends \PHPUnit\Framework\TestCase
self::assertEquals((int) $GLOBALS['CONFIG']['cache']['memcached']['port'], $cache->getPort());
}
/**
* @testdox Different cache data (types) can be set and returned
* @covers \phpOMS\DataStorage\Cache\Connection\MemCached<extended>
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('Different cache data (types) can be set and returned')]
public function testSetInputOutput() : void
{
$this->cache->set('key1', 'testVal');
@ -120,11 +111,8 @@ final class MemCachedTest extends \PHPUnit\Framework\TestCase
*/
}
/**
* @testdox Cache data can bet added and returned
* @covers \phpOMS\DataStorage\Cache\Connection\MemCached<extended>
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('Cache data can bet added and returned')]
public function testAddInputOutput() : void
{
self::assertTrue($this->cache->add('addKey', 'testValAdd'));
@ -217,11 +205,8 @@ final class MemCachedTest extends \PHPUnit\Framework\TestCase
self::assertFalse($this->cache->updateExpire('invalid', 2));
}
/**
* @testdox Cache data cannot be added if it already exists
* @covers \phpOMS\DataStorage\Cache\Connection\MemCached<extended>
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('Cache data cannot be added if it already exists')]
public function testInvalidOverwrite() : void
{
self::assertTrue($this->cache->add('addKey', 'testValAdd'));
@ -229,11 +214,8 @@ final class MemCachedTest extends \PHPUnit\Framework\TestCase
self::assertEquals('testValAdd', $this->cache->get('addKey'));
}
/**
* @testdox Existing cache data can be replaced
* @covers \phpOMS\DataStorage\Cache\Connection\MemCached<extended>
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('Existing cache data can be replaced')]
public function testReplace() : void
{
$this->cache->set('key4', 4);
@ -243,21 +225,15 @@ final class MemCachedTest extends \PHPUnit\Framework\TestCase
self::assertEquals(5, $this->cache->get('key4'));
}
/**
* @testdox None-existing cache data cannot be replaced
* @covers \phpOMS\DataStorage\Cache\Connection\MemCached<extended>
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('None-existing cache data cannot be replaced')]
public function testInvalidReplace() : void
{
self::assertFalse($this->cache->replace('keyInvalid', 5));
}
/**
* @testdox Existing cache data can be deleted
* @covers \phpOMS\DataStorage\Cache\Connection\MemCached<extended>
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('Existing cache data can be deleted')]
public function testDelete() : void
{
$this->cache->set('key4', 4);
@ -278,11 +254,8 @@ final class MemCachedTest extends \PHPUnit\Framework\TestCase
self::assertTrue($this->cache->delete('invalid'));
}
/**
* @testdox The cache correctly handles general cache information
* @covers \phpOMS\DataStorage\Cache\Connection\MemCached<extended>
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The cache correctly handles general cache information')]
public function testStats() : void
{
$this->cache->set('key1', 'testVal');
@ -305,11 +278,8 @@ final class MemCachedTest extends \PHPUnit\Framework\TestCase
*/
}
/**
* @testdox The cache can be flushed
* @covers \phpOMS\DataStorage\Cache\Connection\MemCached<extended>
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The cache can be flushed')]
public function testFlush() : void
{
$this->cache->set('key1', 'testVal');
@ -326,22 +296,16 @@ final class MemCachedTest extends \PHPUnit\Framework\TestCase
self::assertGreaterThanOrEqual(0, $this->cache->stats()['size']);
}
/**
* @testdox Cache data can be set and returned with expiration limits
* @covers \phpOMS\DataStorage\Cache\Connection\MemCached<extended>
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('Cache data can be set and returned with expiration limits')]
public function testUnexpiredInputOutput() : void
{
$this->cache->set('key1', 'testVal', 1);
self::assertEquals('testVal', $this->cache->get('key1'));
}
/**
* @testdox Expired cache data cannot be returned
* @covers \phpOMS\DataStorage\Cache\Connection\MemCached<extended>
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('Expired cache data cannot be returned')]
public function testExpiredInputOutput() : void
{
$this->cache->set('key2', 'testVal2', 1);
@ -350,11 +314,8 @@ final class MemCachedTest extends \PHPUnit\Framework\TestCase
self::assertNull($this->cache->get('key2', 1));
}
/**
* @testdox Cache data can be flushed by expiration date
* @covers \phpOMS\DataStorage\Cache\Connection\MemCached<extended>
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('Cache data can be flushed by expiration date')]
public function testFlushExpired() : void
{
$this->cache->set('key6', 'testVal6', 1);
@ -364,11 +325,8 @@ final class MemCachedTest extends \PHPUnit\Framework\TestCase
self::assertNull($this->cache->get('key6', 0));
}
/**
* @testdox A bad cache status will prevent all cache actions
* @covers \phpOMS\DataStorage\Cache\Connection\MemCached<extended>
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('A bad cache status will prevent all cache actions')]
public function testBadCacheStatus() : void
{
TestUtils::setMember($this->cache, 'status', CacheStatus::FAILURE);
@ -383,11 +341,8 @@ final class MemCachedTest extends \PHPUnit\Framework\TestCase
self::assertEquals([], $this->cache->stats());
}
/**
* @testdox Adding a invalid data type will throw an InvalidArgumentException
* @covers \phpOMS\DataStorage\Cache\Connection\MemCached<extended>
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('Adding a invalid data type will throw an InvalidArgumentException')]
public function testInvalidDataTypeAdd() : void
{
$this->expectException(\InvalidArgumentException::class);
@ -395,11 +350,8 @@ final class MemCachedTest extends \PHPUnit\Framework\TestCase
$this->cache->add('invalid', $this->cache);
}
/**
* @testdox Setting a invalid data type will throw an InvalidArgumentException
* @covers \phpOMS\DataStorage\Cache\Connection\MemCached<extended>
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('Setting a invalid data type will throw an InvalidArgumentException')]
public function testInvalidDataTypeSet() : void
{
$this->expectException(\InvalidArgumentException::class);
@ -407,11 +359,8 @@ final class MemCachedTest extends \PHPUnit\Framework\TestCase
$this->cache->set('invalid', $this->cache);
}
/**
* @testdox A invalid host throws a InvalidConnectionConfigException
* @covers \phpOMS\DataStorage\Cache\Connection\MemCached<extended>
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('A invalid host throws a InvalidConnectionConfigException')]
public function testInvalidCacheHost() : void
{
$this->expectException(\phpOMS\DataStorage\Cache\Exception\InvalidConnectionConfigException::class);
@ -422,11 +371,8 @@ final class MemCachedTest extends \PHPUnit\Framework\TestCase
$cache = new MemCached($db);
}
/**
* @testdox A invalid port throws a InvalidConnectionConfigException
* @covers \phpOMS\DataStorage\Cache\Connection\MemCached<extended>
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('A invalid port throws a InvalidConnectionConfigException')]
public function testInvalidCachePort() : void
{
$this->expectException(\phpOMS\DataStorage\Cache\Exception\InvalidConnectionConfigException::class);

View File

@ -19,10 +19,10 @@ use phpOMS\DataStorage\Cache\CacheType;
use phpOMS\DataStorage\Cache\Connection\NullCache;
/**
* @testdox phpOMS\tests\DataStorage\Cache\Connection\NullCacheTest: Null cache connection if no cache is available
*
* @internal
*/
#[\PHPUnit\Framework\Attributes\CoversClass(\phpOMS\DataStorage\Cache\Connection\NullCache::class)]
#[\PHPUnit\Framework\Attributes\TestDox('phpOMS\tests\DataStorage\Cache\Connection\NullCacheTest: Null cache connection if no cache is available')]
final class NullCacheTest extends \PHPUnit\Framework\TestCase
{
protected NullCache $cache;
@ -35,11 +35,8 @@ final class NullCacheTest extends \PHPUnit\Framework\TestCase
$this->cache = new NullCache([]);
}
/**
* @testdox The default cache has the expected default values after initialization
* @covers \phpOMS\DataStorage\Cache\Connection\NullCache<extended>
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The default cache has the expected default values after initialization')]
public function testDefault() : void
{
self::assertEquals(CacheType::UNDEFINED, $this->cache->getType());

View File

@ -20,10 +20,11 @@ use phpOMS\DataStorage\Cache\Connection\RedisCache;
use phpOMS\Utils\TestUtils;
/**
* @testdox phpOMS\tests\DataStorage\Cache\Connection\RedisCache: Redis cache connection
*
* @internal
*/
#[\PHPUnit\Framework\Attributes\CoversClass(\phpOMS\DataStorage\Cache\Connection\RedisCache::class)]
#[\PHPUnit\Framework\Attributes\CoversClass(\phpOMS\DataStorage\Cache\Connection\MemCached::class)]
#[\PHPUnit\Framework\Attributes\TestDox('phpOMS\tests\DataStorage\Cache\Connection\RedisCache: Redis cache connection')]
final class RedisCacheTest extends \PHPUnit\Framework\TestCase
{
protected RedisCache $cache;
@ -47,11 +48,8 @@ final class RedisCacheTest extends \PHPUnit\Framework\TestCase
$this->cache->flushAll();
}
/**
* @testdox The redis cache connection has the expected default values after initialization
* @covers \phpOMS\DataStorage\Cache\Connection\RedisCache<extended>
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The redis cache connection has the expected default values after initialization')]
public function testDefault() : void
{
self::assertEquals(CacheType::REDIS, $this->cache->getType());
@ -66,11 +64,8 @@ final class RedisCacheTest extends \PHPUnit\Framework\TestCase
self::assertEquals(6379, $this->cache->getPort());
}
/**
* @testdox The connection to a cache can be established (none-existing directories get created)
* @covers \phpOMS\DataStorage\Cache\Connection\RedisCache<extended>
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The connection to a cache can be established (none-existing directories get created)')]
public function testConnect() : void
{
$cache = new RedisCache($GLOBALS['CONFIG']['cache']['redis']);
@ -81,11 +76,8 @@ final class RedisCacheTest extends \PHPUnit\Framework\TestCase
self::assertEquals((int) $GLOBALS['CONFIG']['cache']['redis']['port'], $cache->getPort());
}
/**
* @testdox Different cache data (types) can be set and returned
* @covers \phpOMS\DataStorage\Cache\Connection\RedisCache<extended>
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('Different cache data (types) can be set and returned')]
public function testSetInputOutput() : void
{
$this->cache->set('key1', 'testVal');
@ -113,11 +105,8 @@ final class RedisCacheTest extends \PHPUnit\Framework\TestCase
self::assertEquals('asdf', $this->cache->get('key8')->val);
}
/**
* @testdox Cache data can bet added and returned
* @covers \phpOMS\DataStorage\Cache\Connection\RedisCache<extended>
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('Cache data can bet added and returned')]
public function testAddInputOutput() : void
{
self::assertTrue($this->cache->add('addKey', 'testValAdd'));
@ -252,11 +241,8 @@ final class RedisCacheTest extends \PHPUnit\Framework\TestCase
self::assertFalse($this->cache->updateExpire('invalid', 2));
}
/**
* @testdox Cache data cannot be added if it already exists
* @covers \phpOMS\DataStorage\Cache\Connection\RedisCache<extended>
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('Cache data cannot be added if it already exists')]
public function testInvalidOverwrite() : void
{
self::assertTrue($this->cache->add('addKey', 'testValAdd'));
@ -264,11 +250,8 @@ final class RedisCacheTest extends \PHPUnit\Framework\TestCase
self::assertEquals('testValAdd', $this->cache->get('addKey'));
}
/**
* @testdox Existing cache data can be replaced
* @covers \phpOMS\DataStorage\Cache\Connection\RedisCache<extended>
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('Existing cache data can be replaced')]
public function testReplace() : void
{
$this->cache->set('key4', 4);
@ -278,21 +261,15 @@ final class RedisCacheTest extends \PHPUnit\Framework\TestCase
self::assertEquals(5, $this->cache->get('key4'));
}
/**
* @testdox None-existing cache data cannot be replaced
* @covers \phpOMS\DataStorage\Cache\Connection\RedisCache<extended>
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('None-existing cache data cannot be replaced')]
public function testInvalidReplace() : void
{
self::assertFalse($this->cache->replace('keyInvalid', 5));
}
/**
* @testdox Existing cache data can be deleted
* @covers \phpOMS\DataStorage\Cache\Connection\RedisCache<extended>
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('Existing cache data can be deleted')]
public function testDelete() : void
{
$this->cache->set('key4', 4);
@ -313,11 +290,8 @@ final class RedisCacheTest extends \PHPUnit\Framework\TestCase
self::assertTrue($this->cache->delete('invalid'));
}
/**
* @testdox The cache correctly handles general cache information
* @covers \phpOMS\DataStorage\Cache\Connection\RedisCache<extended>
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The cache correctly handles general cache information')]
public function testStats() : void
{
$this->cache->set('key1', 'testVal');
@ -330,11 +304,8 @@ final class RedisCacheTest extends \PHPUnit\Framework\TestCase
self::assertGreaterThan(0, $this->cache->stats()['size']);
}
/**
* @testdox The cache can be flushed
* @covers \phpOMS\DataStorage\Cache\Connection\RedisCache<extended>
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The cache can be flushed')]
public function testFlush() : void
{
$this->cache->set('key1', 'testVal');
@ -351,22 +322,16 @@ final class RedisCacheTest extends \PHPUnit\Framework\TestCase
self::assertGreaterThanOrEqual(0, $this->cache->stats()['size']);
}
/**
* @testdox Cache data can be set and returned with expiration limits
* @covers \phpOMS\DataStorage\Cache\Connection\RedisCache<extended>
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('Cache data can be set and returned with expiration limits')]
public function testUnexpiredInputOutput() : void
{
$this->cache->set('key1', 'testVal', 1);
self::assertEquals('testVal', $this->cache->get('key1'));
}
/**
* @testdox Expired cache data cannot be returned
* @covers \phpOMS\DataStorage\Cache\Connection\RedisCache<extended>
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('Expired cache data cannot be returned')]
public function testExpiredInputOutput() : void
{
$this->cache->set('key2', 'testVal2', 1);
@ -375,11 +340,8 @@ final class RedisCacheTest extends \PHPUnit\Framework\TestCase
self::assertNull($this->cache->get('key2', 1));
}
/**
* @testdox A bad cache status will prevent all cache actions
* @covers \phpOMS\DataStorage\Cache\Connection\RedisCache<extended>
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('A bad cache status will prevent all cache actions')]
public function testBadCacheStatus() : void
{
TestUtils::setMember($this->cache, 'status', CacheStatus::FAILURE);
@ -394,11 +356,8 @@ final class RedisCacheTest extends \PHPUnit\Framework\TestCase
self::assertEquals([], $this->cache->stats());
}
/**
* @testdox Adding a invalid data type will throw an InvalidArgumentException
* @covers \phpOMS\DataStorage\Cache\Connection\MemCached<extended>
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('Adding a invalid data type will throw an InvalidArgumentException')]
public function testInvalidDataTypeAdd() : void
{
$this->expectException(\InvalidArgumentException::class);
@ -406,11 +365,8 @@ final class RedisCacheTest extends \PHPUnit\Framework\TestCase
$this->cache->add('invalid', $this->cache);
}
/**
* @testdox Setting a invalid data type will throw an InvalidArgumentException
* @covers \phpOMS\DataStorage\Cache\Connection\MemCached<extended>
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('Setting a invalid data type will throw an InvalidArgumentException')]
public function testInvalidDataTypeSet() : void
{
$this->expectException(\InvalidArgumentException::class);
@ -418,11 +374,8 @@ final class RedisCacheTest extends \PHPUnit\Framework\TestCase
$this->cache->set('invalid', $this->cache);
}
/**
* @testdox A invalid host throws a InvalidConnectionConfigException
* @covers \phpOMS\DataStorage\Cache\Connection\RedisCache<extended>
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('A invalid host throws a InvalidConnectionConfigException')]
public function testInvalidCacheHost() : void
{
$this->expectException(\phpOMS\DataStorage\Cache\Exception\InvalidConnectionConfigException::class);
@ -433,11 +386,8 @@ final class RedisCacheTest extends \PHPUnit\Framework\TestCase
$cache = new RedisCache($db);
}
/**
* @testdox A invalid port throws a InvalidConnectionConfigException
* @covers \phpOMS\DataStorage\Cache\Connection\RedisCache<extended>
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('A invalid port throws a InvalidConnectionConfigException')]
public function testInvalidCachePort() : void
{
$this->expectException(\phpOMS\DataStorage\Cache\Exception\InvalidConnectionConfigException::class);
@ -448,11 +398,8 @@ final class RedisCacheTest extends \PHPUnit\Framework\TestCase
$cache = new RedisCache($db);
}
/**
* @testdox A invalid database throws a InvalidConnectionConfigException
* @covers \phpOMS\DataStorage\Cache\Connection\RedisCache<extended>
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('A invalid database throws a InvalidConnectionConfigException')]
public function testInvalidCacheDatabase() : void
{
$this->expectException(\phpOMS\DataStorage\Cache\Exception\InvalidConnectionConfigException::class);

View File

@ -19,12 +19,10 @@ use phpOMS\DataStorage\Cache\Exception\InvalidConnectionConfigException;
/**
* @internal
*/
#[\PHPUnit\Framework\Attributes\CoversClass(\phpOMS\DataStorage\Cache\Exception\InvalidConnectionConfigException::class)]
final class InvalidConnectionConfigExceptionTest extends \PHPUnit\Framework\TestCase
{
/**
* @covers \phpOMS\DataStorage\Cache\Exception\InvalidConnectionConfigException
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
public function testException() : void
{
self::assertInstanceOf(\InvalidArgumentException::class, new InvalidConnectionConfigException(''));

View File

@ -17,10 +17,9 @@ namespace phpOMS\tests\DataStorage\Cookie;
use phpOMS\DataStorage\Cookie\CookieJar;
/**
* @testdox phpOMS\tests\DataStorage\Cookie\CookieJar: CookieJar to handle http cookies
*
* @internal
*/
#[\PHPUnit\Framework\Attributes\TestDox('phpOMS\tests\DataStorage\Cookie\CookieJar: CookieJar to handle http cookies')]
final class CookieJarTest extends \PHPUnit\Framework\TestCase
{
protected CookieJar $jar;
@ -33,10 +32,8 @@ final class CookieJarTest extends \PHPUnit\Framework\TestCase
$this->jar = new CookieJar();
}
/**
* @testdox The cookie jar has the expected default values and functionality after initialization
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The cookie jar has the expected default values and functionality after initialization')]
public function testDefault() : void
{
self::assertFalse(CookieJar::isLocked());
@ -44,10 +41,8 @@ final class CookieJarTest extends \PHPUnit\Framework\TestCase
self::assertFalse($this->jar->delete('abc'));
}
/**
* @testdox Cookie values can be set and returned
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('Cookie values can be set and returned')]
public function testCookieInputOutput() : void
{
self::assertTrue($this->jar->set('test', 'value'));
@ -57,40 +52,32 @@ final class CookieJarTest extends \PHPUnit\Framework\TestCase
self::assertEquals('value2', $this->jar->get('test2')['value']);
}
/**
* @testdox Cookie values cannot be overwritten
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('Cookie values cannot be overwritten')]
public function testInvalidOverwrite() : void
{
self::assertTrue($this->jar->set('test', 'value'));
self::assertFalse($this->jar->set('test', 'value', 86400, '/', null, false, true, false));
}
/**
* @testdox Cookie values can be forced to overwrite
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('Cookie values can be forced to overwrite')]
public function testOverwrite() : void
{
self::assertTrue($this->jar->set('test', 'value'));
self::assertTrue($this->jar->set('test', 'value2', 86400, '/', null, false, true, true));
}
/**
* @testdox Cookie values can be removed
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('Cookie values can be removed')]
public function testRemove() : void
{
self::assertTrue($this->jar->set('test', 'value'));
self::assertTrue($this->jar->remove('test'));
}
/**
* @testdox None-existing cookie values cannot be removed
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('None-existing cookie values cannot be removed')]
public function testInvalidRemove() : void
{
self::assertTrue($this->jar->set('test', 'value'));
@ -98,10 +85,8 @@ final class CookieJarTest extends \PHPUnit\Framework\TestCase
self::assertFalse($this->jar->remove('test'));
}
/**
* @testdox Values cannot be removed from a locked cookie and throws a LockException
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('Values cannot be removed from a locked cookie and throws a LockException')]
public function testDeleteLocked() : void
{
$this->expectException(\phpOMS\DataStorage\LockException::class);
@ -112,10 +97,8 @@ final class CookieJarTest extends \PHPUnit\Framework\TestCase
$this->jar->delete('test');
}
/**
* @testdox A locked cookie cannot be saved and throws a LockException
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('A locked cookie cannot be saved and throws a LockException')]
public function testSaveLocked() : void
{
$this->expectException(\phpOMS\DataStorage\LockException::class);

View File

@ -21,17 +21,14 @@ use phpOMS\DataStorage\Database\Connection\SQLiteConnection;
use phpOMS\DataStorage\Database\Connection\SqlServerConnection;
/**
* @testdox phpOMS\tests\DataStorage\Database\Connection\ConnectionFactory: Database connection factory
*
* @internal
*/
#[\PHPUnit\Framework\Attributes\CoversClass(\phpOMS\DataStorage\Database\Connection\ConnectionFactory::class)]
#[\PHPUnit\Framework\Attributes\TestDox('phpOMS\tests\DataStorage\Database\Connection\ConnectionFactory: Database connection factory')]
final class ConnectionFactoryTest extends \PHPUnit\Framework\TestCase
{
/**
* @testdox The mysql connection can be successfully created
* @covers \phpOMS\DataStorage\Database\Connection\ConnectionFactory
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The mysql connection can be successfully created')]
public function testCreateMysql() : void
{
if (!\extension_loaded('pdo_mysql')) {
@ -48,11 +45,8 @@ final class ConnectionFactoryTest extends \PHPUnit\Framework\TestCase
);
}
/**
* @testdox The postgresql connection can be successfully created
* @covers \phpOMS\DataStorage\Database\Connection\ConnectionFactory
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The postgresql connection can be successfully created')]
public function testCreatePostgres() : void
{
if (!\extension_loaded('pdo_pgsql')) {
@ -69,11 +63,8 @@ final class ConnectionFactoryTest extends \PHPUnit\Framework\TestCase
);
}
/**
* @testdox The sqlserver connection can be successfully created
* @covers \phpOMS\DataStorage\Database\Connection\ConnectionFactory
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The sqlserver connection can be successfully created')]
public function testCreateSqlsrv() : void
{
if (!\extension_loaded('pdo_sqlsrv')) {
@ -90,11 +81,8 @@ final class ConnectionFactoryTest extends \PHPUnit\Framework\TestCase
);
}
/**
* @testdox The sqlite connection can be successfully created
* @covers \phpOMS\DataStorage\Database\Connection\ConnectionFactory
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('The sqlite connection can be successfully created')]
public function testCreateSqlite() : void
{
if (!\extension_loaded('pdo_sqlite')) {
@ -111,11 +99,8 @@ final class ConnectionFactoryTest extends \PHPUnit\Framework\TestCase
);
}
/**
* @testdox A invalid database type throws a InvalidArgumentException
* @covers \phpOMS\DataStorage\Database\Connection\ConnectionFactory
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('A invalid database type throws a InvalidArgumentException')]
public function testInvalidDatabaseType() : void
{
$this->expectException(\InvalidArgumentException::class);

View File

@ -19,10 +19,11 @@ use phpOMS\DataStorage\Database\DatabaseStatus;
use phpOMS\DataStorage\Database\DatabaseType;
/**
* @testdox phpOMS\tests\DataStorage\Database\Connection\MysqlConnectionTest: Mysql connection
*
* @internal
*/
#[\PHPUnit\Framework\Attributes\CoversClass(\phpOMS\DataStorage\Database\Connection\MysqlConnection::class)]
#[\PHPUnit\Framework\Attributes\CoversClass(\phpOMS\DataStorage\Database\Connection\MysqlConnection::class)]
#[\PHPUnit\Framework\Attributes\TestDox('phpOMS\tests\DataStorage\Database\Connection\MysqlConnectionTest: Mysql connection')]
final class MysqlConnectionTest extends \PHPUnit\Framework\TestCase
{
protected function setUp() : void
@ -34,11 +35,8 @@ final class MysqlConnectionTest extends \PHPUnit\Framework\TestCase
}
}
/**
* @testdox Valid mysql connection data result in a valid database connection
* @covers \phpOMS\DataStorage\Database\Connection\MysqlConnection<extended>
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('Valid mysql connection data result in a valid database connection')]
public function testConnect() : void
{
$mysql = new MysqlConnection($GLOBALS['CONFIG']['db']['core']['masters']['admin']);
@ -53,11 +51,8 @@ final class MysqlConnectionTest extends \PHPUnit\Framework\TestCase
$mysql->close();
}
/**
* @testdox A missing database type returns a failure
* @covers \phpOMS\DataStorage\Database\Connection\MysqlConnection
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('A missing database type returns a failure')]
public function testInvalidDatabaseType() : void
{
$db = $GLOBALS['CONFIG']['db']['core']['masters']['admin'];
@ -69,11 +64,8 @@ final class MysqlConnectionTest extends \PHPUnit\Framework\TestCase
$mysql->close();
}
/**
* @testdox A missing database host returns a failure
* @covers \phpOMS\DataStorage\Database\Connection\MysqlConnection
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('A missing database host returns a failure')]
public function testInvalidHost() : void
{
$db = $GLOBALS['CONFIG']['db']['core']['masters']['admin'];
@ -85,11 +77,8 @@ final class MysqlConnectionTest extends \PHPUnit\Framework\TestCase
$mysql->close();
}
/**
* @testdox A missing database port returns a failure
* @covers \phpOMS\DataStorage\Database\Connection\MysqlConnection
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('A missing database port returns a failure')]
public function testInvalidPort() : void
{
$db = $GLOBALS['CONFIG']['db']['core']['masters']['admin'];
@ -101,11 +90,8 @@ final class MysqlConnectionTest extends \PHPUnit\Framework\TestCase
$mysql->close();
}
/**
* @testdox A missing database returns a failure
* @covers \phpOMS\DataStorage\Database\Connection\MysqlConnection
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('A missing database returns a failure')]
public function testInvalidDatabase() : void
{
$db = $GLOBALS['CONFIG']['db']['core']['masters']['admin'];
@ -117,11 +103,8 @@ final class MysqlConnectionTest extends \PHPUnit\Framework\TestCase
$mysql->close();
}
/**
* @testdox A missing database login returns a failure
* @covers \phpOMS\DataStorage\Database\Connection\MysqlConnection
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('A missing database login returns a failure')]
public function testInvalidLogin() : void
{
$db = $GLOBALS['CONFIG']['db']['core']['masters']['admin'];
@ -133,11 +116,8 @@ final class MysqlConnectionTest extends \PHPUnit\Framework\TestCase
$mysql->close();
}
/**
* @testdox A missing database password returns a failure
* @covers \phpOMS\DataStorage\Database\Connection\MysqlConnection
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('A missing database password returns a failure')]
public function testInvalidPassword() : void
{
$db = $GLOBALS['CONFIG']['db']['core']['masters']['admin'];
@ -149,11 +129,8 @@ final class MysqlConnectionTest extends \PHPUnit\Framework\TestCase
$mysql->close();
}
/**
* @testdox A invalid database type returns a failure
* @covers \phpOMS\DataStorage\Database\Connection\MysqlConnection
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('A invalid database type returns a failure')]
public function testInvalidDatabaseTypeName() : void
{
$db = $GLOBALS['CONFIG']['db']['core']['masters']['admin'];
@ -165,11 +142,8 @@ final class MysqlConnectionTest extends \PHPUnit\Framework\TestCase
$mysql->close();
}
/**
* @testdox A invalid database returns a failure
* @covers \phpOMS\DataStorage\Database\Connection\MysqlConnection
* @group framework
*/
#[\PHPUnit\Framework\Attributes\Group('framework')]
#[\PHPUnit\Framework\Attributes\TestDox('A invalid database returns a failure')]
public function testInvalidDatabaseName() : void
{
$db = $GLOBALS['CONFIG']['db']['core']['masters']['admin'];

Some files were not shown because too many files have changed in this diff Show More