ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\Skill\Profile\SkillProfileCompletionManagerTest Class Reference
+ Inheritance diagram for ILIAS\Skill\Profile\SkillProfileCompletionManagerTest:
+ Collaboration diagram for ILIAS\Skill\Profile\SkillProfileCompletionManagerTest:

Public Member Functions

 testGetProfileProgress ()
 

Protected Member Functions

 getManagerMock ()
 
 getProfileManagerMock ()
 

Detailed Description

Definition at line 25 of file SkillProfileCompletionManagerTest.php.

Member Function Documentation

◆ getManagerMock()

ILIAS\Skill\Profile\SkillProfileCompletionManagerTest::getManagerMock ( )
protected

Definition at line 27 of file SkillProfileCompletionManagerTest.php.

27 : SkillProfileCompletionManager
28 {
29 $s_manager = $this->getProfileManagerMock();
30 $repo = $this->getMockBuilder(SkillProfileCompletionDBRepository::class)->disableOriginalConstructor()->getMock();
31
32 return new class ($s_manager, $repo) extends SkillProfileCompletionManager {
33 public function __construct(
34 protected SkillProfileManager $profile_manager,
35 protected SkillProfileCompletionDBRepository $profile_completion_repo
36 ) {
37 }
38
39 public function getActualMaxLevels(
40 int $user_id,
41 array $skills,
42 string $gap_mode = "",
43 string $gap_mode_type = "",
44 int $gap_mode_obj_id = 0,
45 string $trigger_user = ""
46 ): array {
47 $actual_levels = [];
48
49 if ($user_id === 101) {
50 $actual_levels[301][0] = 501;
51 $actual_levels[302][0] = 504;
52 $actual_levels[303][0] = 503;
53 $actual_levels[304][0] = 502;
54 $actual_levels[305][0] = 502;
55 } elseif ($user_id === 102) {
56 $actual_levels[301][0] = 505;
57 $actual_levels[302][0] = 505;
58 $actual_levels[303][0] = 505;
59 $actual_levels[304][0] = 505;
60 $actual_levels[305][0] = 505;
61 } elseif ($user_id === 103) {
62 $actual_levels[301][0] = 505;
63 $actual_levels[302][0] = 501;
64 $actual_levels[303][0] = 505;
65 $actual_levels[304][0] = 501;
66 $actual_levels[305][0] = 501;
67 } elseif ($user_id === 104) {
68 $actual_levels[301][0] = 505;
69 $actual_levels[305][0] = 501;
70 } elseif ($user_id === 105) {
71 // no levels
72 }
73
74 return $actual_levels;
75 }
76 };
77 }
__construct()
Constructor setup ILIAS global object @access public.
Definition: class.ilias.php:76

References $user_id, ILIAS\__construct(), and ILIAS\Skill\Profile\SkillProfileCompletionManagerTest\getProfileManagerMock().

Referenced by ILIAS\Skill\Profile\SkillProfileCompletionManagerTest\testGetProfileProgress().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getProfileManagerMock()

ILIAS\Skill\Profile\SkillProfileCompletionManagerTest::getProfileManagerMock ( )
protected

Definition at line 79 of file SkillProfileCompletionManagerTest.php.

79 : SkillProfileManager
80 {
81 $p_repo = $this->getMockBuilder(SkillProfileDBRepository::class)->disableOriginalConstructor()->getMock();
82 $pl_repo = $this->getMockBuilder(SkillProfileLevelsDBRepository::class)->disableOriginalConstructor()->getMock();
83 $pu_repo = $this->getMockBuilder(SkillProfileUserDBRepository::class)->disableOriginalConstructor()->getMock();
84 $pr_repo = $this->getMockBuilder(SkillProfileRoleDBRepository::class)->disableOriginalConstructor()->getMock();
85
86 return new class ($p_repo, $pl_repo, $pu_repo, $pr_repo) extends SkillProfileManager {
87 public function __construct(
88 protected SkillProfileDBRepository $profile_repo,
89 protected SkillProfileLevelsDBRepository $profile_levels_repo,
90 protected SkillProfileUserDBRepository $profile_user_repo,
91 protected SkillProfileRoleDBRepository $profile_role_repo
92 ) {
93 }
94
95 public function getSkillLevels(int $profile_id): array
96 {
97 $levels = [];
98
99 if ($profile_id > 0) {
100 $levels[] = new SkillProfileLevel($profile_id, 301, 0, 502, 10);
101 $levels[] = new SkillProfileLevel($profile_id, 302, 0, 505, 20);
102 $levels[] = new SkillProfileLevel($profile_id, 303, 0, 505, 30);
103 $levels[] = new SkillProfileLevel($profile_id, 304, 0, 504, 40);
104 $levels[] = new SkillProfileLevel($profile_id, 305, 0, 505, 50);
105 }
106
107 return $levels;
108 }
109 };
110 }

References ILIAS\__construct().

Referenced by ILIAS\Skill\Profile\SkillProfileCompletionManagerTest\getManagerMock().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ testGetProfileProgress()

ILIAS\Skill\Profile\SkillProfileCompletionManagerTest::testGetProfileProgress ( )

Definition at line 112 of file SkillProfileCompletionManagerTest.php.

112 : void
113 {
114 $manager = $this->getManagerMock();
115
116 $this->assertSame(0, $manager->getProfileProgress(101, 201));
117 $this->assertSame(100, $manager->getProfileProgress(102, 201));
118 $this->assertSame(40, $manager->getProfileProgress(103, 201));
119 $this->assertSame(20, $manager->getProfileProgress(104, 201));
120 $this->assertSame(0, $manager->getProfileProgress(105, 201));
121 $this->assertSame(0, $manager->getProfileProgress(101, 0));
122 $this->assertSame(0, $manager->getProfileProgress(0, 201));
123 $this->assertSame(0, $manager->getProfileProgress(0, 0));
124 }

References ILIAS\Skill\Profile\SkillProfileCompletionManagerTest\getManagerMock().

+ Here is the call graph for this function:

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