ILIAS  trunk Revision v11.0_alpha-2658-ge2404539063
ILIAS\LegalDocuments\ConsumerToolbox\ConsumerSlots\SelfRegistrationTest Class Reference
+ Inheritance diagram for ILIAS\LegalDocuments\ConsumerToolbox\ConsumerSlots\SelfRegistrationTest:
+ Collaboration diagram for ILIAS\LegalDocuments\ConsumerToolbox\ConsumerSlots\SelfRegistrationTest:

Public Member Functions

 testConstruct ()
 
 testLegacyInputGUIs ()
 
 testSaveLegacyForm ()
 
 testSaveLegacyFormFailed ()
 
 testUserCreation ()
 
 testUserCreationFailed ()
 

Detailed Description

Definition at line 36 of file SelfRegistrationTest.php.

Member Function Documentation

◆ testConstruct()

ILIAS\LegalDocuments\ConsumerToolbox\ConsumerSlots\SelfRegistrationTest::testConstruct ( )

Definition at line 40 of file SelfRegistrationTest.php.

40  : void
41  {
42  $this->assertInstanceOf(SelfRegistration::class, new SelfRegistration(
43  'foo',
44  $this->mock(UI::class),
45  $this->mock(User::class),
46  $this->mock(Provide::class),
47  $this->fail(...),
48  $this->fail(...)
49  ));
50  }

◆ testLegacyInputGUIs()

ILIAS\LegalDocuments\ConsumerToolbox\ConsumerSlots\SelfRegistrationTest::testLegacyInputGUIs ( )

Definition at line 52 of file SelfRegistrationTest.php.

52  : void
53  {
54  $instance = new SelfRegistration(
55  'foo',
56  $this->mock(UI::class),
57  $this->mockTree(User::class, ['matchingDocument' => new Ok($this->mock(Document::class))]),
58  $this->mock(Provide::class),
59  fn() => 'rendered',
60  $this->fail(...),
61  $this->mock(...)
62  );
63 
64  $guis = $instance->legacyInputGUIs();
65  $this->assertSame(3, count($guis));
66  }

◆ testSaveLegacyForm()

ILIAS\LegalDocuments\ConsumerToolbox\ConsumerSlots\SelfRegistrationTest::testSaveLegacyForm ( )

Definition at line 68 of file SelfRegistrationTest.php.

68  : void
69  {
70  $instance = new SelfRegistration(
71  'foo',
72  $this->mock(UI::class),
73  $this->mockTree(User::class, ['matchingDocument' => new Ok($this->mock(Document::class))]),
74  $this->mock(Provide::class),
75  $this->fail(...),
76  $this->fail(...),
77  $this->fail(...)
78  );
79 
80  $this->assertTrue($instance->saveLegacyForm($this->mockTree(ilPropertyFormGUI::class, ['getInput' => true])));
81  }

◆ testSaveLegacyFormFailed()

ILIAS\LegalDocuments\ConsumerToolbox\ConsumerSlots\SelfRegistrationTest::testSaveLegacyFormFailed ( )

Definition at line 83 of file SelfRegistrationTest.php.

83  : void
84  {
85  $instance = new SelfRegistration(
86  'foo',
87  $this->mock(UI::class),
88  $this->mockTree(User::class, ['matchingDocument' => new Ok($this->mock(Document::class))]),
89  $this->mock(Provide::class),
90  $this->fail(...),
91  $this->fail(...),
92  $this->fail(...)
93  );
94 
95  $checkbox = $this->mock(ilCheckboxInputGUI::class);
96  $checkbox->expects(self::once())->method('setAlert');
97 
98  $form = $this->mockTree(ilPropertyFormGUI::class, ['getInput' => false]);
99  $form->expects(self::once())->method('getItemByPostVar')->with('accept_foo')->willReturn($checkbox);
100 
101  $this->assertFalse($instance->saveLegacyForm($form));
102  }

◆ testUserCreation()

ILIAS\LegalDocuments\ConsumerToolbox\ConsumerSlots\SelfRegistrationTest::testUserCreation ( )

Definition at line 104 of file SelfRegistrationTest.php.

References ILIAS\LegalDocuments\ConsumerToolbox\ConsumerSlots\SelfRegistration\userCreation().

104  : void
105  {
106  $user = $this->mock(ilObjUser::class);
107  $ldoc_user = $this->mock(User::class);
108  $ldoc_user->expects(self::once())->method('acceptMatchingDocument');
109 
110  $instance = new SelfRegistration(
111  'foo',
112  $this->mock(UI::class),
113  $this->mock(User::class),
114  $this->mock(Provide::class),
115  $this->fail(...),
116  function (ilObjUser $u) use ($user, $ldoc_user): User {
117  $this->assertSame($user, $u);
118  return $ldoc_user;
119  },
120  $this->fail(...)
121  );
122 
123  $instance->userCreation($user);
124  }
+ Here is the call graph for this function:

◆ testUserCreationFailed()

ILIAS\LegalDocuments\ConsumerToolbox\ConsumerSlots\SelfRegistrationTest::testUserCreationFailed ( )

Definition at line 126 of file SelfRegistrationTest.php.

References ILIAS\LegalDocuments\ConsumerToolbox\ConsumerSlots\SelfRegistration\userCreation().

126  : void
127  {
128  $user = $this->mock(ilObjUser::class);
129  $ldoc_user = $this->mock(User::class);
130  $ldoc_user->expects(self::once())->method('acceptMatchingDocument')->willReturnCallback(function () {
131  throw new \ILIAS\Data\NotOKException('This is not ok.');
132  });
133 
134  $ldoc_user->expects(self::once())->method('acceptAnyDocument');
135 
136  $instance = new SelfRegistration(
137  'foo',
138  $this->mock(UI::class),
139  $this->mock(User::class),
140  $this->mock(Provide::class),
141  $this->fail(...),
142  function (ilObjUser $u) use ($user, $ldoc_user): User {
143  $this->assertSame($user, $u);
144  return $ldoc_user;
145  },
146  $this->fail(...)
147  );
148 
149  $instance->userCreation($user);
150  }
+ Here is the call graph for this function:

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