ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
SkillCategoryTest.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
23 
28 class SkillCategoryTest extends TestCase
29 {
31 
32  protected function setGlobalVariable(string $name, $value): void
33  {
34  global $DIC;
35 
36  $GLOBALS[$name] = $value;
37 
38  unset($DIC[$name]);
39  $DIC[$name] = static function (\ILIAS\DI\Container $c) use ($value) {
40  return $value;
41  };
42  }
43 
44 
45  protected function setUp(): void
46  {
47  parent::setUp();
48 
49  $dic = new ILIAS\DI\Container();
50  $GLOBALS['DIC'] = $dic;
51 
52  $db = $this->createMock(ilDBInterface::class);
53  $this->setGlobalVariable(
54  "ilDB",
55  $db
56  );
57  $tree = $this->createMock(ilTree::class);
58  $this->setGlobalVariable(
59  "tree",
60  $tree
61  );
62  $rbac = $this->createMock(ilRbacSystem::class);
63  $this->setGlobalVariable(
64  "rbacsystem",
65  $rbac
66  );
67  $user = $this->createMock(ilObjUser::class);
68  $this->setGlobalVariable(
69  "ilUser",
70  $user
71  );
72 
73  $this->skill_category = new ilSkillCategory();
74  }
75 
76  protected function tearDown(): void
77  {
78  }
79 
80  public function testProperties(): void
81  {
83  $sk->setTitle("A skill category");
84  $sk->setDescription("This is a description for a skill category.");
85  $sk->setSelfEvaluation(true);
86  $sk->setOrderNr(10);
87  $sk->setStatus(0);
88  $sk->setId(4);
89  $sk->setImportId("an_import_id");
90 
91  $this->assertEquals(
92  "scat",
93  $sk->getType()
94  );
95  $this->assertEquals(
96  "A skill category",
97  $sk->getTitle()
98  );
99  $this->assertEquals(
100  "This is a description for a skill category.",
101  $sk->getDescription()
102  );
103  $this->assertEquals(
104  true,
105  $sk->getSelfEvaluation()
106  );
107  $this->assertEquals(
108  10,
109  $sk->getOrderNr()
110  );
111  $this->assertEquals(
112  0,
113  $sk->getStatus()
114  );
115  $this->assertEquals(
116  4,
117  $sk->getId()
118  );
119  $this->assertEquals(
120  "an_import_id",
121  $sk->getImportId()
122  );
123  }
124 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setGlobalVariable(string $name, $value)
$c
Definition: cli.php:38
Test class ilSkillCategory.
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:31
global $DIC
Definition: feed.php:28
if($format !==null) $name
Definition: metadata.php:247
setTitle(string $a_title)
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
ilSkillCategory $skill_category
$dic
Definition: result.php:32