ILIAS  trunk Revision v11.0_alpha-1689-g66c127b4ae8
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilStudyProgrammeSettingsRepositoryTest Class Reference
+ Inheritance diagram for ilStudyProgrammeSettingsRepositoryTest:
+ Collaboration diagram for ilStudyProgrammeSettingsRepositoryTest:

Public Member Functions

 test_init ()
 
 testPRGRepoEditAndUpdate (ilStudyProgrammeSettingsDBRepository $repo)
 test_init More...
 
 testPRGRepoDelete ()
 testPRGRepoEditAndUpdate More...
 

Protected Member Functions

 setUp ()
 

Protected Attributes

ilDBInterface $db
 
ilOrgUnitObjectTypePositionSetting $tps
 

Static Protected Attributes

static $created
 

Detailed Description

Definition at line 21 of file ilStudyProgrammeSettingsRepositoryTest.php.

Member Function Documentation

◆ setUp()

ilStudyProgrammeSettingsRepositoryTest::setUp ( )
protected

Definition at line 27 of file ilStudyProgrammeSettingsRepositoryTest.php.

27  : void
28  {
29  $this->db = $this->createMock(ilDBInterface::class);
30  $this->tps = $this->createMock(ilOrgUnitObjectTypePositionSetting::class);
31  $this->tps->method('getActivationDefault')
32  ->willReturn(1);
33  }

◆ test_init()

ilStudyProgrammeSettingsRepositoryTest::test_init ( )

Definition at line 35 of file ilStudyProgrammeSettingsRepositoryTest.php.

36  {
38  $this->db,
39  $this->tps
40  );
41  $this->assertInstanceOf(ilStudyProgrammeSettingsRepository::class, $repo);
42  return $repo;
43  }

◆ testPRGRepoDelete()

ilStudyProgrammeSettingsRepositoryTest::testPRGRepoDelete ( )

testPRGRepoEditAndUpdate

Definition at line 131 of file ilStudyProgrammeSettingsRepositoryTest.php.

References ilStudyProgrammeSettings\MODE_POINTS, and ilStudyProgrammeSettings\STATUS_ACTIVE.

132  {
133  $this->expectException(\LogicException::class);
135  $this->db,
136  $this->tps
137  );
138  $set = $repo->get(-1);
139  $this->assertEquals($set->getSubtypeId(), 123);
140  $this->assertEquals($set->getStatus(), ilStudyProgrammeSettings::STATUS_ACTIVE);
141  $this->assertEquals($set->getLPMode(), ilStudyProgrammeSettings::MODE_POINTS);
142  $this->assertEquals($set->getPoints(), 10);
143  $repo->delete($set);
144  $repo->get(-1);
145  }

◆ testPRGRepoEditAndUpdate()

ilStudyProgrammeSettingsRepositoryTest::testPRGRepoEditAndUpdate ( ilStudyProgrammeSettingsDBRepository  $repo)

test_init

Definition at line 48 of file ilStudyProgrammeSettingsRepositoryTest.php.

References ilStudyProgrammeSettingsDBRepository\clearCache(), ilStudyProgrammeSettingsDBRepository\createFor(), 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.

49  {
50  $this->markTestSkipped('Failed for some unknown reason.');
51 
53  $this->db,
54  $this->tps
55  );
56  $set = $repo->createFor(-1);
57  $this->assertEquals($set->getTypeSettings()->getTypeId(), ilStudyProgrammeSettings::DEFAULT_SUBTYPE);
58  $this->assertEquals($set->getAssessmentSettings()->getStatus(), ilStudyProgrammeSettings::STATUS_DRAFT);
59  $this->assertEquals($set->getLPMode(), ilStudyProgrammeSettings::MODE_UNDEFINED);
60  $this->assertEquals($set->getAssessmentSettings()->getPoints(), ilStudyProgrammeSettings::DEFAULT_POINTS);
61  $this->assertEquals($set->getDeadlineSettings()->getDeadlinePeriod(), 0);
62  $this->assertNull($set->getDeadlineSettings()->getDeadlineDate());
63  $this->assertEquals($set->getValidityOfQualificationSettings()->getQualificationPeriod(), ilStudyProgrammeSettings::NO_VALIDITY_OF_QUALIFICATION_PERIOD);
64  $this->assertNull($set->getValidityOfQualificationSettings()->getQualificationDate());
65  $this->assertEquals($set->getValidityOfQualificationSettings()->getRestartPeriod(), ilStudyProgrammeSettings::NO_RESTART);
66 
68  $this->db,
69  $this->tps
70  );
72  $set = $repo->get(-1);
73  $this->assertEquals($set->getSubtypeId(), ilStudyProgrammeSettings::DEFAULT_SUBTYPE);
74  $this->assertEquals($set->getAssessmentSettings()->getStatus(), ilStudyProgrammeSettings::STATUS_DRAFT);
75  $this->assertEquals($set->getLPMode(), ilStudyProgrammeSettings::MODE_UNDEFINED);
76  $this->assertEquals($set->getPoints(), ilStudyProgrammeSettings::DEFAULT_POINTS);
77  $this->assertEquals($set->getDeadlinePeriod(), 0);
78  $this->assertNull($set->getDeadlineDate());
79  $this->assertEquals($set->getValidityOfQualificationPeriod(), ilStudyProgrammeSettings::NO_VALIDITY_OF_QUALIFICATION_PERIOD);
80  $this->assertNull($set->getValidityOfQualificationDate());
81  $this->assertEquals($set->getRestartPeriod(), ilStudyProgrammeSettings::NO_RESTART);
82 
83  $set->setSubtypeId(123)
86  ->setPoints(10)
87  ->setDeadlinePeriod(10)
88  ->setValidityOfQualificationPeriod(20)
89  ->setRestartPeriod(30);
90  $repo->update($set);
92  $set = $repo->get(-1);
93  $this->assertEquals($set->getSubtypeId(), 123);
94  $this->assertEquals($set->getStatus(), ilStudyProgrammeSettings::STATUS_ACTIVE);
95  $this->assertEquals($set->getLPMode(), ilStudyProgrammeSettings::MODE_POINTS);
96  $this->assertEquals($set->getPoints(), 10);
97  $this->assertEquals($set->getDeadlinePeriod(), 10);
98  $this->assertNull($set->getDeadlineDate());
99  $this->assertEquals($set->getValidityOfQualificationPeriod(), 20);
100  $this->assertNull($set->getValidityOfQualificationDate());
101  $this->assertEquals($set->getRestartPeriod(), 30);
102 
103  $set->setSubtypeId(123)
104  ->setDeadlineDate(new DateTime())
105  ->setValidityOfQualificationDate(DateTime::createFromFormat('Ymd', '20200101'))
106  ->setRestartPeriod(ilStudyProgrammeSettings::NO_RESTART);
107  $repo->update($set);
109  $set = $repo->get(-1);
110  $this->assertEquals($set->getDeadlinePeriod(), 0);
111  $this->assertEquals($set->getDeadlineDate()->format('Ymd'), (new DateTime())->format('Ymd'));
112  $this->assertEquals($set->getValidityOfQualificationDate()->format('Ymd'), '20200101');
113  $this->assertEquals($set->getValidityOfQualificationPeriod(), ilStudyProgrammeSettings::NO_VALIDITY_OF_QUALIFICATION_PERIOD);
114  $this->assertEquals($set->getRestartPeriod(), ilStudyProgrammeSettings::NO_RESTART);
115 
117  $this->db,
118  $this->tps
119  );
121  $set = $repo->get(-1);
122  $this->assertEquals($set->getSubtypeId(), 123);
123  $this->assertEquals($set->getStatus(), ilStudyProgrammeSettings::STATUS_ACTIVE);
124  $this->assertEquals($set->getLPMode(), ilStudyProgrammeSettings::MODE_POINTS);
125  $this->assertEquals($set->getPoints(), 10);
126  }
createFor(int $obj_id)
Create a record corresponding to a SP-Object and return representing settings.Will throw if a record ...
+ Here is the call graph for this function:

Field Documentation

◆ $created

ilStudyProgrammeSettingsRepositoryTest::$created
staticprotected

Definition at line 23 of file ilStudyProgrammeSettingsRepositoryTest.php.

◆ $db

ilDBInterface ilStudyProgrammeSettingsRepositoryTest::$db
protected

Definition at line 24 of file ilStudyProgrammeSettingsRepositoryTest.php.

◆ $tps

ilOrgUnitObjectTypePositionSetting ilStudyProgrammeSettingsRepositoryTest::$tps
protected

Definition at line 25 of file ilStudyProgrammeSettingsRepositoryTest.php.


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