ILIAS  trunk Revision v11.0_alpha-1713-gd8962da2f67
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
AxisTest.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
21 require_once(__DIR__ . "/../../../../../../../vendor/composer/vendor/autoload.php");
22 require_once(__DIR__ . "/../../../Base.php");
23 
26 
31 {
32  public function testXAbbreviation(): void
33  {
34  $x_axis = new XAxis();
35 
36  $this->assertEquals("x", $x_axis->getAbbreviation());
37  }
38 
39  public function testYAbbreviation(): void
40  {
41  $y_axis = new YAxis();
42 
43  $this->assertEquals("y", $y_axis->getAbbreviation());
44  }
45 
46  public function testType(): void
47  {
48  $x_axis = new XAxis();
49 
50  $this->assertEquals("linear", $x_axis->getType());
51 
52  $y_axis = new YAxis();
53 
54  $this->assertEquals("linear", $y_axis->getType());
55  }
56 
57  public function testWithDisplayed(): void
58  {
59  $x_axis = new XAxis();
60  $x_axis1 = $x_axis->withDisplayed(false);
61 
62  $this->assertEquals(true, $x_axis->isDisplayed());
63  $this->assertEquals(false, $x_axis1->isDisplayed());
64  }
65 
66  public function testWithStepSize(): void
67  {
68  $x_axis = new XAxis();
69  $x_axis1 = $x_axis->withStepSize(0.5);
70 
71  $this->assertEquals(1.0, $x_axis->getStepSize());
72  $this->assertEquals(0.5, $x_axis1->getStepSize());
73  }
74 
75  public function testWithBeginAtZero(): void
76  {
77  $x_axis = new XAxis();
78  $x_axis1 = $x_axis->withBeginAtZero(false);
79 
80  $this->assertEquals(true, $x_axis->isBeginAtZero());
81  $this->assertEquals(false, $x_axis1->isBeginAtZero());
82  }
83 
84  public function testWithMin(): void
85  {
86  $x_axis = new XAxis();
87  $x_axis1 = $x_axis->withMinValue(-2);
88 
89  $this->assertEquals(null, $x_axis->getMinValue());
90  $this->assertEquals(-2, $x_axis1->getMinValue());
91  }
92 
93  public function testWithMax(): void
94  {
95  $x_axis = new XAxis();
96  $x_axis1 = $x_axis->withMaxValue(10);
97 
98  $this->assertEquals(null, $x_axis->getMaxValue());
99  $this->assertEquals(10, $x_axis1->getMaxValue());
100  }
101 
102  public function testXWithPosition(): void
103  {
104  $x_axis = new XAxis();
105  $x_axis1 = $x_axis->withPosition("top");
106 
107  $this->assertEquals("bottom", $x_axis->getPosition());
108  $this->assertEquals("top", $x_axis1->getPosition());
109  }
110 
111  public function testXWithInvalidPosition(): void
112  {
113  $x_axis = new XAxis();
114 
115  $this->expectException(InvalidArgumentException::class);
116  $this->expectExceptionMessage("Position must be 'bottom' or 'top'.");
117 
118  $x_axis = $x_axis->withPosition("left");
119  }
120 
121  public function testYWithPosition(): void
122  {
123  $y_axis = new YAxis();
124  $y_axis1 = $y_axis->withPosition("right");
125 
126  $this->assertEquals("left", $y_axis->getPosition());
127  $this->assertEquals("right", $y_axis1->getPosition());
128  }
129 
130  public function testYWithInvalidPosition(): void
131  {
132  $y_axis = new YAxis();
133 
134  $this->expectException(InvalidArgumentException::class);
135  $this->expectExceptionMessage("Position must be 'left' or 'right'.");
136 
137  $y_axis = $y_axis->withPosition("bottom");
138  }
139 }
testXAbbreviation()
Definition: AxisTest.php:32
testYWithInvalidPosition()
Definition: AxisTest.php:130
testWithDisplayed()
Definition: AxisTest.php:57
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
testYAbbreviation()
Definition: AxisTest.php:39
testXWithInvalidPosition()
Definition: AxisTest.php:111
testType()
Definition: AxisTest.php:46
Test on Bar Configuration implementation.
Definition: AxisTest.php:30
testWithBeginAtZero()
Definition: AxisTest.php:75
testWithMin()
Definition: AxisTest.php:84
testXWithPosition()
Definition: AxisTest.php:102
testWithStepSize()
Definition: AxisTest.php:66
testYWithPosition()
Definition: AxisTest.php:121
testWithMax()
Definition: AxisTest.php:93