ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
MarkSchemaTest Class Reference

Unit tests for single choice questions. More...

+ Inheritance diagram for MarkSchemaTest:
+ Collaboration diagram for MarkSchemaTest:

Public Member Functions

 testConstructor ()
 Test constructor. More...
 
 testCreateSimpleSchemaDefaults ()
 Test for createSimpleSchema using defaults. More...
 
 testCreateSimpleSchemaCustom ()
 Test for createSimpleSchema using custom values. More...
 
 testSaveToDb_regular ()
 
- Public Member Functions inherited from ilTestBaseTestCase
 createInstanceOf (string $class_name, array $explicit_parameters=[])
 
 createTraitInstanceOf (string $class_name, array $explicit_parameters=[])
 

Protected Member Functions

 setUp ()
 
- Protected Member Functions inherited from ilTestBaseTestCase
 setUp ()
 
 tearDown ()
 

Protected Attributes

 $backupGlobals = false
 
- Protected Attributes inherited from ilTestBaseTestCase
Container $dic = null
 
Container $backup_dic = null
 

Private Attributes

MarkSchema $ass_mark_schema
 

Additional Inherited Members

- Static Public Member Functions inherited from ilTestBaseTestCase
static callMethod ($obj, $name, array $args=[])
 
static getNonPublicPropertyValue (object $obj, string $name)
 
- Data Fields inherited from ilTestBaseTestCase
const string MOCKED_METHOD_WITHOUT_OUTPUT = 'MOCKED_METHOD_WITHOUT_OUTPUT'
 
const string DYNAMIC_CLASS = 'DynamicClass'
 
- Static Protected Attributes inherited from ilTestBaseTestCase
static int $DYNAMIC_CLASS_COUNT = 0
 

Detailed Description

Unit tests for single choice questions.

Author
Maximilian Becker mbeck.nosp@m.er@d.nosp@m.ataba.nosp@m.y.de
Version
$Id$

Definition at line 29 of file MarkSchemaTest.php.

Member Function Documentation

◆ setUp()

MarkSchemaTest::setUp ( )
protected

Reimplemented from ilTestBaseTestCase.

Definition at line 34 of file MarkSchemaTest.php.

34 : void
35 {
36 parent::setUp();
37
38 $this->ass_mark_schema = new MarkSchema(0);
39 }
A class defining mark schemas for assessment test objects.
Definition: MarkSchema.php:36

◆ testConstructor()

MarkSchemaTest::testConstructor ( )

Test constructor.

Definition at line 44 of file MarkSchemaTest.php.

45 {
46 // Arrange
47 $expected = is_array([]);
48
49 // Act
50 $actual = is_array($this->ass_mark_schema->getMarkSteps());
51
52 // Assert
53 $this->assertEquals(
54 $actual,
55 $expected,
56 "Constructor failed, mark_steps not an array."
57 );
58 }

◆ testCreateSimpleSchemaCustom()

MarkSchemaTest::testCreateSimpleSchemaCustom ( )

Test for createSimpleSchema using custom values.

Definition at line 130 of file MarkSchemaTest.php.

131 {
132 // Arrange
133 $txt_failed_short = "failed";
134 $txt_failed_official = "failed";
135 $percentage_failed = 0;
136 $failed_passed = false;
137 $txt_passed_short = "passed";
138 $txt_passed_official = "passed";
139 $percentage_passed = 50;
140 $passed_passed = true;
141
142 // Act
143 $mark_schema = $this->ass_mark_schema->createSimpleSchema(
144 $txt_failed_short,
145 $txt_failed_official,
146 $percentage_failed,
147 $failed_passed,
148 $txt_passed_short,
149 $txt_passed_official,
150 $percentage_passed,
151 $passed_passed
152 );
153
154 $marks = $mark_schema->getMarkSteps();
155
156 $failed = $marks[0];
157 $passed = $marks[1];
158
159 // Assert
160 $this->assertEquals(
161 $failed->getShortName(),
162 $txt_failed_short,
163 'Failed on $txt_failed_short'
164 );
165 $this->assertEquals(
166 $failed->getOfficialName(),
167 $txt_failed_official,
168 'Failed on $txt_failed_official'
169 );
170 $this->assertEquals(
171 $failed->getMinimumLevel(),
172 $percentage_failed,
173 'Failed on $percentage_failed'
174 );
175 $this->assertEquals(
176 $failed->getPassed(),
177 $failed_passed,
178 'Failed on $failed_passed'
179 );
180
181 $this->assertEquals(
182 $passed->getShortName(),
183 $txt_passed_short,
184 'Failed on $txt_passed_short'
185 );
186 $this->assertEquals(
187 $passed->getOfficialName(),
188 $txt_passed_official,
189 'Failed on $txt_passed_official'
190 );
191 $this->assertEquals(
192 $passed->getMinimumLevel(),
193 $percentage_passed,
194 'Failed on $percetage_passed'
195 );
196 $this->assertEquals(
197 $passed->getPassed(),
198 $passed_passed,
199 'Failed on $passed_passed'
200 );
201 }

