ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
SkillCategoryTest.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
21namespace ILIAS\Skill\Node;
22
23use PHPUnit\Framework\TestCase;
24
29class SkillCategoryTest extends TestCase
30{
31 protected \ilSkillCategory $skill_category;
32
33 protected function setGlobalVariable(string $name, $value): void
34 {
35 global $DIC;
36
37 $GLOBALS[$name] = $value;
38
39 unset($DIC[$name]);
40 $DIC[$name] = static function (\ILIAS\DI\Container $c) use ($value) {
41 return $value;
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}
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:36
Test class ilSkillCategory.
setGlobalVariable(string $name, $value)
setTitle(string $a_title)
$c
Definition: deliver.php:25
$dic
Definition: ltiresult.php:33
global $DIC
Definition: shib_login.php:26
$GLOBALS["DIC"]
Definition: wac.php:54