ILIAS  trunk Revision v11.0_alpha-1731-gff9cd7e2bd3
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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 ()
 

Protected Member Functions

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

Protected Attributes

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

Private Attributes

MarkSchema $ass_mark_schema
 

Additional Inherited Members

- Static Public Member Functions inherited from ilTestBaseTestCase
static callMethod ($obj, $name, array $args=[])
 

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

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:35

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

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

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: