ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilTestSkillLevelThresholdImportListTest.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
26{
28
29 protected function setUp(): void
30 {
31 parent::setUp();
32
33 $this->testObj = new ilTestSkillLevelThresholdImportList();
34 }
35
37 {
38 $this->assertInstanceOf(ilTestSkillLevelThresholdImportList::class, $this->testObj);
39 }
40
41 public function testAddOriginalSkillTitle(): void
42 {
43 $skillBaseId = 17;
44 $skillTrefId = 15;
45 $originalSkillTitle = 'Test';
46 $this->testObj->addOriginalSkillTitle($skillBaseId, $skillTrefId, $originalSkillTitle);
47
48 $reflProp = new ReflectionProperty($this->testObj, 'originalSkillTitles');
49 $reflProp->setAccessible(true);
50
51 $this->assertEquals(["$skillBaseId:$skillTrefId" => $originalSkillTitle], $reflProp->getValue($this->testObj));
52 }
53
54 public function testAddOriginalSkillPath(): void
55 {
56 $skillBaseId = 17;
57 $skillTrefId = 15;
58 $originalSkillPath = 'test/path';
59 $this->testObj->addOriginalSkillPath($skillBaseId, $skillTrefId, $originalSkillPath);
60
61 $reflProp = new ReflectionProperty($this->testObj, 'originalSkillPaths');
62 $reflProp->setAccessible(true);
63
64 $this->assertEquals(["$skillBaseId:$skillTrefId" => $originalSkillPath], $reflProp->getValue($this->testObj));
65 }
66
67 public function testAddSkillLevelThreshold(): void
68 {
69 $testSkillLevelThresholdImport = new ilTestSkillLevelThresholdImport();
70 $this->testObj->addSkillLevelThreshold($testSkillLevelThresholdImport);
71
72 $reflProp = new ReflectionProperty($this->testObj, 'importedSkillLevelThresholds');
73 $reflProp->setAccessible(true);
74
75 $this->assertEquals([$testSkillLevelThresholdImport], $reflProp->getValue($this->testObj));
76 }
77
78 public function testCurrent(): void
79 {
80 $testSkillLevelThresholdImport = new ilTestSkillLevelThresholdImport();
81 $this->testObj->addSkillLevelThreshold($testSkillLevelThresholdImport);
82
83 $this->assertEquals($testSkillLevelThresholdImport, $this->testObj->current());
84 }
85
86 public function testNext(): void
87 {
88 $testSkillLevelThresholdImport1 = new ilTestSkillLevelThresholdImport();
89 $testSkillLevelThresholdImport2 = new ilTestSkillLevelThresholdImport();
90
91 $this->testObj->addSkillLevelThreshold($testSkillLevelThresholdImport1);
92 $this->testObj->addSkillLevelThreshold($testSkillLevelThresholdImport2);
93
94 $this->testObj->next();
95 $this->assertEquals($testSkillLevelThresholdImport2, $this->testObj->current());
96 }
97
98 public function testKey(): void
99 {
100 $testSkillLevelThresholdImport1 = new ilTestSkillLevelThresholdImport();
101 $testSkillLevelThresholdImport2 = new ilTestSkillLevelThresholdImport();
102
103 $this->testObj->addSkillLevelThreshold($testSkillLevelThresholdImport1);
104 $this->testObj->addSkillLevelThreshold($testSkillLevelThresholdImport2);
105
106 $this->testObj->next();
107 $this->assertEquals(1, $this->testObj->key());
108 }
109
110 public function testValid(): void
111 {
112 $this->assertFalse($this->testObj->valid());
113 $testSkillLevelThresholdImport1 = new ilTestSkillLevelThresholdImport();
114 $testSkillLevelThresholdImport2 = new ilTestSkillLevelThresholdImport();
115
116 $this->testObj->addSkillLevelThreshold($testSkillLevelThresholdImport1);
117 $this->testObj->addSkillLevelThreshold($testSkillLevelThresholdImport2);
118
119 $this->assertTrue($this->testObj->valid());
120 }
121
122 public function testRewind(): void
123 {
124 $testSkillLevelThresholdImport1 = new ilTestSkillLevelThresholdImport();
125 $testSkillLevelThresholdImport2 = new ilTestSkillLevelThresholdImport();
126
127 $this->testObj->addSkillLevelThreshold($testSkillLevelThresholdImport1);
128 $this->testObj->addSkillLevelThreshold($testSkillLevelThresholdImport2);
129
130 $this->testObj->next();
131 $this->testObj->next();
132 $this->testObj->rewind();
133 $this->assertEquals($testSkillLevelThresholdImport1, $this->testObj->current());
134 }
135}
Class ilTestBaseClass.
Class ilTestSkillLevelThresholdImportListTest.