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