ILIAS  release_8 Revision v8.24
ilStatisticsTest.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
26{
28
29 protected function setUp(): void
30 {
31 parent::setUp();
32
33 $this->testObj = new ilStatistics();
34 }
35
37 {
38 $this->assertInstanceOf(ilStatistics::class, $this->testObj);
39 }
40
41 public function testNANHandling(): void
42 {
43 $this->assertEquals(NAN_HANDLING_REMOVE, $this->testObj->getNANHandling());
44
45 $this->testObj->setNANHandling(NAN_HANDLING_REMOVE);
46 $this->assertEquals(NAN_HANDLING_REMOVE, $this->testObj->getNANHandling());
47
48 $this->testObj->setNANHandling(NAN_HANDLING_ZERO);
49 $this->assertEquals(NAN_HANDLING_ZERO, $this->testObj->getNANHandling());
50 }
51
52 public function testData(): void
53 {
54 $input = [
55 "1250",
56 "125125",
57 1518,
58 "abasfki",
59 -1251
60 ];
61 $this->testObj->setData($input);
62
63 $expected1 = [
64 -1251,
65 "1250",
66 1518,
67 "125125",
68 ];
69 $this->assertEquals($expected1, $this->testObj->getData());
70
71 $expected2 = [
72 -1251,
73 0,
74 "1250",
75 1518,
76 "125125",
77 ];
78 $this->testObj->setNANHandling(NAN_HANDLING_ZERO);
79 $this->testObj->setData($input);
80 $this->assertEquals($expected2, $this->testObj->getData());
81 }
82}
const NAN_HANDLING_REMOVE
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const NAN_HANDLING_ZERO
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
test_instantiateObject_shouldReturnInstance()
ilStatistics $testObj
This class provides mathematical functions for statistics.
Class ilTestBaseClass.