ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
DatasetTest Class Reference
+ Inheritance diagram for DatasetTest:
+ Collaboration diagram for DatasetTest:

Public Member Functions

 testDimensions ()
 
 testInvalidDimension ()
 
 testInvalidDimensionKey ()
 
 testwithPoint ()
 
 testwithInvalidPointsCount ()
 
 testwithAlternativeInformation ()
 
 testwithInvalidAlternativeInformationCount ()
 
 testwithInvalidAlternativeInformationValue ()
 
 testwithResetDataset ()
 
 testMinValue ()
 
 testMaxValue ()
 

Protected Member Functions

 setUp ()
 
 getSimpleDimensions ()
 
 getExtendedDimensions ()
 

Protected Attributes

Data Factory $f
 

Detailed Description

Definition at line 29 of file DatasetTest.php.

Member Function Documentation

◆ getExtendedDimensions()

DatasetTest::getExtendedDimensions ( )
protected

Definition at line 46 of file DatasetTest.php.

Referenced by testMaxValue(), and testMinValue().

46  : array
47  {
48  $c_dimension = $this->f->dimension()->cardinal();
49  $r_dimension = $this->f->dimension()->range($c_dimension);
50  $dimensions = [
51  "First dimension" => $c_dimension,
52  "Second dimension" => $c_dimension,
53  "Third dimension" => $r_dimension
54  ];
55 
56  return $dimensions;
57  }
+ Here is the caller graph for this function:

◆ getSimpleDimensions()

DatasetTest::getSimpleDimensions ( )
protected

Definition at line 38 of file DatasetTest.php.

Referenced by testDimensions(), testwithAlternativeInformation(), testwithInvalidAlternativeInformationCount(), testwithInvalidAlternativeInformationValue(), testwithInvalidPointsCount(), testwithPoint(), and testwithResetDataset().

38  : array
39  {
40  $c_dimension = $this->f->dimension()->cardinal();
41  $dimensions = ["A dimension" => $c_dimension, "Another dimension" => $c_dimension];
42 
43  return $dimensions;
44  }
+ Here is the caller graph for this function:

◆ setUp()

DatasetTest::setUp ( )
protected

Definition at line 33 of file DatasetTest.php.

33  : void
34  {
35  $this->f = new Data\Factory();
36  }

◆ testDimensions()

DatasetTest::testDimensions ( )

Definition at line 59 of file DatasetTest.php.

References Vendor\Package\$e, and getSimpleDimensions().

59  : void
60  {
61  try {
62  $dimensions = $this->getSimpleDimensions();
63  $dataset = $this->f->dataset($dimensions);
64  $this->assertEquals($dimensions, $dataset->getDimensions());
65  } catch (\InvalidArgumentException $e) {
66  $this->assertFalse("This should not happen.");
67  }
68  }
getSimpleDimensions()
Definition: DatasetTest.php:38
+ Here is the call graph for this function:

◆ testInvalidDimension()

DatasetTest::testInvalidDimension ( )

Definition at line 70 of file DatasetTest.php.

References Vendor\Package\$e.

70  : void
71  {
72  try {
73  $dimension = "Dimension";
74  $dataset = $this->f->dataset(["A dimension" => $dimension]);
75  $this->assertFalse("This should not happen.");
76  } catch (\InvalidArgumentException $e) {
77  $this->assertTrue(true);
78  }
79  }

◆ testInvalidDimensionKey()

DatasetTest::testInvalidDimensionKey ( )

Definition at line 81 of file DatasetTest.php.

References Vendor\Package\$e.

81  : void
82  {
83  try {
84  $dimension = $this->f->dimension()->cardinal();
85  $dataset = $this->f->dataset([1 => $dimension]);
86  $this->assertFalse("This should not happen.");
87  } catch (\InvalidArgumentException $e) {
88  $this->assertTrue(true);
89  }
90  }

◆ testMaxValue()

DatasetTest::testMaxValue ( )

Definition at line 205 of file DatasetTest.php.

References getExtendedDimensions().

205  : void
206  {
207  $dataset = $this->f->dataset($this->getExtendedDimensions());
208  $points1 = ["First dimension" => 0, "Second dimension" => -0.5, "Third dimension" => [0, 1]];
209  $points2 = ["First dimension" => -3, "Second dimension" => -5, "Third dimension" => [-4, 1.5]];
210  $dataset = $dataset->withPoint(
211  "Item 1",
212  $points1
213  );
214  $dataset = $dataset->withPoint(
215  "Item 2",
216  $points2
217  );
218  $this->assertEquals(0, $dataset->getMaxValueForDimension("First dimension"));
219  $this->assertEquals(-0.5, $dataset->getMaxValueForDimension("Second dimension"));
220  $this->assertEquals(1.5, $dataset->getMaxValueForDimension("Third dimension"));
221  }
getExtendedDimensions()
Definition: DatasetTest.php:46
+ Here is the call graph for this function:

◆ testMinValue()

DatasetTest::testMinValue ( )

Definition at line 182 of file DatasetTest.php.

References getExtendedDimensions().

