ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilTestFinalMarkLangVarBuilderTest.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
15 {
16  protected $backupGlobals = FALSE;
17 
18  protected function setUp()
19  {
20  if (defined('ILIAS_PHPUNIT_CONTEXT'))
21  {
22  include_once("./Services/PHPUnit/classes/class.ilUnitUtil.php");
23  ilUnitUtil::performInitialisation();
24  }
25  else
26  {
27  chdir( dirname( __FILE__ ) );
28  chdir('../../../');
29  }
30  }
31 
32  public function test_build()
33  {
34  $testCases = array(
35  array(
36  'param_passedStatus' => false, 'param_obligationsAnsweredStatus' => false, 'param_obligationsEnabled' => false,
37  'expected' => 'mark_tst_failed'
38  ),
39  array(
40  'param_passedStatus' => false, 'param_obligationsAnsweredStatus' => false, 'param_obligationsEnabled' => true,
41  'expected' => 'mark_tst_failed_obligations_missing'
42  ),
43  array(
44  'param_passedStatus' => false, 'param_obligationsAnsweredStatus' => true, 'param_obligationsEnabled' => false,
45  'expected' => 'mark_tst_failed'
46  ),
47  array(
48  'param_passedStatus' => false,
49  'param_obligationsAnsweredStatus' => true,
50  'param_obligationsEnabled' => true,
51  'expected' => 'mark_tst_failed_obligations_answered'
52  ),
53  array(
54  'param_passedStatus' => true,
55  'param_obligationsAnsweredStatus' => false,
56  'param_obligationsEnabled' => false,
57  'expected' => 'mark_tst_passed'
58  ),
59  array(
60  'param_passedStatus' => true,
61  'param_obligationsAnsweredStatus' => false,
62  'param_obligationsEnabled' => true,
63  'expected' => 'mark_tst_failed_obligations_missing'
64  ),
65  array(
66  'param_passedStatus' => true,
67  'param_obligationsAnsweredStatus' => true,
68  'param_obligationsEnabled' => false,
69  'expected' => 'mark_tst_passed'
70  ),
71  array(
72  'param_passedStatus' => true,
73  'param_obligationsAnsweredStatus' => true,
74  'param_obligationsEnabled' => true,
75  'expected' => 'mark_tst_passed_obligations_answered'
76  )
77  );
78 
79  foreach($testCases as $case)
80  {
81  // arrange
82 
83  $passedStatus = $case['param_passedStatus'];
84  $obligationsAnsweredStatus = $case['param_obligationsAnsweredStatus'];
85  $obligationsEnabled = $case['param_obligationsEnabled'];
86 
87  $expected = $case['expected'];
88 
89  require_once './Modules/Test/classes/class.ilTestFinalMarkLangVarBuilder.php';
90  $instance = new ilTestFinalMarkLangVarBuilder($passedStatus, $obligationsAnsweredStatus, $obligationsEnabled);
91 
92  // act
93 
94  $actual = $instance->build();
95 
96  // assert
97 
98  $this->assertEquals($expected, $actual);
99  }
100  }
101 }