ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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 ()
 
 testDimensionsWithGroups ()
 
 testInvalidDimensionGroup ()
 
 testInvalidDimensionGroupKey ()
 

Protected Member Functions

 setUp ()
 
 getSimpleDimensions ()
 
 getSimpleDimensionGroups ()
 
 getExtendedDimensions ()
 

Protected Attributes

Data Factory $f
 

Detailed Description

Definition at line 26 of file DatasetTest.php.

Member Function Documentation

◆ getExtendedDimensions()

DatasetTest::getExtendedDimensions ( )
protected

Definition at line 51 of file DatasetTest.php.

51 : array
52 {
53 $c_dimension = $this->f->dimension()->cardinal();
54 $r_dimension = $this->f->dimension()->range($c_dimension);
55 $dimensions = [
56 "First dimension" => $c_dimension,
57 "Second dimension" => $c_dimension,
58 "Third dimension" => $r_dimension
59 ];
60
61 return $dimensions;
62 }

Referenced by testMaxValue(), and testMinValue().

+ Here is the caller graph for this function:

◆ getSimpleDimensionGroups()

DatasetTest::getSimpleDimensionGroups ( )
protected

Definition at line 43 of file DatasetTest.php.

43 : array
44 {
45 $group = $this->f->dimension()->group("A dimension", "Another dimension");
46 $groups = ["A group" => $group, "Another group" => $group];
47
48 return $groups;
49 }

Referenced by testDimensionsWithGroups().

+ Here is the caller graph for this function:

◆ getSimpleDimensions()

DatasetTest::getSimpleDimensions ( )
protected

Definition at line 35 of file DatasetTest.php.

35 : array
36 {
37 $c_dimension = $this->f->dimension()->cardinal();
38 $dimensions = ["A dimension" => $c_dimension, "Another dimension" => $c_dimension];
39
40 return $dimensions;
41 }

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

+ Here is the caller graph for this function:

◆ setUp()

DatasetTest::setUp ( )
protected

Definition at line 30 of file DatasetTest.php.

30 : void
31 {
32 $this->f = new Data\Factory();
33 }

◆ testDimensions()

DatasetTest::testDimensions ( )

Definition at line 64 of file DatasetTest.php.

64 : void
65 {
66 try {
67 $dimensions = $this->getSimpleDimensions();
68 $dataset = $this->f->dataset($dimensions);
69 $this->assertEquals($dimensions, $dataset->getDimensions());
70 } catch (\InvalidArgumentException $e) {
71 $this->assertFalse("This should not happen.");
72 }
73 }
getSimpleDimensions()
Definition: DatasetTest.php:35

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

+ Here is the call graph for this function:

◆ testDimensionsWithGroups()

DatasetTest::testDimensionsWithGroups ( )

Definition at line 228 of file DatasetTest.php.

228 : void
229 {
230 try {
231 $dimensions = $this->getSimpleDimensions();
232 $groups = $this->getSimpleDimensionGroups();
233 $dataset = $this->f->dataset($dimensions, $groups);
234 $this->assertEquals($groups, $dataset->getDimensionGroups());
235 } catch (\InvalidArgumentException $e) {
236 $this->fail("This should not happen.");
237 }
238 }
getSimpleDimensionGroups()
Definition: DatasetTest.php:43

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

+ Here is the call graph for this function:

◆ testInvalidDimension()

DatasetTest::testInvalidDimension ( )

Definition at line 75 of file DatasetTest.php.

75 : void
76 {
77 try {
78 $dimension = "Dimension";
79 $dataset = $this->f->dataset(["A dimension" => $dimension]);
80 $this->assertFalse("This should not happen.");
81 } catch (\InvalidArgumentException $e) {
82 $this->assertTrue(true);
83 }
84 }

References Vendor\Package\$e.

◆ testInvalidDimensionGroup()

DatasetTest::testInvalidDimensionGroup ( )

Definition at line 240 of file DatasetTest.php.

240 : void
241 {
242 $dimensions = $this->getSimpleDimensions();
243 $group = "Group";
244
245 $this->expectException(\InvalidArgumentException::class);
246 $dataset = $this->f->dataset($dimensions, ["A group" => $group]);
247 }

References getSimpleDimensions().

+ Here is the call graph for this function:

◆ testInvalidDimensionGroupKey()

DatasetTest::testInvalidDimensionGroupKey ( )

Definition at line 249 of file DatasetTest.php.

249 : void
250 {
251 $dimensions = $this->getSimpleDimensions();
252 $group = $this->f->dimension()->group("A dimension");
253
254 $this->expectException(\InvalidArgumentException::class);
255 $dataset = $this->f->dataset($dimensions, [1 => $group]);
256 }

References getSimpleDimensions().

+ Here is the call graph for this function:

◆ testInvalidDimensionKey()

DatasetTest::testInvalidDimensionKey ( )

Definition at line 86 of file DatasetTest.php.

86 : void
87 {
88 try {
89 $dimension = $this->f->dimension()->cardinal();
90 $dataset = $this->f->dataset([1 => $dimension]);
91 $this->assertFalse("This should not happen.");
92 } catch (\InvalidArgumentException $e) {
93 $this->assertTrue(true);
94 }
95 }

References Vendor\Package\$e.

◆ testMaxValue()

DatasetTest::testMaxValue ( )

Definition at line 210 of file DatasetTest.php.

210 : void
211 {
212 $dataset = $this->f->dataset($this->getExtendedDimensions());
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(
216 "Item 1",
217 $points1
218 );
219 $dataset = $dataset->withPoint(
220 "Item 2",
221 $points2
222 );
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"));
226 }
getExtendedDimensions()
Definition: DatasetTest.php:51

References getExtendedDimensions().

+ Here is the call graph for this function:

◆ testMinValue()

DatasetTest::testMinValue ( )

Definition at line 187 of file DatasetTest.php.

187 : void
188 {
189 $dataset = $this->f->dataset($this->getExtendedDimensions());
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(
194 "Item 1",
195 $points1
196 );
197 $dataset = $dataset->withPoint(
198 "Item 2",
199 $points2
200 );
201 $dataset = $dataset->withPoint(
202 "Item 2",
203 $points3
204 );
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"));
208 }

References getExtendedDimensions().

+ Here is the call graph for this function:

◆ testwithAlternativeInformation()

DatasetTest::testwithAlternativeInformation ( )

Definition at line 123 of file DatasetTest.php.

123 : void
124 {
125 $dataset = $this->f->dataset($this->getSimpleDimensions());
126 $info = ["A dimension" => "An information", "Another dimension" => null];
127 $dataset = $dataset->withAlternativeInformation(
128 "Item",
129 $info
130 );
131 $this->assertEquals(["Item" => $info], $dataset->getAlternativeInformation());
132 }
$info
Definition: entry_point.php:21

References $info, and getSimpleDimensions().

+ Here is the call graph for this function:

◆ testwithInvalidAlternativeInformationCount()

DatasetTest::testwithInvalidAlternativeInformationCount ( )

Definition at line 134 of file DatasetTest.php.

134 : void
135 {
136 try {
137 $dataset = $this->f->dataset($this->getSimpleDimensions());
138 $info = ["A dimension" => "An information", "Second dimension" => null];
139 $dataset = $dataset->withAlternativeInformation(
140 "Item",
141 $info
142 );
143 $this->assertFalse("This should not happen.");
144 } catch (\ArgumentCountError $e) {
145 $this->assertTrue(true);
146 }
147 }

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

+ Here is the call graph for this function:

◆ testwithInvalidAlternativeInformationValue()

DatasetTest::testwithInvalidAlternativeInformationValue ( )

Definition at line 149 of file DatasetTest.php.

149 : void
150 {
151 try {
152 $dataset = $this->f->dataset($this->getSimpleDimensions());
153 $info = ["A dimension" => "An information", "Another dimension" => 1];
154 $dataset = $dataset->withAlternativeInformation(
155 "Item",
156 $info
157 );
158 $this->assertFalse("This should not happen.");
159 } catch (\InvalidArgumentException $e) {
160 $this->assertTrue(true);
161 }
162 }

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

+ Here is the call graph for this function:

◆ testwithInvalidPointsCount()

DatasetTest::testwithInvalidPointsCount ( )

Definition at line 108 of file DatasetTest.php.

108 : void
109 {
110 try {
111 $dataset = $this->f->dataset($this->getSimpleDimensions());
112 $points = ["A dimension" => 1, "Second dimension" => 2];
113 $dataset = $dataset->withPoint(
114 "Item",
115 $points
116 );
117 $this->assertFalse("This should not happen.");
118 } catch (\ArgumentCountError $e) {
119 $this->assertTrue(true);
120 }
121 }

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

+ Here is the call graph for this function:

◆ testwithPoint()

DatasetTest::testwithPoint ( )

Definition at line 97 of file DatasetTest.php.

97 : void
98 {
99 $dataset = $this->f->dataset($this->getSimpleDimensions());
100 $points = ["A dimension" => 1, "Another dimension" => 2];
101 $dataset = $dataset->withPoint(
102 "Item",
103 $points
104 );
105 $this->assertEquals(["Item" => $points], $dataset->getPoints());
106 }

References getSimpleDimensions().

+ Here is the call graph for this function:

◆ testwithResetDataset()

DatasetTest::testwithResetDataset ( )

Definition at line 164 of file DatasetTest.php.

164 : void
165 {
166 $dataset = $this->f->dataset($this->getSimpleDimensions());
167 $points = ["A dimension" => 1, "Another dimension" => 2];
168 $info = ["A dimension" => "An information", "Another dimension" => null];
169 $dataset = $dataset->withPoint(
170 "Item",
171 $points
172 );
173 $dataset = $dataset->withAlternativeInformation(
174 "Item",
175 $info
176 );
177
178 $this->assertEquals(false, $dataset->isEmpty());
179
180 $dataset = $dataset->withResetDataset();
181
182 $this->assertEquals(true, $dataset->isEmpty());
183 $this->assertEquals([], $dataset->getPoints());
184 $this->assertEquals([], $dataset->getAlternativeInformation());
185 }

References $info, and getSimpleDimensions().

+ Here is the call graph for this function:

Field Documentation

◆ $f

Data Factory DatasetTest::$f
protected

Definition at line 28 of file DatasetTest.php.


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