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