ILIAS  trunk Revision v12.0_alpha-377-g3641b37b9db
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
 
MarkSchemaFactory $mark_schema_factory
 

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 30 of file MarkSchemaTest.php.

Member Function Documentation

◆ setUp()

MarkSchemaTest::setUp ( )
protected

Reimplemented from ilTestBaseTestCase.

Definition at line 36 of file MarkSchemaTest.php.

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

◆ testConstructor()

MarkSchemaTest::testConstructor ( )

Test constructor.

Definition at line 47 of file MarkSchemaTest.php.

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

◆ testCreateSimpleSchemaCustom()

MarkSchemaTest::testCreateSimpleSchemaCustom ( )

Test for createSimpleSchema using custom values.

Definition at line 133 of file MarkSchemaTest.php.

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

◆ testCreateSimpleSchemaDefaults()

MarkSchemaTest::testCreateSimpleSchemaDefaults ( )

Test for createSimpleSchema using defaults.

Definition at line 66 of file MarkSchemaTest.php.

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

◆ testSaveToDb_regular()

MarkSchemaTest::testSaveToDb_regular ( )

Definition at line 208 of file MarkSchemaTest.php.

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

Field Documentation

◆ $ass_mark_schema

MarkSchema MarkSchemaTest::$ass_mark_schema
private

Definition at line 32 of file MarkSchemaTest.php.

◆ $backupGlobals

MarkSchemaTest::$backupGlobals = false
protected

Definition at line 34 of file MarkSchemaTest.php.

◆ $mark_schema_factory

MarkSchemaFactory MarkSchemaTest::$mark_schema_factory
private

Definition at line 33 of file MarkSchemaTest.php.


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