ILIAS  trunk Revision v11.0_alpha-1761-g6dbbfa7b760
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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 26 of file SkillProfileCompletionManagerTest.php.

Member Function Documentation

◆ getManagerMock()

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

Definition at line 28 of file SkillProfileCompletionManagerTest.php.

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

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

28  : SkillProfileCompletionManager
29  {
30  $s_manager = $this->getProfileManagerMock();
31  $repo = $this->getMockBuilder(SkillProfileCompletionDBRepository::class)->disableOriginalConstructor()->getMock();
32 
33  return new class ($s_manager, $repo) extends SkillProfileCompletionManager {
34  public function __construct(
35  protected SkillProfileManager $profile_manager,
36  protected SkillProfileCompletionDBRepository $profile_completion_repo
37  ) {
38  }
39 
40  public function getActualMaxLevels(
41  int $user_id,
42  array $skills,
43  string $gap_mode = "",
44  string $gap_mode_type = "",
45  int $gap_mode_obj_id = 0
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 public.
Definition: class.ilias.php:76
+ 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.

References ILIAS\__construct().

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

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  }
__construct()
Constructor setup ILIAS global object public.
Definition: class.ilias.php:76
+ 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.

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

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  }
+ Here is the call graph for this function:

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