ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
ilStudyProgrammeSettingsRepositoryTest Class Reference

needsInstalledILIAS More...

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

Public Member Functions

 test_init ()
 
 test_create ($repo)
 test_init More...
 
 test_edit_and_update ()
 test_create More...
 
 test_delete ()
 test_edit_and_update More...
 

Protected Member Functions

 setUp ()
 

Protected Attributes

 $backupGlobals = false
 

Static Protected Attributes

static $created
 

Detailed Description

needsInstalledILIAS

Definition at line 6 of file ilStudyProgrammeSettingsRepositoryTest.php.

Member Function Documentation

◆ setUp()

ilStudyProgrammeSettingsRepositoryTest::setUp ( )
protected

Definition at line 11 of file ilStudyProgrammeSettingsRepositoryTest.php.

References $DIC, and Vendor\Package\$e.

11  : void
12  {
13  PHPUnit_Framework_Error_Deprecated::$enabled = false;
14 
15  global $DIC;
16  if (!$DIC) {
17  try {
18  include_once("./Services/PHPUnit/classes/class.ilUnitUtil.php");
19  ilUnitUtil::performInitialisation();
20  } catch (Exception $e) {
21  }
22  }
23  global $DIC;
24  $this->db = $DIC['ilDB'];
25  $this->tps = $this->createMock(ilOrgUnitObjectTypePositionSetting::class);
26  $this->tps->method('getActivationDefault')
27  ->willReturn(true);
28  }
$DIC
Definition: xapitoken.php:46

◆ test_create()

ilStudyProgrammeSettingsRepositoryTest::test_create (   $repo)

test_init

Definition at line 43 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.

44  {
45  $set = $repo->createFor(-1);
46  $this->assertEquals($set->getSubtypeId(), ilStudyProgrammeSettings::DEFAULT_SUBTYPE);
47  $this->assertEquals($set->getStatus(), ilStudyProgrammeSettings::STATUS_DRAFT);
48  $this->assertEquals($set->getLPMode(), ilStudyProgrammeSettings::MODE_UNDEFINED);
49  $this->assertEquals($set->getPoints(), ilStudyProgrammeSettings::DEFAULT_POINTS);
50  $this->assertEquals($set->getDeadlinePeriod(), 0);
51  $this->assertNull($set->getDeadlineDate());
52  $this->assertEquals($set->getValidityOfQualificationPeriod(), ilStudyProgrammeSettings::NO_VALIDITY_OF_QUALIFICATION_PERIOD);
53  $this->assertNull($set->getValidityOfQualificationDate());
54  $this->assertEquals($set->getRestartPeriod(), ilStudyProgrammeSettings::NO_RESTART);
55  }

◆ test_delete()

ilStudyProgrammeSettingsRepositoryTest::test_delete ( )

test_edit_and_update

Definition at line 142 of file ilStudyProgrammeSettingsRepositoryTest.php.

References ilStudyProgrammeSettings\MODE_POINTS, and ilStudyProgrammeSettings\STATUS_ACTIVE.

143  {
145  $this->db,
146  $this->tps
147  );
148  $set = $repo->read(-1);
149  $this->assertEquals($set->getSubtypeId(), 123);
150  $this->assertEquals($set->getStatus(), ilStudyProgrammeSettings::STATUS_ACTIVE);
151  $this->assertEquals($set->getLPMode(), ilStudyProgrammeSettings::MODE_POINTS);
152  $this->assertEquals($set->getPoints(), 10);
153  $repo->delete($set);
154  $repo->read(-1);
155  }

◆ test_edit_and_update()

ilStudyProgrammeSettingsRepositoryTest::test_edit_and_update ( )

test_create

Definition at line 60 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.

61  {
63  $this->db,
64  $this->tps
65  );
66  $set = $repo->read(-1);
67  $this->assertEquals($set->getSubtypeId(), ilStudyProgrammeSettings::DEFAULT_SUBTYPE);
68  $this->assertEquals($set->getStatus(), ilStudyProgrammeSettings::STATUS_DRAFT);
69  $this->assertEquals($set->getLPMode(), ilStudyProgrammeSettings::MODE_UNDEFINED);
70  $this->assertEquals($set->getPoints(), ilStudyProgrammeSettings::DEFAULT_POINTS);
71  $this->assertEquals($set->getDeadlinePeriod(), 0);
72  $this->assertNull($set->getDeadlineDate());
73  $this->assertEquals($set->getValidityOfQualificationPeriod(), ilStudyProgrammeSettings::NO_VALIDITY_OF_QUALIFICATION_PERIOD);
74  $this->assertNull($set->getValidityOfQualificationDate());
75  $this->assertEquals($set->getRestartPeriod(), ilStudyProgrammeSettings::NO_RESTART);
76 
78  $this->db,
79  $this->tps
80  );
82  $set = $repo->read(-1);
83  $this->assertEquals($set->getSubtypeId(), ilStudyProgrammeSettings::DEFAULT_SUBTYPE);
84  $this->assertEquals($set->getStatus(), ilStudyProgrammeSettings::STATUS_DRAFT);
85  $this->assertEquals($set->getLPMode(), ilStudyProgrammeSettings::MODE_UNDEFINED);
86  $this->assertEquals($set->getPoints(), ilStudyProgrammeSettings::DEFAULT_POINTS);
87  $this->assertEquals($set->getDeadlinePeriod(), 0);
88  $this->assertNull($set->getDeadlineDate());
89  $this->assertEquals($set->getValidityOfQualificationPeriod(), ilStudyProgrammeSettings::NO_VALIDITY_OF_QUALIFICATION_PERIOD);
90  $this->assertNull($set->getValidityOfQualificationDate());
91  $this->assertEquals($set->getRestartPeriod(), ilStudyProgrammeSettings::NO_RESTART);
92 
93  $set->setSubtypeId(123)
96  ->setPoints(10)
97  ->setDeadlinePeriod(10)
98  ->setValidityOfQualificationPeriod(20)
99  ->setRestartPeriod(30);
100  $repo->update($set);
102  $set = $repo->read(-1);
103  $this->assertEquals($set->getSubtypeId(), 123);
104  $this->assertEquals($set->getStatus(), ilStudyProgrammeSettings::STATUS_ACTIVE);
105  $this->assertEquals($set->getLPMode(), ilStudyProgrammeSettings::MODE_POINTS);
106  $this->assertEquals($set->getPoints(), 10);
107  $this->assertEquals($set->getDeadlinePeriod(), 10);
108  $this->assertNull($set->getDeadlineDate());
109  $this->assertEquals($set->getValidityOfQualificationPeriod(), 20);
110  $this->assertNull($set->getValidityOfQualificationDate());
111  $this->assertEquals($set->getRestartPeriod(), 30);
112 
113  $set->setSubtypeId(123)
114  ->setDeadlineDate(new DateTime())
115  ->setValidityOfQualificationDate(DateTime::createFromFormat('Ymd', '20200101'))
116  ->setRestartPeriod(ilStudyProgrammeSettings::NO_RESTART);
117  $repo->update($set);
119  $set = $repo->read(-1);
120  $this->assertEquals($set->getDeadlinePeriod(), 0);
121  $this->assertEquals($set->getDeadlineDate()->format('Ymd'), (new DateTime())->format('Ymd'));
122  $this->assertEquals($set->getValidityOfQualificationDate()->format('Ymd'), '20200101');
123  $this->assertEquals($set->getValidityOfQualificationPeriod(), ilStudyProgrammeSettings::NO_VALIDITY_OF_QUALIFICATION_PERIOD);
124  $this->assertEquals($set->getRestartPeriod(), ilStudyProgrammeSettings::NO_RESTART);
125 
127  $this->db,
128  $this->tps
129  );
131  $set = $repo->read(-1);
132  $this->assertEquals($set->getSubtypeId(), 123);
133  $this->assertEquals($set->getStatus(), ilStudyProgrammeSettings::STATUS_ACTIVE);
134  $this->assertEquals($set->getLPMode(), ilStudyProgrammeSettings::MODE_POINTS);
135  $this->assertEquals($set->getPoints(), 10);
136  }
+ Here is the call graph for this function:

◆ test_init()

ilStudyProgrammeSettingsRepositoryTest::test_init ( )

Definition at line 30 of file ilStudyProgrammeSettingsRepositoryTest.php.

31  {
33  $this->db,
34  $this->tps
35  );
36  $this->assertInstanceOf(ilStudyProgrammeSettingsRepository::class, $repo);
37  return $repo;
38  }

Field Documentation

◆ $backupGlobals

ilStudyProgrammeSettingsRepositoryTest::$backupGlobals = false
protected

Definition at line 8 of file ilStudyProgrammeSettingsRepositoryTest.php.

◆ $created

ilStudyProgrammeSettingsRepositoryTest::$created
staticprotected

Definition at line 9 of file ilStudyProgrammeSettingsRepositoryTest.php.


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