ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilStudyProgrammeSettingsRepositoryTest Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for ilStudyProgrammeSettingsRepositoryTest:
+ Collaboration diagram for ilStudyProgrammeSettingsRepositoryTest:

Public Member Functions

 test_init ()
 
 testPRGRepoCreate ($repo)
 test_init More...
 
 testPRGRepoEditAndUpdate ()
 test_create More...
 
 testPRGRepoDelete ()
 test_edit_and_update More...
 

Protected Member Functions

 setUp ()
 

Protected Attributes

 $backupGlobals = false
 

Static Protected Attributes

static $created
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning needsInstalledILIAS

Definition at line 24 of file ilStudyProgrammeSettingsRepositoryTest.php.

Member Function Documentation

◆ setUp()

ilStudyProgrammeSettingsRepositoryTest::setUp ( )
protected

Definition at line 29 of file ilStudyProgrammeSettingsRepositoryTest.php.

References $DIC, Vendor\Package\$e, and ILIAS\LTI\ToolProvider\$enabled.

29  : void
30  {
32 
33  global $DIC;
34  if (!$DIC) {
35  try {
36  include_once("./Services/PHPUnit/classes/class.ilUnitUtil.php");
37  ilUnitUtil::performInitialisation();
38  } catch (Exception $e) {
39  }
40  }
41  global $DIC;
42  $this->db = $DIC['ilDB'];
43  $this->tps = $this->createMock(ilOrgUnitObjectTypePositionSetting::class);
44  $this->tps->method('getActivationDefault')
45  ->willReturn(true);
46  }
bool $enabled
Whether the system instance is enabled to accept connection requests.
Definition: System.php:123
global $DIC
Definition: feed.php:28

◆ test_init()

ilStudyProgrammeSettingsRepositoryTest::test_init ( )

Definition at line 48 of file ilStudyProgrammeSettingsRepositoryTest.php.

49  {
51  $this->db,
52  $this->tps
53  );
54  $this->assertInstanceOf(ilStudyProgrammeSettingsRepository::class, $repo);
55  return $repo;
56  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ testPRGRepoCreate()

ilStudyProgrammeSettingsRepositoryTest::testPRGRepoCreate (   $repo)

test_init

Definition at line 61 of file ilStudyProgrammeSettingsRepositoryTest.php.

References ilStudyProgrammeSettings\DEFAULT_POINTS, ilStudyProgrammeSettings\DEFAULT_SUBTYPE, ilStudyProgrammeSettings\MODE_UNDEFINED, ilStudyProgrammeSettings\NO_RESTART, ilStudyProgrammeSettings\NO_VALIDITY_OF_QUALIFICATION_PERIOD, and ilStudyProgrammeSettings\STATUS_DRAFT.

62  {
63  $set = $repo->createFor(-1);
64  $this->assertEquals($set->getSubtypeId(), ilStudyProgrammeSettings::DEFAULT_SUBTYPE);
65  $this->assertEquals($set->getStatus(), ilStudyProgrammeSettings::STATUS_DRAFT);
66  $this->assertEquals($set->getLPMode(), ilStudyProgrammeSettings::MODE_UNDEFINED);
67  $this->assertEquals($set->getPoints(), ilStudyProgrammeSettings::DEFAULT_POINTS);
68  $this->assertEquals($set->getDeadlinePeriod(), 0);
69  $this->assertNull($set->getDeadlineDate());
70  $this->assertEquals($set->getValidityOfQualificationPeriod(), ilStudyProgrammeSettings::NO_VALIDITY_OF_QUALIFICATION_PERIOD);
71  $this->assertNull($set->getValidityOfQualificationDate());
72  $this->assertEquals($set->getRestartPeriod(), ilStudyProgrammeSettings::NO_RESTART);
73  }

◆ testPRGRepoDelete()

ilStudyProgrammeSettingsRepositoryTest::testPRGRepoDelete ( )

test_edit_and_update

Definition at line 159 of file ilStudyProgrammeSettingsRepositoryTest.php.

References ilStudyProgrammeSettings\MODE_POINTS, and ilStudyProgrammeSettings\STATUS_ACTIVE.

160  {
161  $this->expectException(\LogicException::class);
163  $this->db,
164  $this->tps
165  );
166  $set = $repo->get(-1);
167  $this->assertEquals($set->getSubtypeId(), 123);
168  $this->assertEquals($set->getStatus(), ilStudyProgrammeSettings::STATUS_ACTIVE);
169  $this->assertEquals($set->getLPMode(), ilStudyProgrammeSettings::MODE_POINTS);
170  $this->assertEquals($set->getPoints(), 10);
171  $repo->delete($set);
172  $repo->get(-1);
173  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ testPRGRepoEditAndUpdate()

ilStudyProgrammeSettingsRepositoryTest::testPRGRepoEditAndUpdate ( )

test_create

Definition at line 78 of file ilStudyProgrammeSettingsRepositoryTest.php.