182  : void
183  {
184  $dataset = $this->f->dataset($this->getExtendedDimensions());
185  $points1 = ["First dimension" => 0, "Second dimension" => 0.5, "Third dimension" => [0, 1]];
186  $points2 = ["First dimension" => -3, "Second dimension" => 5, "Third dimension" => [-4, -1.5]];
187  $points3 = ["First dimension" => -2, "Second dimension" => 5, "Third dimension" => [-3, -1.5]];
188  $dataset = $dataset->withPoint(
189  "Item 1",
190  $points1
191  );
192  $dataset = $dataset->withPoint(
193  "Item 2",
194  $points2
195  );
196  $dataset = $dataset->withPoint(
197  "Item 2",
198  $points3
199  );
200  $this->assertEquals(-2, $dataset->getMinValueForDimension("First dimension"));
201  $this->assertEquals(0.5, $dataset->getMinValueForDimension("Second dimension"));
202  $this->assertEquals(-3, $dataset->getMinValueForDimension("Third dimension"));
203  }
getExtendedDimensions()
Definition: DatasetTest.php:46
+ Here is the call graph for this function:

◆ testwithAlternativeInformation()

DatasetTest::testwithAlternativeInformation ( )

Definition at line 118 of file DatasetTest.php.

References getSimpleDimensions().

118  : void
119  {
120  $dataset = $this->f->dataset($this->getSimpleDimensions());
121  $info = ["A dimension" => "An information", "Another dimension" => null];
122  $dataset = $dataset->withAlternativeInformation(
123  "Item",
124  $info
125  );
126  $this->assertEquals(["Item" => $info], $dataset->getAlternativeInformation());
127  }
getSimpleDimensions()
Definition: DatasetTest.php:38
+ Here is the call graph for this function:

◆ testwithInvalidAlternativeInformationCount()

DatasetTest::testwithInvalidAlternativeInformationCount ( )

Definition at line 129 of file DatasetTest.php.

References Vendor\Package\$e, and getSimpleDimensions().

129  : void
130  {
131  try {
132  $dataset = $this->f->dataset($this->getSimpleDimensions());
133  $info = ["A dimension" => "An information", "Second dimension" => null];
134  $dataset = $dataset->withAlternativeInformation(
135  "Item",
136  $info
137  );
138  $this->assertFalse("This should not happen.");
139  } catch (\ArgumentCountError $e) {
140  $this->assertTrue(true);
141  }
142  }
getSimpleDimensions()
Definition: DatasetTest.php:38
+ Here is the call graph for this function:

◆ testwithInvalidAlternativeInformationValue()

DatasetTest::testwithInvalidAlternativeInformationValue ( )

Definition at line 144 of file DatasetTest.php.

References Vendor\Package\$e, and getSimpleDimensions().

144  : void
145  {
146  try {
147  $dataset = $this->f->dataset($this->getSimpleDimensions());
148  $info = ["A dimension" => "An information", "Another dimension" => 1];
149  $dataset = $dataset->withAlternativeInformation(
150  "Item",
151  $info
152  );
153  $this->assertFalse("This should not happen.");
154  } catch (\InvalidArgumentException $e) {
155  $this->assertTrue(true);
156  }
157  }
getSimpleDimensions()
Definition: DatasetTest.php:38
+ Here is the call graph for this function:

◆ testwithInvalidPointsCount()

DatasetTest::testwithInvalidPointsCount ( )

Definition at line 103 of file DatasetTest.php.

References Vendor\Package\$e, and getSimpleDimensions().

103  : void
104  {
105  try {
106  $dataset = $this->f->dataset($this->getSimpleDimensions());
107  $points = ["A dimension" => 1, "Second dimension" => 2];
108  $dataset = $dataset->withPoint(
109  "Item",
110  $points
111  );
112  $this->assertFalse("This should not happen.");
113  } catch (\ArgumentCountError $e) {
114  $this->assertTrue(true);
115  }
116  }
getSimpleDimensions()
Definition: DatasetTest.php:38
+ Here is the call graph for this function:

◆ testwithPoint()

DatasetTest::testwithPoint ( )

Definition at line 92 of file DatasetTest.php.

References getSimpleDimensions().

92  : void
93  {
94  $dataset = $this->f->dataset($this->getSimpleDimensions());
95  $points = ["A dimension" => 1, "Another dimension" => 2];
96  $dataset = $dataset->withPoint(
97  "Item",
98  $points
99  );
100  $this->assertEquals(["Item" => $points], $dataset->getPoints());
101  }
getSimpleDimensions()
Definition: DatasetTest.php:38
+ Here is the call graph for this function:

◆ testwithResetDataset()

DatasetTest::testwithResetDataset ( )

Definition at line 159 of file DatasetTest.php.

References getSimpleDimensions().

159  : void
160  {
161  $dataset = $this->f->dataset($this->getSimpleDimensions());
162  $points = ["A dimension" => 1, "Another dimension" => 2];
163  $info = ["A dimension" => "An information", "Another dimension" => null];
164  $dataset = $dataset->withPoint(
165  "Item",
166  $points
167  );
168  $dataset = $dataset->withAlternativeInformation(
169  "Item",
170  $info
171  );
172 
173  $this->assertEquals(false, $dataset->isEmpty());
174 
175  $dataset = $dataset->withResetDataset();
176 
177  $this->assertEquals(true, $dataset->isEmpty());
178  $this->assertEquals([], $dataset->getPoints());
179  $this->assertEquals([], $dataset->getAlternativeInformation());
180  }
getSimpleDimensions()
Definition: DatasetTest.php:38
+ Here is the call graph for this function:

Field Documentation

◆ $f

Data Factory DatasetTest::$f
protected

Definition at line 31 of file DatasetTest.php.


The documentation for this class was generated from the following file: