mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-01-11 17:58:41 +00:00
Add comments for test report
This commit is contained in:
parent
f24e6f4681
commit
a714359ea9
27
Account/NullGroup.php
Normal file
27
Account/NullGroup.php
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
<?php
|
||||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.4
|
||||
*
|
||||
* @package phpOMS\Account
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
* @link https://orange-management.org
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace phpOMS\Account;
|
||||
|
||||
/**
|
||||
* Null account class.
|
||||
*
|
||||
* @package phpOMS\Account
|
||||
* @license OMS License 1.0
|
||||
* @link https://orange-management.org
|
||||
* @since 1.0.0
|
||||
*/
|
||||
final class NullGroup extends Group
|
||||
{
|
||||
}
|
||||
|
|
@ -856,7 +856,7 @@ final class FinanceFormulas
|
|||
}
|
||||
|
||||
/**
|
||||
* Free Cash Flow to Equity (FCFE)
|
||||
* Free Cash Flow to Equity (FCFE = FCFF - dept payments)
|
||||
*
|
||||
* @param float $income Net income
|
||||
* @param float $depamo Depreciation & amortisation
|
||||
|
|
@ -948,7 +948,9 @@ final class FinanceFormulas
|
|||
}
|
||||
|
||||
/**
|
||||
* Future Value Factor
|
||||
* Geometric mean of return values
|
||||
*
|
||||
* Also known as compounded annual growth rate.
|
||||
*
|
||||
* @param array<float|int> $r Rate of return
|
||||
*
|
||||
|
|
@ -1252,7 +1254,7 @@ final class FinanceFormulas
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public static function getRateOfOnflation(float $newCPI, float $oldCPI) : float
|
||||
public static function getRateOfInflation(float $newCPI, float $oldCPI) : float
|
||||
{
|
||||
return $newCPI / $oldCPI - 1;
|
||||
}
|
||||
|
|
|
|||
30
tests/Account/NullGroupTest.php
Normal file
30
tests/Account/NullGroupTest.php
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.4
|
||||
*
|
||||
* @package tests
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
* @link https://orange-management.org
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace phpOMS\tests\Account;
|
||||
|
||||
require_once __DIR__ . '/../Autoloader.php';
|
||||
|
||||
use phpOMS\Account\NullGroup;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
class NullGroupTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
public function testNull() : void
|
||||
{
|
||||
self::assertInstanceOf('\phpOMS\Account\Group', new NullGroup());
|
||||
}
|
||||
}
|
||||
|
|
@ -12,17 +12,21 @@
|
|||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace phpOMS\Algorithm\Clustering;
|
||||
namespace phpOMS\tests\Algorithm\Clustering;
|
||||
|
||||
use phpOMS\Algorithm\Clustering\Kmeans;
|
||||
use phpOMS\Algorithm\Clustering\Point;
|
||||
|
||||
/**
|
||||
* @testdox phpOMS\Algorithm\Clustering\Kmeans: Test the kmeans clustering implementation
|
||||
* @testdox phpOMS\tests\Algorithm\Clustering\KmeansTest: Clustering points/elements with the K-means algorithm
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
class KmeansTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
/**
|
||||
* @testdox The clustering of points and dynamic check of new points works as expected
|
||||
*/
|
||||
public function testKmeans() : void
|
||||
{
|
||||
$result = false;
|
||||
|
|
|
|||
|
|
@ -12,17 +12,20 @@
|
|||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace phpOMS\Algorithm\Clustering;
|
||||
namespace phpOMS\tests\Algorithm\Clustering;
|
||||
|
||||
use phpOMS\Algorithm\Clustering\Point;
|
||||
|
||||
/**
|
||||
* @testdox phpOMS\Algorithm\Clustering\Point: Test the point for the clustering implementation
|
||||
* @testdox phpOMS\tests\Algorithm\Clustering\PointTest: Default point in a cluster
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
class PointTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
/**
|
||||
* @testdox The point has the expected default values after initialization
|
||||
*/
|
||||
public function testDefault() : void
|
||||
{
|
||||
$point = new Point([3.0, 2.0], 'abc');
|
||||
|
|
@ -34,7 +37,10 @@ class PointTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertEquals('abc', $point->getName());
|
||||
}
|
||||
|
||||
public function testSetGet() : void
|
||||
/**
|
||||
* @testdox Coordinates of a point can be changed
|
||||
*/
|
||||
public function testChangeCoordinates() : void
|
||||
{
|
||||
$point = new Point([3.0, 2.0], 'abc');
|
||||
|
||||
|
|
@ -44,6 +50,14 @@ class PointTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertEquals([4.0, 1.0], $point->getCoordinates());
|
||||
self::assertEquals(4.0, $point->getCoordinate(0));
|
||||
self::assertEquals(1.0, $point->getCoordinate(1));
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox The group/cluster of a point can be changed
|
||||
*/
|
||||
public function testChangeGroup() : void
|
||||
{
|
||||
$point = new Point([3.0, 2.0], 'abc');
|
||||
|
||||
$point->setGroup(2);
|
||||
self::assertEquals(2, $point->getGroup());
|
||||
|
|
|
|||
|
|
@ -12,19 +12,22 @@
|
|||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace phpOMS\Algorithm\CoinMatching;
|
||||
namespace phpOMS\tests\Algorithm\CoinMatching;
|
||||
|
||||
use phpOMS\Algorithm\CoinMatching\MinimumCoinProblem;
|
||||
|
||||
require_once __DIR__ . '/../../Autoloader.php';
|
||||
|
||||
/**
|
||||
* @testdox phpOMS\Algorithm\CoinMatching\MinimumCoinProblem: Test coin matching a value problem
|
||||
* @testdox phpOMS\tests\Algorithm\CoinMatching\MinimumCoinProblemTest: Match a value by using the minimum quantity of available sub values (Minimum Coin Problem)
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
class MinimumCoinProblemTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
/**
|
||||
* @testdox A value is matched with the minimum quantity of avialable coins.
|
||||
*/
|
||||
public function testMinimumCoins() : void
|
||||
{
|
||||
self::assertEquals(
|
||||
|
|
|
|||
|
|
@ -12,17 +12,20 @@
|
|||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace phpOMS\Algorithm\JobScheduling;
|
||||
namespace phpOMS\tests\Algorithm\JobScheduling;
|
||||
|
||||
use phpOMS\Algorithm\JobScheduling\Job;
|
||||
|
||||
/**
|
||||
* @testdox phpOMS\Algorithm\JobScheduling\Job: Test the job for the JobScheduling implementations
|
||||
* @testdox phpOMS\tests\Algorithm\JobScheduling\JobTest: Default job for the job scheduling
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
class JobTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
/**
|
||||
* @testdox The job has the expected values after initialization
|
||||
*/
|
||||
public function testDefault() : void
|
||||
{
|
||||
$item = new Job(3.0, new \DateTime('now'), null, 'abc');
|
||||
|
|
|
|||
|
|
@ -12,18 +12,22 @@
|
|||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace phpOMS\Algorithm\JobScheduling;
|
||||
namespace phpOMS\tests\Algorithm\JobScheduling;
|
||||
|
||||
use phpOMS\Algorithm\JobScheduling\Weighted;
|
||||
use phpOMS\Algorithm\JobScheduling\Job;
|
||||
|
||||
/**
|
||||
* @testdox phpOMS\Algorithm\JobScheduling\Weighted: Test the job for the JobScheduling implementations
|
||||
* @testdox phpOMS\tests\Algorithm\JobScheduling\WeightedTest: Job scheduling based on values/profit
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
class WeightedTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
public function testDefault() : void
|
||||
/**
|
||||
* @testdox The optimal job combination is selected to maximize the value/profit without overlapping jobs
|
||||
*/
|
||||
public function testNoOverlappingScheduling() : void
|
||||
{
|
||||
$jobs = [
|
||||
new Job(20, new \DateTime('2003-01-01'), new \DateTime('2010-01-01'), 'A'),
|
||||
|
|
@ -50,6 +54,9 @@ class WeightedTest extends \PHPUnit\Framework\TestCase
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox A job list with only one job simply returns one job
|
||||
*/
|
||||
public function testSmallList() : void
|
||||
{
|
||||
$jobs = [
|
||||
|
|
|
|||
|
|
@ -12,17 +12,21 @@
|
|||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace phpOMS\Algorithm\Knapsack;
|
||||
namespace phpOMS\tests\Algorithm\Knapsack;
|
||||
|
||||
use phpOMS\Algorithm\Knapsack\Backpack;
|
||||
use phpOMS\Algorithm\Knapsack\Item;
|
||||
|
||||
/**
|
||||
* @testdox phpOMS\Algorithm\Knapsack\Backpack: Test the backpack for the Knapsack implementations
|
||||
* @testdox phpOMS\tests\Algorithm\Knapsack\BackpackTest: The default backpack or basket which holds all items for the Knapsack algorithm
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
class BackpackTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
/**
|
||||
* @testdox The backpack has the expected values after initialization
|
||||
*/
|
||||
public function testDefault() : void
|
||||
{
|
||||
$backpack = new Backpack(3.0);
|
||||
|
|
@ -33,7 +37,10 @@ class BackpackTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertEquals([], $backpack->getItems());
|
||||
}
|
||||
|
||||
public function testGetSet() : void
|
||||
/**
|
||||
* @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);
|
||||
$backpack->addItem(new Item(2, 1), 2);
|
||||
|
|
|
|||
|
|
@ -12,17 +12,22 @@
|
|||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace phpOMS\Algorithm\Knapsack;
|
||||
namespace phpOMS\tests\Algorithm\Knapsack;
|
||||
|
||||
use phpOMS\Algorithm\Knapsack\Bounded;
|
||||
use phpOMS\Algorithm\Knapsack\Backpack;
|
||||
use phpOMS\Algorithm\Knapsack\Item;
|
||||
|
||||
/**
|
||||
* @testdox phpOMS\Algorithm\Knapsack\Bounded: Test the continuous Knapsack implementations
|
||||
* @testdox phpOMS\tests\Algorithm\Knapsack\BoundedTest: A Knapsack implementation for discrete quantities, values and costs and bounded item quantities
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
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
|
||||
*/
|
||||
public function testBackpacking() : void
|
||||
{
|
||||
$items = [
|
||||
|
|
|
|||
|
|
@ -12,17 +12,22 @@
|
|||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace phpOMS\Algorithm\Knapsack;
|
||||
namespace phpOMS\tests\Algorithm\Knapsack;
|
||||
|
||||
use phpOMS\Algorithm\Knapsack\Continuous;
|
||||
use phpOMS\Algorithm\Knapsack\Backpack;
|
||||
use phpOMS\Algorithm\Knapsack\Item;
|
||||
|
||||
/**
|
||||
* @testdox phpOMS\Algorithm\Knapsack\Continuous: Test the continuous Knapsack implementations
|
||||
* @testdox phpOMS\tests\Algorithm\Knapsack\ContinuousTest: A Knapsack implementation for continuous quantities, values and costs
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
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]
|
||||
*/
|
||||
public function testBackpacking() : void
|
||||
{
|
||||
$items = [
|
||||
|
|
@ -60,6 +65,9 @@ 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]
|
||||
*/
|
||||
public function testBackpackingAlternative() : void
|
||||
{
|
||||
$items = [
|
||||
|
|
|
|||
|
|
@ -12,17 +12,20 @@
|
|||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace phpOMS\Algorithm\Knapsack;
|
||||
namespace phpOMS\tests\Algorithm\Knapsack;
|
||||
|
||||
use phpOMS\Algorithm\Knapsack\Item;
|
||||
|
||||
/**
|
||||
* @testdox phpOMS\Algorithm\Knapsack\Item: Test the item for the Knapsack implementations
|
||||
* @testdox phpOMS\tests\Algorithm\Knapsack\ItemTest: The default item to be added to the backpack or basket
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
class ItemTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
/**
|
||||
* @testdox The item has the expected values after initialization
|
||||
*/
|
||||
public function testDefault() : void
|
||||
{
|
||||
$item = new Item(3.0, 2.0, 'abc');
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ use phpOMS\Algorithm\PathFinding\AStar;
|
|||
require_once __DIR__ . '/../../Autoloader.php';
|
||||
|
||||
/**
|
||||
* @testdox phpOMS\tests\Algorithm\PathFinding: jump point search test
|
||||
* @testdox phpOMS\tests\Algorithm\PathFinding\AStarTest: AStar path finding
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
|
|
@ -67,6 +67,9 @@ class AStarTest extends \PHPUnit\Framework\TestCase
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox The correct path is found for diagonal movement
|
||||
*/
|
||||
public function testPathFindingDiagonal() : void
|
||||
{
|
||||
$grid = Grid::createGridFromArray($this->gridArray, AStarNode::class);
|
||||
|
|
@ -106,6 +109,9 @@ class AStarTest extends \PHPUnit\Framework\TestCase
|
|||
], $this->gridArray);
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox The correct path is found for straight movement
|
||||
*/
|
||||
public function testPathFindingStraight() : void
|
||||
{
|
||||
$grid = Grid::createGridFromArray($this->gridArray, AStarNode::class);
|
||||
|
|
@ -145,6 +151,9 @@ class AStarTest extends \PHPUnit\Framework\TestCase
|
|||
], $this->gridArray);
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox The correct path is found for diagonal movement [one obstacle]
|
||||
*/
|
||||
public function testPathFindingDiagonalOneObstacle() : void
|
||||
{
|
||||
$grid = Grid::createGridFromArray($this->gridArray, AStarNode::class);
|
||||
|
|
@ -184,6 +193,9 @@ class AStarTest extends \PHPUnit\Framework\TestCase
|
|||
], $this->gridArray);
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox The correct path is found for diagonal movement [no obstacle]
|
||||
*/
|
||||
public function testPathFindingDiagonalNoObstacle() : void
|
||||
{
|
||||
$grid = Grid::createGridFromArray($this->gridArray, AStarNode::class);
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ use phpOMS\Algorithm\PathFinding\JumpPointSearch;
|
|||
require_once __DIR__ . '/../../Autoloader.php';
|
||||
|
||||
/**
|
||||
* @testdox phpOMS\tests\Algorithm\PathFinding: jump point search test
|
||||
* @testdox phpOMS\tests\Algorithm\PathFinding\JumpPointSearchTest: JumpPoint path finding
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
|
|
@ -67,6 +67,9 @@ class JumpPointSearchTest extends \PHPUnit\Framework\TestCase
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox The correct path is found for diagonal movement
|
||||
*/
|
||||
public function testPathFindingDiagonal() : void
|
||||
{
|
||||
$grid = Grid::createGridFromArray($this->gridArray, JumpPointNode::class);
|
||||
|
|
@ -106,6 +109,9 @@ class JumpPointSearchTest extends \PHPUnit\Framework\TestCase
|
|||
], $this->gridArray);
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox The correct path is found for straight movement
|
||||
*/
|
||||
public function testPathFindingStraight() : void
|
||||
{
|
||||
$grid = Grid::createGridFromArray($this->gridArray, JumpPointNode::class);
|
||||
|
|
@ -145,6 +151,9 @@ class JumpPointSearchTest extends \PHPUnit\Framework\TestCase
|
|||
], $this->gridArray);
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox The correct path is found for diagonal movement [one obstacle]
|
||||
*/
|
||||
public function testPathFindingDiagonalOneObstacle() : void
|
||||
{
|
||||
$grid = Grid::createGridFromArray($this->gridArray, JumpPointNode::class);
|
||||
|
|
@ -184,6 +193,9 @@ class JumpPointSearchTest extends \PHPUnit\Framework\TestCase
|
|||
], $this->gridArray);
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox The correct path is found for diagonal movement [no obstacle]
|
||||
*/
|
||||
public function testPathFindingDiagonalNoObstacle() : void
|
||||
{
|
||||
$grid = Grid::createGridFromArray($this->gridArray, JumpPointNode::class);
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ use phpOMS\Algorithm\Sort\SortOrder;
|
|||
require_once __DIR__ . '/../../Autoloader.php';
|
||||
|
||||
/**
|
||||
* @testdox phpOMS\tests\Algorithm\Sort: Bitonic sort test
|
||||
* @testdox phpOMS\tests\Algorithm\Sort\BitonicSortTest: Bitonic sort
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
|
|
@ -38,6 +38,9 @@ class BitonicSortTest extends \PHPUnit\Framework\TestCase
|
|||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox A list with one element returns the list with the element itself
|
||||
*/
|
||||
public function testSmallList() : void
|
||||
{
|
||||
$smallList = [new NumericElement(3)];
|
||||
|
|
@ -46,6 +49,9 @@ class BitonicSortTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertEquals($smallList, $newList);
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox A list ot elements can be sorted in ASC order
|
||||
*/
|
||||
public function testSortASC() : void
|
||||
{
|
||||
$newList = BitonicSort::sort($this->list);
|
||||
|
|
@ -58,6 +64,9 @@ class BitonicSortTest extends \PHPUnit\Framework\TestCase
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox A list ot elements can be sorted in DESC order
|
||||
*/
|
||||
public function testSortDESC() : void
|
||||
{
|
||||
$newList = BitonicSort::sort($this->list, SortOrder::DESC);
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ use phpOMS\Algorithm\Sort\SortOrder;
|
|||
require_once __DIR__ . '/../../Autoloader.php';
|
||||
|
||||
/**
|
||||
* @testdox phpOMS\tests\Algorithm\Sort: Bubble sort test
|
||||
* @testdox phpOMS\tests\Algorithm\Sort\BubbleSortTest: Bubble sort
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
|
|
@ -39,6 +39,9 @@ class BubbleSortTest extends \PHPUnit\Framework\TestCase
|
|||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox A list with one element returns the list with the element itself
|
||||
*/
|
||||
public function testSmallList() : void
|
||||
{
|
||||
$smallList = [new NumericElement(3)];
|
||||
|
|
@ -47,6 +50,9 @@ class BubbleSortTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertEquals($smallList, $newList);
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox A list ot elements can be sorted in ASC order
|
||||
*/
|
||||
public function testSortASC() : void
|
||||
{
|
||||
$newList = BubbleSort::sort($this->list);
|
||||
|
|
@ -59,6 +65,9 @@ class BubbleSortTest extends \PHPUnit\Framework\TestCase
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox A list ot elements can be sorted in DESC order
|
||||
*/
|
||||
public function testSortDESC() : void
|
||||
{
|
||||
$newList = BubbleSort::sort($this->list, SortOrder::DESC);
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ use phpOMS\Algorithm\Sort\SortOrder;
|
|||
require_once __DIR__ . '/../../Autoloader.php';
|
||||
|
||||
/**
|
||||
* @testdox phpOMS\tests\Algorithm\Sort: Bucket sort test
|
||||
* @testdox phpOMS\tests\Algorithm\Sort\BucketSortTest: Bucket sort
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
|
|
@ -39,6 +39,9 @@ class BucketSortTest extends \PHPUnit\Framework\TestCase
|
|||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox A list with one element returns the list with the element itself
|
||||
*/
|
||||
public function testSmallList() : void
|
||||
{
|
||||
$smallList = [new NumericElement(3)];
|
||||
|
|
@ -47,6 +50,9 @@ class BucketSortTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertEquals($smallList, $newList);
|
||||
}
|
||||
|
||||
/**
|
||||
* @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);
|
||||
|
|
@ -59,6 +65,9 @@ class BucketSortTest extends \PHPUnit\Framework\TestCase
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @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);
|
||||
|
|
@ -71,6 +80,9 @@ class BucketSortTest extends \PHPUnit\Framework\TestCase
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @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);
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ use phpOMS\Algorithm\Sort\SortOrder;
|
|||
require_once __DIR__ . '/../../Autoloader.php';
|
||||
|
||||
/**
|
||||
* @testdox phpOMS\tests\Algorithm\Sort: CocktailShaker sort test
|
||||
* @testdox phpOMS\tests\Algorithm\Sort\CocktailShakerSortTest: CocktailShaker sort
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
|
|
@ -39,6 +39,9 @@ class CocktailShakerSortTest extends \PHPUnit\Framework\TestCase
|
|||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox A list with one element returns the list with the element itself
|
||||
*/
|
||||
public function testSmallList() : void
|
||||
{
|
||||
$smallList = [new NumericElement(3)];
|
||||
|
|
@ -47,6 +50,9 @@ class CocktailShakerSortTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertEquals($smallList, $newList);
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox A list ot elements can be sorted in ASC order
|
||||
*/
|
||||
public function testSortASC() : void
|
||||
{
|
||||
$newList = CocktailShakerSort::sort($this->list);
|
||||
|
|
@ -59,6 +65,9 @@ class CocktailShakerSortTest extends \PHPUnit\Framework\TestCase
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox A list ot elements can be sorted in DESC order
|
||||
*/
|
||||
public function testSortDESC() : void
|
||||
{
|
||||
$newList = CocktailShakerSort::sort($this->list, SortOrder::DESC);
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ use phpOMS\Algorithm\Sort\SortOrder;
|
|||
require_once __DIR__ . '/../../Autoloader.php';
|
||||
|
||||
/**
|
||||
* @testdox phpOMS\tests\Algorithm\Sort: Comb sort test
|
||||
* @testdox phpOMS\tests\Algorithm\Sort\CombSortTest: Comb sort
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
|
|
@ -39,6 +39,9 @@ class CombSortTest extends \PHPUnit\Framework\TestCase
|
|||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox A list with one element returns the list with the element itself
|
||||
*/
|
||||
public function testSmallList() : void
|
||||
{
|
||||
$smallList = [new NumericElement(3)];
|
||||
|
|
@ -47,6 +50,9 @@ class CombSortTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertEquals($smallList, $newList);
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox A list ot elements can be sorted in ASC order
|
||||
*/
|
||||
public function testSortASC() : void
|
||||
{
|
||||
$newList = CombSort::sort($this->list);
|
||||
|
|
@ -59,6 +65,9 @@ class CombSortTest extends \PHPUnit\Framework\TestCase
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox A list ot elements can be sorted in DESC order
|
||||
*/
|
||||
public function testSortDESC() : void
|
||||
{
|
||||
$newList = CombSort::sort($this->list, SortOrder::DESC);
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ use phpOMS\Algorithm\Sort\SortOrder;
|
|||
require_once __DIR__ . '/../../Autoloader.php';
|
||||
|
||||
/**
|
||||
* @testdox phpOMS\tests\Algorithm\Sort: Cycle sort test
|
||||
* @testdox phpOMS\tests\Algorithm\Sort\CycleSortTest: Cycle sort
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
|
|
@ -39,6 +39,9 @@ class CycleSortTest extends \PHPUnit\Framework\TestCase
|
|||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox A list with one element returns the list with the element itself
|
||||
*/
|
||||
public function testSmallList() : void
|
||||
{
|
||||
$smallList = [new NumericElement(3)];
|
||||
|
|
@ -47,6 +50,9 @@ class CycleSortTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertEquals($smallList, $newList);
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox A list ot elements can be sorted in ASC order
|
||||
*/
|
||||
public function testSortASC() : void
|
||||
{
|
||||
$newList = CycleSort::sort($this->list);
|
||||
|
|
@ -59,6 +65,9 @@ class CycleSortTest extends \PHPUnit\Framework\TestCase
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox A list ot elements can be sorted in DESC order
|
||||
*/
|
||||
public function testSortDESC() : void
|
||||
{
|
||||
$newList = CycleSort::sort($this->list, SortOrder::DESC);
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ use phpOMS\Algorithm\Sort\SortOrder;
|
|||
require_once __DIR__ . '/../../Autoloader.php';
|
||||
|
||||
/**
|
||||
* @testdox phpOMS\tests\Algorithm\Sort: Gnome sort test
|
||||
* @testdox phpOMS\tests\Algorithm\Sort\GnomeSortTest: Gnome sort
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
|
|
@ -39,6 +39,9 @@ class GnomeSortTest extends \PHPUnit\Framework\TestCase
|
|||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox A list with one element returns the list with the element itself
|
||||
*/
|
||||
public function testSmallList() : void
|
||||
{
|
||||
$smallList = [new NumericElement(3)];
|
||||
|
|
@ -47,6 +50,9 @@ class GnomeSortTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertEquals($smallList, $newList);
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox A list ot elements can be sorted in ASC order
|
||||
*/
|
||||
public function testSortASC() : void
|
||||
{
|
||||
$newList = GnomeSort::sort($this->list);
|
||||
|
|
@ -59,6 +65,9 @@ class GnomeSortTest extends \PHPUnit\Framework\TestCase
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox A list ot elements can be sorted in DESC order
|
||||
*/
|
||||
public function testSortDESC() : void
|
||||
{
|
||||
$newList = GnomeSort::sort($this->list, SortOrder::DESC);
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ use phpOMS\Algorithm\Sort\SortOrder;
|
|||
require_once __DIR__ . '/../../Autoloader.php';
|
||||
|
||||
/**
|
||||
* @testdox phpOMS\tests\Algorithm\Sort: Heap sort test
|
||||
* @testdox phpOMS\tests\Algorithm\Sort\HeapSortTest: Heap sort
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
|
|
@ -39,6 +39,9 @@ class HeapSortTest extends \PHPUnit\Framework\TestCase
|
|||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox A list with one element returns the list with the element itself
|
||||
*/
|
||||
public function testSmallList() : void
|
||||
{
|
||||
$smallList = [new NumericElement(3)];
|
||||
|
|
@ -47,6 +50,9 @@ class HeapSortTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertEquals($smallList, $newList);
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox A list ot elements can be sorted in ASC order
|
||||
*/
|
||||
public function testSortASC() : void
|
||||
{
|
||||
$newList = HeapSort::sort($this->list);
|
||||
|
|
@ -59,6 +65,9 @@ class HeapSortTest extends \PHPUnit\Framework\TestCase
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox A list ot elements can be sorted in DESC order
|
||||
*/
|
||||
public function testSortDESC() : void
|
||||
{
|
||||
$newList = HeapSort::sort($this->list, SortOrder::DESC);
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ use phpOMS\Algorithm\Sort\SortOrder;
|
|||
require_once __DIR__ . '/../../Autoloader.php';
|
||||
|
||||
/**
|
||||
* @testdox phpOMS\tests\Algorithm\Sort: Insertion sort test
|
||||
* @testdox phpOMS\tests\Algorithm\Sort\InsertionSortTest: Insertion sort
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
|
|
@ -39,6 +39,9 @@ class InsertionSortTest extends \PHPUnit\Framework\TestCase
|
|||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox A list with one element returns the list with the element itself
|
||||
*/
|
||||
public function testSmallList() : void
|
||||
{
|
||||
$smallList = [new NumericElement(3)];
|
||||
|
|
@ -47,6 +50,9 @@ class InsertionSortTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertEquals($smallList, $newList);
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox A list ot elements can be sorted in ASC order
|
||||
*/
|
||||
public function testSortASC() : void
|
||||
{
|
||||
$newList = InsertionSort::sort($this->list);
|
||||
|
|
@ -59,6 +65,9 @@ class InsertionSortTest extends \PHPUnit\Framework\TestCase
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox A list ot elements can be sorted in DESC order
|
||||
*/
|
||||
public function testSortDESC() : void
|
||||
{
|
||||
$newList = InsertionSort::sort($this->list, SortOrder::DESC);
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ use phpOMS\Algorithm\Sort\SortOrder;
|
|||
require_once __DIR__ . '/../../Autoloader.php';
|
||||
|
||||
/**
|
||||
* @testdox phpOMS\tests\Algorithm\Sort: Intro sort test
|
||||
* @testdox phpOMS\tests\Algorithm\Sort\IntroSortTest: Intro sort
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
|
|
@ -39,6 +39,9 @@ class IntroSortTest extends \PHPUnit\Framework\TestCase
|
|||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox A list with one element returns the list with the element itself
|
||||
*/
|
||||
public function testSmallList() : void
|
||||
{
|
||||
$smallList = [new NumericElement(3)];
|
||||
|
|
@ -47,6 +50,9 @@ class IntroSortTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertEquals($smallList, $newList);
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox A list ot elements can be sorted in ASC order
|
||||
*/
|
||||
public function testSortASC() : void
|
||||
{
|
||||
$newList = IntroSort::sort($this->list);
|
||||
|
|
@ -59,6 +65,9 @@ class IntroSortTest extends \PHPUnit\Framework\TestCase
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox A list ot elements can be sorted in DESC order
|
||||
*/
|
||||
public function testSortDESC() : void
|
||||
{
|
||||
$newList = IntroSort::sort($this->list, SortOrder::DESC);
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ use phpOMS\Algorithm\Sort\SortOrder;
|
|||
require_once __DIR__ . '/../../Autoloader.php';
|
||||
|
||||
/**
|
||||
* @testdox phpOMS\tests\Algorithm\Sort: Merge sort test
|
||||
* @testdox phpOMS\tests\Algorithm\Sort\MergeSortTest: Merge sort
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
|
|
@ -39,6 +39,9 @@ class MergeSortTest extends \PHPUnit\Framework\TestCase
|
|||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox A list with one element returns the list with the element itself
|
||||
*/
|
||||
public function testSmallList() : void
|
||||
{
|
||||
$smallList = [new NumericElement(3)];
|
||||
|
|
@ -47,6 +50,9 @@ class MergeSortTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertEquals($smallList, $newList);
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox A list ot elements can be sorted in ASC order
|
||||
*/
|
||||
public function testSortASC() : void
|
||||
{
|
||||
$newList = MergeSort::sort($this->list);
|
||||
|
|
@ -59,6 +65,9 @@ class MergeSortTest extends \PHPUnit\Framework\TestCase
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox A list ot elements can be sorted in DESC order
|
||||
*/
|
||||
public function testSortDESC() : void
|
||||
{
|
||||
$newList = MergeSort::sort($this->list, SortOrder::DESC);
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ use phpOMS\Algorithm\Sort\SortOrder;
|
|||
require_once __DIR__ . '/../../Autoloader.php';
|
||||
|
||||
/**
|
||||
* @testdox phpOMS\tests\Algorithm\Sort: OddEven sort test
|
||||
* @testdox phpOMS\tests\Algorithm\Sort\OddEvenSortTest: OddEven sort
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
|
|
@ -39,6 +39,9 @@ class OddEvenSortTest extends \PHPUnit\Framework\TestCase
|
|||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox A list with one element returns the list with the element itself
|
||||
*/
|
||||
public function testSmallList() : void
|
||||
{
|
||||
$smallList = [new NumericElement(3)];
|
||||
|
|
@ -47,6 +50,9 @@ class OddEvenSortTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertEquals($smallList, $newList);
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox A list ot elements can be sorted in ASC order
|
||||
*/
|
||||
public function testSortASC() : void
|
||||
{
|
||||
$newList = OddEvenSort::sort($this->list);
|
||||
|
|
@ -59,6 +65,9 @@ class OddEvenSortTest extends \PHPUnit\Framework\TestCase
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox A list ot elements can be sorted in DESC order
|
||||
*/
|
||||
public function testSortDESC() : void
|
||||
{
|
||||
$newList = OddEvenSort::sort($this->list, SortOrder::DESC);
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ use phpOMS\Algorithm\Sort\SortOrder;
|
|||
require_once __DIR__ . '/../../Autoloader.php';
|
||||
|
||||
/**
|
||||
* @testdox phpOMS\tests\Algorithm\Sort: Pancake sort test
|
||||
* @testdox phpOMS\tests\Algorithm\Sort\PancakeSortTest: Pancake sort
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
|
|
@ -39,6 +39,9 @@ class PancakeSortTest extends \PHPUnit\Framework\TestCase
|
|||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox A list with one element returns the list with the element itself
|
||||
*/
|
||||
public function testSmallList() : void
|
||||
{
|
||||
$smallList = [new NumericElement(3)];
|
||||
|
|
@ -47,6 +50,9 @@ class PancakeSortTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertEquals($smallList, $newList);
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox A list ot elements can be sorted in ASC order
|
||||
*/
|
||||
public function testSortASC() : void
|
||||
{
|
||||
$newList = PancakeSort::sort($this->list);
|
||||
|
|
@ -59,6 +65,9 @@ class PancakeSortTest extends \PHPUnit\Framework\TestCase
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox A list ot elements can be sorted in DESC order
|
||||
*/
|
||||
public function testSortDESC() : void
|
||||
{
|
||||
$newList = PancakeSort::sort($this->list, SortOrder::DESC);
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ use phpOMS\Algorithm\Sort\SortOrder;
|
|||
require_once __DIR__ . '/../../Autoloader.php';
|
||||
|
||||
/**
|
||||
* @testdox phpOMS\tests\Algorithm\Sort: Quick sort test
|
||||
* @testdox phpOMS\tests\Algorithm\Sort\QuickSortTest: Quick sort
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
|
|
@ -39,6 +39,9 @@ class QuickSortTest extends \PHPUnit\Framework\TestCase
|
|||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox A list with one element returns the list with the element itself
|
||||
*/
|
||||
public function testSmallList() : void
|
||||
{
|
||||
$smallList = [new NumericElement(3)];
|
||||
|
|
@ -47,6 +50,9 @@ class QuickSortTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertEquals($smallList, $newList);
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox A list ot elements can be sorted in ASC order
|
||||
*/
|
||||
public function testSortASC() : void
|
||||
{
|
||||
$newList = QuickSort::sort($this->list);
|
||||
|
|
@ -59,6 +65,9 @@ class QuickSortTest extends \PHPUnit\Framework\TestCase
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox A list ot elements can be sorted in DESC order
|
||||
*/
|
||||
public function testSortDESC() : void
|
||||
{
|
||||
$newList = QuickSort::sort($this->list, SortOrder::DESC);
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ use phpOMS\Algorithm\Sort\SortOrder;
|
|||
require_once __DIR__ . '/../../Autoloader.php';
|
||||
|
||||
/**
|
||||
* @testdox phpOMS\tests\Algorithm\Sort: Selection sort test
|
||||
* @testdox phpOMS\tests\Algorithm\Sort\SelectionSortTest: Selection sort
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
|
|
@ -39,6 +39,9 @@ class SelectionSortTest extends \PHPUnit\Framework\TestCase
|
|||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox A list with one element returns the list with the element itself
|
||||
*/
|
||||
public function testSmallList() : void
|
||||
{
|
||||
$smallList = [new NumericElement(3)];
|
||||
|
|
@ -47,6 +50,9 @@ class SelectionSortTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertEquals($smallList, $newList);
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox A list ot elements can be sorted in ASC order
|
||||
*/
|
||||
public function testSortASC() : void
|
||||
{
|
||||
$newList = SelectionSort::sort($this->list);
|
||||
|
|
@ -59,6 +65,9 @@ class SelectionSortTest extends \PHPUnit\Framework\TestCase
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox A list ot elements can be sorted in DESC order
|
||||
*/
|
||||
public function testSortDESC() : void
|
||||
{
|
||||
$newList = SelectionSort::sort($this->list, SortOrder::DESC);
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ use phpOMS\Algorithm\Sort\SortOrder;
|
|||
require_once __DIR__ . '/../../Autoloader.php';
|
||||
|
||||
/**
|
||||
* @testdox phpOMS\tests\Algorithm\Sort: Shell sort test
|
||||
* @testdox phpOMS\tests\Algorithm\Sort\ShellSortTest: Shell sort
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
|
|
@ -39,6 +39,9 @@ class ShellSortTest extends \PHPUnit\Framework\TestCase
|
|||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox A list with one element returns the list with the element itself
|
||||
*/
|
||||
public function testSmallList() : void
|
||||
{
|
||||
$smallList = [new NumericElement(3)];
|
||||
|
|
@ -47,6 +50,9 @@ class ShellSortTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertEquals($smallList, $newList);
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox A list ot elements can be sorted in ASC order
|
||||
*/
|
||||
public function testSortASC() : void
|
||||
{
|
||||
$newList = ShellSort::sort($this->list);
|
||||
|
|
@ -59,6 +65,9 @@ class ShellSortTest extends \PHPUnit\Framework\TestCase
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox A list ot elements can be sorted in DESC order
|
||||
*/
|
||||
public function testSortDESC() : void
|
||||
{
|
||||
$newList = ShellSort::sort($this->list, SortOrder::DESC);
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ use phpOMS\Algorithm\Sort\SortOrder;
|
|||
require_once __DIR__ . '/../../Autoloader.php';
|
||||
|
||||
/**
|
||||
* @testdox phpOMS\tests\Algorithm\Sort: Stooge sort test
|
||||
* @testdox phpOMS\tests\Algorithm\Sort\StoogeSortTest: Stooge sort
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
|
|
@ -39,6 +39,9 @@ class StoogeSortTest extends \PHPUnit\Framework\TestCase
|
|||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox A list with one element returns the list with the element itself
|
||||
*/
|
||||
public function testSmallList() : void
|
||||
{
|
||||
$smallList = [new NumericElement(3)];
|
||||
|
|
@ -47,6 +50,9 @@ class StoogeSortTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertEquals($smallList, $newList);
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox A list ot elements can be sorted in ASC order
|
||||
*/
|
||||
public function testSortASC() : void
|
||||
{
|
||||
$newList = StoogeSort::sort($this->list);
|
||||
|
|
@ -59,6 +65,9 @@ class StoogeSortTest extends \PHPUnit\Framework\TestCase
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox A list ot elements can be sorted in DESC order
|
||||
*/
|
||||
public function testSortDESC() : void
|
||||
{
|
||||
$newList = StoogeSort::sort($this->list, SortOrder::DESC);
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ use phpOMS\Algorithm\Sort\SortOrder;
|
|||
require_once __DIR__ . '/../../Autoloader.php';
|
||||
|
||||
/**
|
||||
* @testdox phpOMS\tests\Algorithm\Sort: Tim sort test
|
||||
* @testdox phpOMS\tests\Algorithm\Sort\TimSortTest: Tim sort
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
|
|
@ -39,6 +39,9 @@ class TimSortTest extends \PHPUnit\Framework\TestCase
|
|||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox A list with one element returns the list with the element itself
|
||||
*/
|
||||
public function testSmallList() : void
|
||||
{
|
||||
$smallList = [new NumericElement(3)];
|
||||
|
|
@ -47,6 +50,9 @@ class TimSortTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertEquals($smallList, $newList);
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox A list ot elements can be sorted in ASC order
|
||||
*/
|
||||
public function testSortASC() : void
|
||||
{
|
||||
$newList = TimSort::sort($this->list);
|
||||
|
|
@ -59,6 +65,9 @@ class TimSortTest extends \PHPUnit\Framework\TestCase
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox A list ot elements can be sorted in DESC order
|
||||
*/
|
||||
public function testSortDESC() : void
|
||||
{
|
||||
$newList = TimSort::sort($this->list, SortOrder::DESC);
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ namespace phpOMS\tests\Business\Finance;
|
|||
use phpOMS\Business\Finance\Depreciation;
|
||||
|
||||
/**
|
||||
* @testdox phpOMS\Business\Finance\DepreciationTest: Depreciation calculations
|
||||
* @testdox phpOMS\tests\Business\Finance\DepreciationTest: Depreciation calculations
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ namespace phpOMS\tests\Business\Finance;
|
|||
use phpOMS\Business\Finance\FinanceFormulas;
|
||||
|
||||
/**
|
||||
* @testdox phpOMS\Business\Finance\FinanceFormulasTest: Finance formulas
|
||||
* @testdox phpOMS\tests\Business\Finance\FinanceFormulasTest: Finance formulas
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
|
|
@ -229,20 +229,33 @@ class FinanceFormulasTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertEquals(500 / 1000, FinanceFormulas::getDebtToIncomeRatio(500, 1000));
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox Return on balance statement positions are correct (e.g. return on assets, on equity)
|
||||
*/
|
||||
public function testReturnOnBalancePositions() : void
|
||||
{
|
||||
self::assertEquals(500 / 1000, FinanceFormulas::getReturnOnAssets(500, 1000));
|
||||
self::assertEquals(500 / 1000, FinanceFormulas::getReturnOnEquity(500, 1000));
|
||||
self::assertEquals(500 / 1000 - 1, FinanceFormulas::getReturnOnInvestment(500, 1000));
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox Balance / P&L ratios are correct (e.g. inventory turnover, net profit margin)
|
||||
*/
|
||||
public function testBalancePLRatios() : void
|
||||
{
|
||||
self::assertEquals(500 / 1000, FinanceFormulas::getInventoryTurnoverRatio(500, 1000));
|
||||
self::assertEquals(500 / 1000, FinanceFormulas::getNetProfitMargin(500, 1000));
|
||||
self::assertEquals(500 / 1000, FinanceFormulas::getReceivablesTurnoverRatio(500, 1000));
|
||||
}
|
||||
|
||||
public function testRatios() : void
|
||||
{
|
||||
self::assertEquals(500 / 1000, FinanceFormulas::getInterestCoverageRatio(500, 1000));
|
||||
self::assertEquals(500 / 1000, FinanceFormulas::getInventoryTurnoverRatio(500, 1000));
|
||||
self::assertEquals(500 / 1000, FinanceFormulas::getNetProfitMargin(500, 1000));
|
||||
|
||||
self::assertEquals(500 / 1000, FinanceFormulas::getReturnOnAssets(500, 1000));
|
||||
self::assertEquals(500 / 1000, FinanceFormulas::getReturnOnEquity(500, 1000));
|
||||
self::assertEquals(500 / 1000, FinanceFormulas::getReceivablesTurnoverRatio(500, 1000));
|
||||
self::assertEquals(500 / 1000, FinanceFormulas::getQuickRatio(500, 1000));
|
||||
|
||||
self::assertEquals(500 / 1000 - 1, FinanceFormulas::getReturnOnInvestment(500, 1000));
|
||||
self::assertEquals((500 - 300) / 500, FinanceFormulas::getRetentionRatio(500, 300));
|
||||
self::assertEquals(500 / 1000 - 1, FinanceFormulas::getRateOfOnflation(500, 1000));
|
||||
self::assertEquals(500 / 1000 - 1, FinanceFormulas::getRateOfInflation(500, 1000));
|
||||
|
||||
self::assertEquals(1000 / 500, FinanceFormulas::getPaybackPeriod(1000, 500));
|
||||
self::assertEquals(100 / 0.15, FinanceFormulas::getPresentValueOfPerpetuity(100, 0.15));
|
||||
|
|
@ -336,6 +349,9 @@ class FinanceFormulasTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertEqualsWithDelta($r, FinanceFormulas::getDoublingContinuousCompoundingRate(13.863), 0.01);
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox Calculations for equivalent annual annuity are correct
|
||||
*/
|
||||
public function testEquivalentAnnualAnnuity() : void
|
||||
{
|
||||
$npv = 1000;
|
||||
|
|
@ -347,6 +363,9 @@ 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)
|
||||
*/
|
||||
public function testFreeCashFlowToEquity() : void
|
||||
{
|
||||
$income = 1000;
|
||||
|
|
@ -358,6 +377,9 @@ 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)
|
||||
*/
|
||||
public function testFreeCashFlowToFirm() : void
|
||||
{
|
||||
$ebit = 1000;
|
||||
|
|
@ -369,6 +391,9 @@ 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
|
||||
*/
|
||||
public function testFutureValue() : void
|
||||
{
|
||||
$c = 1000;
|
||||
|
|
@ -378,6 +403,9 @@ 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
|
||||
*/
|
||||
public function testFutureValueContinuousCompounding() : void
|
||||
{
|
||||
$pv = 1000;
|
||||
|
|
@ -387,6 +415,9 @@ 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
|
||||
*/
|
||||
public function testValueFactor() : void
|
||||
{
|
||||
$r = 0.15;
|
||||
|
|
@ -396,6 +427,9 @@ 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
|
||||
*/
|
||||
public function testGeometricMeanReturn() : void
|
||||
{
|
||||
$r = [0.01, 0.02, 0.03, 0.04, 0.05, 0.06, 0.07];
|
||||
|
|
|
|||
|
|
@ -17,16 +17,31 @@ namespace phpOMS\tests\Business\Finance;
|
|||
use phpOMS\Business\Finance\Loan;
|
||||
|
||||
/**
|
||||
* @testdox phpOMS\tests\Business\Finance\LoanTest: Loan formulas
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
class LoanTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
public function testRatios() : void
|
||||
/**
|
||||
* @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
|
||||
*/
|
||||
public function testLoanToValueRatio() : void
|
||||
{
|
||||
self::assertEquals(100 / 50, Loan::getLoanToValueRatio(100, 50));
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox The balloon loan payments are correct for a given balloon
|
||||
*/
|
||||
public function testPaymentsOnBalloonLoan() : void
|
||||
{
|
||||
$pv = 1000;
|
||||
|
|
@ -37,6 +52,9 @@ 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
|
||||
*/
|
||||
public function testBalloonBalanceOfLoan() : void
|
||||
{
|
||||
$pv = 1000;
|
||||
|
|
@ -47,6 +65,9 @@ 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]
|
||||
*/
|
||||
public function testLoanPayment() : void
|
||||
{
|
||||
$pv = 1000;
|
||||
|
|
@ -56,6 +77,9 @@ 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]
|
||||
*/
|
||||
public function testRemainingBalanceLoan() : void
|
||||
{
|
||||
$pv = 1000;
|
||||
|
|
|
|||
|
|
@ -17,14 +17,19 @@ namespace phpOMS\tests\Business\Finance;
|
|||
use phpOMS\Business\Finance\Lorenzkurve;
|
||||
|
||||
/**
|
||||
* @testdox phpOMS\tests\Business\Finance\LorenzkurveTest: Lorenz kurve
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
class LorenzkurveTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
public function testLorenz() : void
|
||||
/**
|
||||
* @testdox The gini coefficient calculation is correct
|
||||
*/
|
||||
public function testGiniCoefficient() : void
|
||||
{
|
||||
$arr = [1, 1, 1, 1, 1, 1, 1, 10, 33, 50];
|
||||
|
||||
self::assertTrue(\abs(0.71 - LorenzKurve::getGiniCoefficient($arr)) < 0.01);
|
||||
self::assertEqualsWithDelta(0.71, LorenzKurve::getGiniCoefficient($arr), 0.01);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,6 +28,6 @@ class MetricsTest extends \PHPUnit\Framework\TestCase
|
|||
*/
|
||||
public function testCustomerRetention() : void
|
||||
{
|
||||
self::assertTrue(0.85 - Metrics::getCustomerRetention(105, 20, 100) < 0.01);
|
||||
self::assertEqualsWithDelta(0.85, Metrics::getCustomerRetention(105, 20, 100), 0.01);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ use phpOMS\Business\Marketing\NetPromoterScore;
|
|||
class NetPromoterScoreTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
/**
|
||||
* @testdox The default net promoter score is 0
|
||||
* @testdox The net promoter has the expected default values after initialization
|
||||
*/
|
||||
public function testDefault() : void
|
||||
{
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ use phpOMS\Business\Sales\MarketShareEstimation;
|
|||
|
||||
/**
|
||||
* @testdox phpOMS\tests\Business\Sales\MarketShareEstimationTest: Market share calculations
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
class MarketShareEstimationTest extends \PHPUnit\Framework\TestCase
|
||||
|
|
|
|||
|
|
@ -19,12 +19,17 @@ use phpOMS\Config\OptionsTrait;
|
|||
require_once __DIR__ . '/../Autoloader.php';
|
||||
|
||||
/**
|
||||
* @testdox phpOMS\tests\Config\OptionsTrait: Helper for managing otpions
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
class OptionsTraitTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
|
||||
public function testOptionTrait() : void
|
||||
/**
|
||||
* @testdox The option helper has the expected attributes
|
||||
*/
|
||||
public function testOptionTraitMembers() : void
|
||||
{
|
||||
$class = new class() {
|
||||
use OptionsTrait;
|
||||
|
|
@ -34,6 +39,9 @@ class OptionsTraitTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertObjectHasAttribute('options', $class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox The option helper has the expected default values after initialization
|
||||
*/
|
||||
public function testDefault() : void
|
||||
{
|
||||
$class = new class() {
|
||||
|
|
@ -44,7 +52,24 @@ class OptionsTraitTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertNull($class->getOption('someKey'));
|
||||
}
|
||||
|
||||
public function testSetGet() : void
|
||||
/**
|
||||
* @testdox Options can be added to the helper
|
||||
*/
|
||||
public function testAdd() : void
|
||||
{
|
||||
$class = new class() {
|
||||
use OptionsTrait;
|
||||
};
|
||||
|
||||
self::assertTrue($class->setOption('a', 'value1'));
|
||||
self::assertTrue($class->exists('a'));
|
||||
self::assertEquals('value1', $class->getOption('a'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox Options can be overwritten/changed
|
||||
*/
|
||||
public function testOverwrite() : void
|
||||
{
|
||||
$class = new class() {
|
||||
use OptionsTrait;
|
||||
|
|
@ -65,12 +90,27 @@ class OptionsTraitTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertFalse($class->setOption('a', 'value4', false));
|
||||
self::assertTrue($class->exists('a'));
|
||||
self::assertEquals('value3', $class->getOption('a'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox Multiple options can be added to the helper in one go
|
||||
*/
|
||||
public function testAddMultiple() : void
|
||||
{
|
||||
$class = new class() {
|
||||
use OptionsTrait;
|
||||
};
|
||||
|
||||
self::assertTrue($class->setOption('a', 'value3', true));
|
||||
self::assertTrue($class->exists('a'));
|
||||
self::assertEquals('value3', $class->getOption('a'));
|
||||
|
||||
self::assertTrue($class->setOptions(['b' => 2, 'c' => '3'], true));
|
||||
self::assertTrue($class->setOptions(['b' => 4, 'c' => '5'], false)); // always returns true
|
||||
self::assertTrue($class->exists('a'));
|
||||
self::assertTrue($class->exists('b'));
|
||||
self::assertTrue($class->exists('c'));
|
||||
|
||||
self::assertEquals('value3', $class->getOption('a'));
|
||||
self::assertEquals(2, $class->getOption('b'));
|
||||
self::assertEquals(3, $class->getOption('c'));
|
||||
|
|
|
|||
|
|
@ -18,10 +18,15 @@ use phpOMS\DataStorage\Cache\CachePool;
|
|||
use phpOMS\DataStorage\Cache\Connection\FileCache;
|
||||
|
||||
/**
|
||||
* @testdox phpOMS\tests\DataStorage\Cache\CachePoolTest: Pool for caches
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
class CachePoolTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
/**
|
||||
* @testdox The pool has the expected default values after initialization
|
||||
*/
|
||||
public function testDefault() : void
|
||||
{
|
||||
$pool = new CachePool();
|
||||
|
|
@ -30,20 +35,84 @@ class CachePoolTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertInstanceOf('\phpOMS\DataStorage\Cache\Connection\NullCache', $pool->get());
|
||||
}
|
||||
|
||||
public function testGetSet() : void
|
||||
/**
|
||||
* @testdox New cache connections can be added to the pool
|
||||
*/
|
||||
public function testAdd() : void
|
||||
{
|
||||
$pool = new CachePool();
|
||||
|
||||
self::assertTrue($pool->add('test', new FileCache(__DIR__)));
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox Cache connections cannot be overwritten with a different cache connection
|
||||
*/
|
||||
public function testOverwrite() : void
|
||||
{
|
||||
$pool = new CachePool();
|
||||
|
||||
self::assertTrue($pool->add('test', new FileCache(__DIR__)));
|
||||
self::assertFalse($pool->add('test', new FileCache(__DIR__)));
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox Cache connections can be accessed with an identifier
|
||||
*/
|
||||
public function testGet() : void
|
||||
{
|
||||
$pool = new CachePool();
|
||||
|
||||
self::assertTrue($pool->add('test', new FileCache(__DIR__)));
|
||||
self::assertInstanceOf('\phpOMS\DataStorage\Cache\Connection\ConnectionInterface', $pool->get('test'));
|
||||
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
|
||||
*/
|
||||
public function testGetDefault() : void
|
||||
{
|
||||
$pool = new CachePool();
|
||||
|
||||
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
|
||||
*/
|
||||
public function testCreate() : void
|
||||
{
|
||||
$pool = new CachePool();
|
||||
|
||||
self::assertTrue($pool->create('abc', ['type' => 'file', 'path' => __DIR__]));
|
||||
self::assertFalse($pool->create('abc', ['type' => 'file', 'path' => __DIR__]));
|
||||
self::assertInstanceOf('\phpOMS\DataStorage\Cache\Connection\ConnectionInterface', $pool->get('abc'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox Cache connections can be removed from the pool
|
||||
*/
|
||||
public function testRemove() : void
|
||||
{
|
||||
$pool = new CachePool();
|
||||
|
||||
self::assertTrue($pool->add('test', new FileCache(__DIR__)));
|
||||
self::assertTrue($pool->create('abc', ['type' => 'file', 'path' => __DIR__]));
|
||||
self::assertTrue($pool->remove('abc'));
|
||||
self::assertInstanceOf('\phpOMS\DataStorage\Cache\Connection\NullCache', $pool->get('abc'));
|
||||
self::assertInstanceOf('\phpOMS\DataStorage\Cache\Connection\ConnectionInterface', $pool->get('test'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox Removing a cache with an invalid identifier will result in no actions
|
||||
*/
|
||||
public function testRemoveInvalid() : void
|
||||
{
|
||||
$pool = new CachePool();
|
||||
|
||||
self::assertTrue($pool->add('test', new FileCache(__DIR__)));
|
||||
self::assertFalse($pool->remove('abc'));
|
||||
self::assertInstanceOf('\phpOMS\DataStorage\Cache\Connection\ConnectionInterface', $pool->get('test'));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,10 +18,15 @@ use phpOMS\DataStorage\Cache\CacheType;
|
|||
use phpOMS\DataStorage\Cache\Connection\ConnectionFactory;
|
||||
|
||||
/**
|
||||
* @testdox phpOMS\tests\DataStorage\Cache\Connection\ConnectionFactoryTest: Factory for generating cache connections
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
class ConnectionFactoryTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
/**
|
||||
* @testdox The file cache can be created
|
||||
*/
|
||||
public function testCreateFileCache() : void
|
||||
{
|
||||
self::assertInstanceOf(
|
||||
|
|
@ -30,6 +35,9 @@ class ConnectionFactoryTest extends \PHPUnit\Framework\TestCase
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox The memcached cache can be created
|
||||
*/
|
||||
public function testCreateMemCached() : void
|
||||
{
|
||||
if (!\extension_loaded('memcached')) {
|
||||
|
|
@ -44,6 +52,9 @@ class ConnectionFactoryTest extends \PHPUnit\Framework\TestCase
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox The redis cache can be created
|
||||
*/
|
||||
public function testCreateRedisCache() : void
|
||||
{
|
||||
if (!\extension_loaded('redis')) {
|
||||
|
|
@ -58,6 +69,9 @@ class ConnectionFactoryTest extends \PHPUnit\Framework\TestCase
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox An invalid cache type results in an exception
|
||||
*/
|
||||
public function testInvalidCacheType() : void
|
||||
{
|
||||
self::expectException(\InvalidArgumentException::class);
|
||||
|
|
|
|||
|
|
@ -20,10 +20,15 @@ use phpOMS\DataStorage\Cache\Connection\FileCache;
|
|||
use phpOMS\Utils\TestUtils;
|
||||
|
||||
/**
|
||||
* @testdox phpOMS\tests\DataStorage\Cache\Connection\FileCacheTest: File cache connection
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
class FileCacheTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
/**
|
||||
* @testdox The file cache connection has the expected default values after initialization
|
||||
*/
|
||||
public function testDefault() : void
|
||||
{
|
||||
if (\file_exists(__DIR__ . '/Cache')) {
|
||||
|
|
@ -44,6 +49,9 @@ class FileCacheTest extends \PHPUnit\Framework\TestCase
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox The connection to a dedicated cache directory can be established (none-exising directories get created)
|
||||
*/
|
||||
public function testConnect() : void
|
||||
{
|
||||
if (\file_exists(__DIR__ . '/Cache')) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user