ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilIndividualAssessmentSettingsTest.php
Go to the documentation of this file.
1 <?php
2 
3 require_once 'Modules/IndividualAssessment/classes/Settings/class.ilIndividualAssessmentSettings.php';
4 require_once 'Modules/IndividualAssessment/classes/Settings/class.ilIndividualAssessmentSettingsStorageDB.php';
5 require_once 'Modules/IndividualAssessment/classes/class.ilObjIndividualAssessment.php';
6 
12 {
13  public static $iass;
14  public static $iass_id;
15  public static $storage;
16  public static $db;
17 
18  public static function setUpBeforeClass()
19  {
20  PHPUnit_Framework_Error_Deprecated::$enabled = false;
21  include_once("./Services/PHPUnit/classes/class.ilUnitUtil.php");
22  ilUnitUtil::performInitialisation();
23  self::$iass = new ilObjIndividualAssessment;
24  self::$iass ->setTitle("iass_test");
25  self::$iass ->setDescription("iass_test_desc");
26  self::$iass ->create();
27  self::$iass ->createReference();
28  self::$iass ->putInTree(ROOT_FOLDER_ID);
29  self::$iass_id = self::$iass->getId();
30  global $ilDB;
31  self::$storage = new ilIndividualAssessmentSettingsStorageDB($ilDB);
32  }
33 
34 
35  public function test_create_settings()
36  {
37  $settings = self::$storage->loadSettings(self::$iass);
38  $content = $settings->content();
39  $record_template = $settings->recordTemplate();
40  $this->assertEquals($content, ilIndividualAssessmentSettings::DEF_CONTENT);
41  $this->assertEquals($record_template, ilIndividualAssessmentSettings::DEF_RECORD_TEMPLATE);
42  return $settings;
43  }
44 
48  public function test_settings_change($settings)
49  {
50  $settings = $settings->setContent('some_content')->setRecordTemplate('some_template');
51  $this->assertEquals($settings->content(), 'some_content');
52  $this->assertEquals($settings->recordTemplate(), 'some_template');
53  self::$storage->updateSettings($settings);
54  }
55 
59  public function test_settings_load()
60  {
61  $settings = self::$storage->loadSettings(self::$iass);
62  $this->assertEquals($settings->content(), 'some_content');
63  $this->assertEquals($settings->recordTemplate(), 'some_template');
64  return $settings;
65  }
66 
70  public function test_settings_update()
71  {
72  $iass = new ilObjIndividualAssessment(self::$iass_id, false);
73  $settings = $iass->getSettings();
74  $this->assertEquals($settings->content(), 'some_content');
75  $this->assertEquals($settings->recordTemplate(), 'some_template');
76  $settings = $settings->setContent('some_content2')->setRecordTemplate('some_template2');
77  $iass->update();
78  $iass = new ilObjIndividualAssessment(self::$iass_id, false);
79  $settings = $iass->getSettings();
80  $this->assertEquals($settings->content(), 'some_content2');
81  $this->assertEquals($settings->recordTemplate(), 'some_template2');
82  return $settings;
83  }
84 
85 
89  public function test_settings_delete($settings)
90  {
91  self::$iass->delete();
92  $settings = self::$storage->loadSettings(self::$iass);
93  $this->assertEquals($settings->content(), '');
94  $this->assertEquals($settings->recordTemplate(), '');
95  }
96 }
For the purpose of streamlining the grading and learning-process status definition outside of tests...
A settings storage handler to write iass settings to db.
test_settings_change($settings)
test_create_settings
setTitle($a_title)
set object title
global $ilDB
test_settings_delete($settings)
test_settings_update