ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
BundleTest.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
23use ilObjUser;
27use ILIAS\LegalDocuments\test\ContainerMock;
29use PHPUnit\Framework\TestCase;
30
31require_once __DIR__ . '/../../ContainerMock.php';
32
33class BundleTest extends TestCase
34{
35 use ContainerMock;
36
37 public function testConstruct(): void
38 {
39 $this->assertInstanceOf(Bundle::class, new Bundle([]));
40 }
41
42 public function testLegacyInputGUIs(): void
43 {
44 $a = $this->mock(ilFormPropertyGUI::class);
45 $b = $this->mock(ilFormPropertyGUI::class);
46 $c = $this->mock(ilFormPropertyGUI::class);
47
48 $bundle = new Bundle([
49 $this->mockTree(SelfRegistration::class, ['legacyInputGUIs' => [$a]]),
50 $this->mockTree(SelfRegistration::class, ['legacyInputGUIs' => [$b, $c]])
51 ]);
52 $this->assertSame([$a, $b, $c], $bundle->legacyInputGUIs());
53 }
54
55 public function testSaveLegacyForm(): void
56 {
57 $form = $this->mock(ilPropertyFormGUI::class);
58
59 $bundle = new Bundle([
60 $this->mockMethod(SelfRegistration::class, 'saveLegacyForm', [$form], true),
61 $this->mockMethod(SelfRegistration::class, 'saveLegacyForm', [$form], true)
62 ]);
63 $this->assertTrue($bundle->saveLegacyForm($form));
64
65 }
66
67 public function testUserCreation(): void
68 {
69 $user = $this->mock(ilObjUser::class);
70 $self_registration = $this->mock(SelfRegistration::class);
71 $self_registration->expects(self::exactly(2))->method('userCreation')->with($user);
72
73 $bundle = new Bundle([
74 $self_registration,
75 $self_registration,
76 ]);
77
78 $bundle->userCreation($user);
79 }
80}
This class represents a property in a property form.
User class.
This class represents a property form user interface.
$c
Definition: deliver.php:25
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples