ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
ilStudyProgrammeTypeTest Class Reference

needsInstalledILIAS More...

+ Inheritance diagram for ilStudyProgrammeTypeTest:
+ Collaboration diagram for ilStudyProgrammeTypeTest:

Public Member Functions

 setUp ()
 
 test_init_and_id ()
 
 test_owner ($t)
 test_init_and_id More...
 
 test_set_icon ($t)
 test_init_and_id More...
 
 test_icon_path ()
 test_init_and_id test_set_icon More...
 
 test_icon_failure ($t)
 test_init_and_id ilStudyProgrammeTypeException More...
 
 test_default_lang ($t)
 test_init_and_id More...
 
 test_create_date ($t)
 test_init_and_id More...
 
 test_repository ($t)
 test_init_and_id More...
 

Protected Attributes

 $backupGlobals = false
 

Detailed Description

needsInstalledILIAS

Definition at line 6 of file ilStudyProgrammeTypeTest.php.

Member Function Documentation

◆ setUp()

ilStudyProgrammeTypeTest::setUp ( )

Definition at line 10 of file ilStudyProgrammeTypeTest.php.

References $DIC, Vendor\Package\$e, and user().

10  : void
11  {
12  PHPUnit_Framework_Error_Deprecated::$enabled = false;
13 
14  global $DIC;
15  if (!$DIC) {
16  include_once("./Services/PHPUnit/classes/class.ilUnitUtil.php");
17  try {
18  ilUnitUtil::performInitialisation();
19  } catch (\Exception $e) {
20  }
21  }
22  $this->db = $DIC['ilDB'];
23  $this->filesystem = $DIC->filesystem()->web();
24  $this->user = $DIC['ilUser'];
25  $this->plugin_admin = $DIC['ilPluginAdmin'];
26  $this->lng = $DIC['lng'];
27  $tps = $this->createMock(ilOrgUnitObjectTypePositionSetting::class);
28  $tps->method('getActivationDefault')
29  ->willReturn(true);
30  $this->settings_repo = new ilStudyProgrammeSettingsDBRepository($this->db, $tps);
31  $this->type_repo = new ilStudyProgrammeTypeDBRepository(
32  $this->db,
33  $this->settings_repo,
34  $this->filesystem,
35  $this->user,
36  $this->plugin_admin,
37  $this->lng
38  );
39  }
user()
Definition: user.php:4
global $DIC
Definition: goto.php:24
+ Here is the call graph for this function:

◆ test_create_date()

ilStudyProgrammeTypeTest::test_create_date (   $t)

test_init_and_id

Definition at line 109 of file ilStudyProgrammeTypeTest.php.

110  {
111  $this->assertNull($t->getCreateDate());
112  $t->setCreateDate(DateTime::createFromFormat('Y-m-d H:i:s', '2018-01-02 01:02:03'));
113  $this->assertEquals($t->getCreateDate()->format('Y-m-d H:i:s'), '2018-01-02 01:02:03');
114  }

◆ test_default_lang()

ilStudyProgrammeTypeTest::test_default_lang (   $t)

test_init_and_id

Definition at line 99 of file ilStudyProgrammeTypeTest.php.

100  {
101  $this->assertEquals('', $t->getDefaultLang());
102  $t->setDefaultLang('de');
103  $this->assertEquals('de', $t->getDefaultLang());
104  }

◆ test_icon_failure()

ilStudyProgrammeTypeTest::test_icon_failure (   $t)

test_init_and_id ilStudyProgrammeTypeException

Definition at line 91 of file ilStudyProgrammeTypeTest.php.

92  {
93  $t->setIcon('some_non_svg_icon.png');
94  }

◆ test_icon_path()

ilStudyProgrammeTypeTest::test_icon_path ( )

test_init_and_id test_set_icon

Definition at line 78 of file ilStudyProgrammeTypeTest.php.

References test_init_and_id(), and ilStudyProgrammeType\WEB_DATA_FOLDER.

79  {
80  $t = $this->test_init_and_id();
81  $t->setIcon('some_svg_icon.svg');
82  $this->assertRegexp('#^' . ilStudyProgrammeType::WEB_DATA_FOLDER . '\\/type\\_' . '#', $t->getIconPath());
83  $this->assertRegexp('#^' . ilStudyProgrammeType::WEB_DATA_FOLDER . '\\/type\\_' . '#', $t->getIconPath(true));
84  $this->assertRegexp('#some_svg_icon.svg$#', $t->getIconPath(true));
85  }
const WEB_DATA_FOLDER
Folder in ILIAS webdir to store the icons.
+ Here is the call graph for this function:

◆ test_init_and_id()

ilStudyProgrammeTypeTest::test_init_and_id ( )

Definition at line 41 of file ilStudyProgrammeTypeTest.php.

References user().

Referenced by test_icon_path().

42  {
43  $t = new ilStudyProgrammeType(
44  1,
45  $this->type_repo,
46  $this->filesystem,
47  $this->plugin_admin,
48  $this->lng,
49  $this->user
50  );
51  $this->assertEquals(1, $t->getId());
52  return $t;
53  }
user()
Definition: user.php:4
Class ilStudyProgrammeType.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ test_owner()

ilStudyProgrammeTypeTest::test_owner (   $t)

test_init_and_id

Definition at line 58 of file ilStudyProgrammeTypeTest.php.

59  {
60  $this->assertNull($t->getOwner());
61  $t->setOwner(6);
62  $this->assertEquals(6, $t->getOwner());
63  }

◆ test_repository()

ilStudyProgrammeTypeTest::test_repository (   $t)

test_init_and_id

Definition at line 119 of file ilStudyProgrammeTypeTest.php.

120  {
121  $this->assertInstanceOf(ilStudyProgrammeTypeRepository::class, $t->getRepository());
122  }

◆ test_set_icon()

ilStudyProgrammeTypeTest::test_set_icon (   $t)

test_init_and_id

Definition at line 68 of file ilStudyProgrammeTypeTest.php.

69  {
70  $this->assertNull($t->getIcon());
71  $t->setIcon('some_svg_icon.svg');
72  $this->assertEquals('some_svg_icon.svg', $t->getIcon());
73  }

Field Documentation

◆ $backupGlobals

ilStudyProgrammeTypeTest::$backupGlobals = false
protected

Definition at line 8 of file ilStudyProgrammeTypeTest.php.


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