References ilStudyProgrammeSettingsDBRepository\clearCache(), ilStudyProgrammeSettings\DEFAULT_POINTS, ilStudyProgrammeSettings\DEFAULT_SUBTYPE, ilStudyProgrammeSettings\MODE_POINTS, ilStudyProgrammeSettings\MODE_UNDEFINED, ilStudyProgrammeSettings\NO_RESTART, ilStudyProgrammeSettings\NO_VALIDITY_OF_QUALIFICATION_PERIOD, ilStudyProgrammeSettings\STATUS_ACTIVE, and ilStudyProgrammeSettings\STATUS_DRAFT.

79  {
81  $this->db,
82  $this->tps
83  );
84  $set = $repo->get(-1);
85  $this->assertEquals($set->getSubtypeId(), ilStudyProgrammeSettings::DEFAULT_SUBTYPE);
86  $this->assertEquals($set->getStatus(), ilStudyProgrammeSettings::STATUS_DRAFT);
87  $this->assertEquals($set->getLPMode(), ilStudyProgrammeSettings::MODE_UNDEFINED);
88  $this->assertEquals($set->getPoints(), ilStudyProgrammeSettings::DEFAULT_POINTS);
89  $this->assertEquals($set->getDeadlinePeriod(), 0);
90  $this->assertNull($set->getDeadlineDate());
91  $this->assertEquals($set->getValidityOfQualificationPeriod(), ilStudyProgrammeSettings::NO_VALIDITY_OF_QUALIFICATION_PERIOD);
92  $this->assertNull($set->getValidityOfQualificationDate());
93  $this->assertEquals($set->getRestartPeriod(), ilStudyProgrammeSettings::NO_RESTART);
94 
96  $this->db,
97  $this->tps
98  );
100  $set = $repo->get(-1);
101  $this->assertEquals($set->getSubtypeId(), ilStudyProgrammeSettings::DEFAULT_SUBTYPE);
102  $this->assertEquals($set->getStatus(), ilStudyProgrammeSettings::STATUS_DRAFT);
103  $this->assertEquals($set->getLPMode(), ilStudyProgrammeSettings::MODE_UNDEFINED);
104  $this->assertEquals($set->getPoints(), ilStudyProgrammeSettings::DEFAULT_POINTS);
105  $this->assertEquals($set->getDeadlinePeriod(), 0);
106  $this->assertNull($set->getDeadlineDate());
107  $this->assertEquals($set->getValidityOfQualificationPeriod(), ilStudyProgrammeSettings::NO_VALIDITY_OF_QUALIFICATION_PERIOD);
108  $this->assertNull($set->getValidityOfQualificationDate());
109  $this->assertEquals($set->getRestartPeriod(), ilStudyProgrammeSettings::NO_RESTART);
110 
111  $set->setSubtypeId(123)
114  ->setPoints(10)
115  ->setDeadlinePeriod(10)
116  ->setValidityOfQualificationPeriod(20)
117  ->setRestartPeriod(30);
118  $repo->update($set);
120  $set = $repo->get(-1);
121  $this->assertEquals($set->getSubtypeId(), 123);
122  $this->assertEquals($set->getStatus(), ilStudyProgrammeSettings::STATUS_ACTIVE);
123  $this->assertEquals($set->getLPMode(), ilStudyProgrammeSettings::MODE_POINTS);
124  $this->assertEquals($set->getPoints(), 10);
125  $this->assertEquals($set->getDeadlinePeriod(), 10);
126  $this->assertNull($set->getDeadlineDate());
127  $this->assertEquals($set->getValidityOfQualificationPeriod(), 20);
128  $this->assertNull($set->getValidityOfQualificationDate());
129  $this->assertEquals($set->getRestartPeriod(), 30);
130 
131  $set->setSubtypeId(123)
132  ->setDeadlineDate(new DateTime())
133  ->setValidityOfQualificationDate(DateTime::createFromFormat('Ymd', '20200101'))
134  ->setRestartPeriod(ilStudyProgrammeSettings::NO_RESTART);
135  $repo->update($set);
137  $set = $repo->get(-1);
138  $this->assertEquals($set->getDeadlinePeriod(), 0);
139  $this->assertEquals($set->getDeadlineDate()->format('Ymd'), (new DateTime())->format('Ymd'));
140  $this->assertEquals($set->getValidityOfQualificationDate()->format('Ymd'), '20200101');
141  $this->assertEquals($set->getValidityOfQualificationPeriod(), ilStudyProgrammeSettings::NO_VALIDITY_OF_QUALIFICATION_PERIOD);
142  $this->assertEquals($set->getRestartPeriod(), ilStudyProgrammeSettings::NO_RESTART);
143 
145  $this->db,
146  $this->tps
147  );
149  $set = $repo->get(-1);
150  $this->assertEquals($set->getSubtypeId(), 123);
151  $this->assertEquals($set->getStatus(), ilStudyProgrammeSettings::STATUS_ACTIVE);
152  $this->assertEquals($set->getLPMode(), ilStudyProgrammeSettings::MODE_POINTS);
153  $this->assertEquals($set->getPoints(), 10);
154  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

Field Documentation

◆ $backupGlobals

ilStudyProgrammeSettingsRepositoryTest::$backupGlobals = false
protected

Definition at line 26 of file ilStudyProgrammeSettingsRepositoryTest.php.

◆ $created

ilStudyProgrammeSettingsRepositoryTest::$created
staticprotected

Definition at line 27 of file ilStudyProgrammeSettingsRepositoryTest.php.


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