◆ testCreateSimpleSchemaDefaults()

MarkSchemaTest::testCreateSimpleSchemaDefaults ( )

Test for createSimpleSchema using defaults.

Definition at line 63 of file MarkSchemaTest.php.

64 {
65 // Arrange
66
67 $txt_failed_short = "failed";
68 $txt_failed_official = "failed";
69 $percentage_failed = 0;
70 $failed_passed = false;
71 $txt_passed_short = "passed";
72 $txt_passed_official = "passed";
73 $percentage_passed = 50;
74 $passed_passed = true;
75
76 // Act
77 $mark_schema = $this->ass_mark_schema->createSimpleSchema();
78 $marks = $mark_schema->getMarkSteps();
79
80 $failed = $marks[0];
81 $passed = $marks[1];
82
83 // Assert
84 $this->assertEquals(
85 $failed->getShortName(),
86 $txt_failed_short,
87 'Failed on $txt_failed_short'
88 );
89 $this->assertEquals(
90 $failed->getOfficialName(),
91 $txt_failed_official,
92 'Failed on $txt_failed_official'
93 );
94 $this->assertEquals(
95 $failed->getMinimumLevel(),
96 $percentage_failed,
97 'Failed on $percentage_failed'
98 );
99 $this->assertEquals(
100 $failed->getPassed(),
101 $failed_passed,
102 'Failed on $failed_passed'
103 );
104
105 $this->assertEquals(
106 $passed->getShortName(),
107 $txt_passed_short,
108 'Failed on $txt_passed_short'
109 );
110 $this->assertEquals(
111 $passed->getOfficialName(),
112 $txt_passed_official,
113 'Failed on $txt_passed_official'
114 );
115 $this->assertEquals(
116 $passed->getMinimumLevel(),
117 $percentage_passed,
118 'Failed on $percetage_passed'
119 );
120 $this->assertEquals(
121 $passed->getPassed(),
122 $passed_passed,
123 'Failed on $passed_passed'
124 );
125 }

◆ testSaveToDb_regular()

MarkSchemaTest::testSaveToDb_regular ( )

Definition at line 204 of file MarkSchemaTest.php.

205 {
206 /*
207 // Arrange
208 $ildb_stub = $this->createMock('ilDBInterface');
209
210 $ildb_stub->expects($this->any())
211 ->method('query')
212 ->will($this->returnValue('foo'));
213
214 $ildb_stub->expects($this->any())
215 ->method('numRows')
216 ->will($this->returnValue(1));
217
218 $db_result_1 = array('cmi_node_id' => 8);
219 $db_result_2 = array('cmi_node_id' => 10);
220 $db_result_3 = array('cmi_node_id' => 12);
221 $db_result_4 = array('cmi_node_id' => 14);
222
223 $ildb_stub->expects($this->any())
224 ->method('fetchAssoc')
225 ->will($this->onConsecutiveCalls($db_result_1, $db_result_2, $db_result_3, $db_result_4));
226 */
227 }

Field Documentation

◆ $ass_mark_schema

MarkSchema MarkSchemaTest::$ass_mark_schema
private

Definition at line 31 of file MarkSchemaTest.php.

◆ $backupGlobals

MarkSchemaTest::$backupGlobals = false
protected

Definition at line 32 of file MarkSchemaTest.php.


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