19 declare(strict_types=1);
    21 require_once(
'./vendor/composer/vendor/autoload.php');
    28     protected Data\Factory 
$f;
    30     protected function setUp(): void
    32         $this->f = 
new Data\Factory();
    37         $c_dimension = $this->f->dimension()->cardinal();
    38         $dimensions = [
"A dimension" => $c_dimension, 
"Another dimension" => $c_dimension];
    45         $group = $this->f->dimension()->group(
"A dimension", 
"Another dimension");
    46         $groups = [
"A group" => $group, 
"Another group" => $group];
    53         $c_dimension = $this->f->dimension()->cardinal();
    54         $r_dimension = $this->f->dimension()->range($c_dimension);
    56             "First dimension" => $c_dimension,
    57             "Second dimension" => $c_dimension,
    58             "Third dimension" => $r_dimension
    68             $dataset = $this->f->dataset($dimensions);
    69             $this->assertEquals($dimensions, $dataset->getDimensions());
    71             $this->assertFalse(
"This should not happen.");
    78             $dimension = 
"Dimension";
    79             $dataset = $this->f->dataset([
"A dimension" => $dimension]);
    80             $this->assertFalse(
"This should not happen.");
    82             $this->assertTrue(
true);
    89             $dimension = $this->f->dimension()->cardinal();
    90             $dataset = $this->f->dataset([1 => $dimension]);
    91             $this->assertFalse(
"This should not happen.");
    93             $this->assertTrue(
true);
   100         $points = [
"A dimension" => 1, 
"Another dimension" => 2];
   101         $dataset = $dataset->withPoint(
   105         $this->assertEquals([
"Item" => $points], $dataset->getPoints());
   112             $points = [
"A dimension" => 1, 
"Second dimension" => 2];
   113             $dataset = $dataset->withPoint(
   117             $this->assertFalse(
"This should not happen.");
   118         } 
catch (\ArgumentCountError 
$e) {
   119             $this->assertTrue(
true);
   126         $info = [
"A dimension" => 
"An information", 
"Another dimension" => null];
   127         $dataset = $dataset->withAlternativeInformation(
   131         $this->assertEquals([
"Item" => $info], $dataset->getAlternativeInformation());
   138             $info = [
"A dimension" => 
"An information", 
"Second dimension" => null];
   139             $dataset = $dataset->withAlternativeInformation(
   143             $this->assertFalse(
"This should not happen.");
   144         } 
catch (\ArgumentCountError 
$e) {
   145             $this->assertTrue(
true);
   153             $info = [
"A dimension" => 
"An information", 
"Another dimension" => 1];
   154             $dataset = $dataset->withAlternativeInformation(
   158             $this->assertFalse(
"This should not happen.");
   160             $this->assertTrue(
true);
   167         $points = [
"A dimension" => 1, 
"Another dimension" => 2];
   168         $info = [
"A dimension" => 
"An information", 
"Another dimension" => null];
   169         $dataset = $dataset->withPoint(
   173         $dataset = $dataset->withAlternativeInformation(
   178         $this->assertEquals(
false, $dataset->isEmpty());
   180         $dataset = $dataset->withResetDataset();
   182         $this->assertEquals(
true, $dataset->isEmpty());
   183         $this->assertEquals([], $dataset->getPoints());
   184         $this->assertEquals([], $dataset->getAlternativeInformation());
   190         $points1 = [
"First dimension" => 0, 
"Second dimension" => 0.5, 
"Third dimension" => [0, 1]];
   191         $points2 = [
"First dimension" => -3, 
"Second dimension" => 5, 
"Third dimension" => [-4, -1.5]];
   192         $points3 = [
"First dimension" => -2, 
"Second dimension" => 5, 
"Third dimension" => [-3, -1.5]];
   193         $dataset = $dataset->withPoint(
   197         $dataset = $dataset->withPoint(
   201         $dataset = $dataset->withPoint(
   205         $this->assertEquals(-2, $dataset->getMinValueForDimension(
"First dimension"));
   206         $this->assertEquals(0.5, $dataset->getMinValueForDimension(
"Second dimension"));
   207         $this->assertEquals(-3, $dataset->getMinValueForDimension(
"Third dimension"));
   213         $points1 = [
"First dimension" => 0, 
"Second dimension" => -0.5, 
"Third dimension" => [0, 1]];
   214         $points2 = [
"First dimension" => -3, 
"Second dimension" => -5, 
"Third dimension" => [-4, 1.5]];
   215         $dataset = $dataset->withPoint(
   219         $dataset = $dataset->withPoint(
   223         $this->assertEquals(0, $dataset->getMaxValueForDimension(
"First dimension"));
   224         $this->assertEquals(-0.5, $dataset->getMaxValueForDimension(
"Second dimension"));
   225         $this->assertEquals(1.5, $dataset->getMaxValueForDimension(
"Third dimension"));
   233             $dataset = $this->f->dataset($dimensions, $groups);
   234             $this->assertEquals($groups, $dataset->getDimensionGroups());
   236             $this->fail(
"This should not happen.");
   245         $this->expectException(\InvalidArgumentException::class);
   246         $dataset = $this->f->dataset($dimensions, [
"A group" => $group]);
   252         $group = $this->f->dimension()->group(
"A dimension");
   254         $this->expectException(\InvalidArgumentException::class);
   255         $dataset = $this->f->dataset($dimensions, [1 => $group]);
 
testInvalidDimensionKey()
 
testwithInvalidAlternativeInformationCount()
 
testDimensionsWithGroups()
 
testwithInvalidAlternativeInformationValue()
 
testInvalidDimensionGroup()
 
testwithInvalidPointsCount()
 
getSimpleDimensionGroups()
 
testwithAlternativeInformation()
 
testInvalidDimensionGroupKey()
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...