ILIAS  trunk Revision v12.0_alpha-1221-g4e438232683
ILIAS\DataProtection\test\ConsumerTest Class Reference
+ Inheritance diagram for ILIAS\DataProtection\test\ConsumerTest:
+ Collaboration diagram for ILIAS\DataProtection\test\ConsumerTest:

Public Member Functions

 testConstruct ()
 
 testId ()
 
 testDisabledUses ()
 
 testUsesWithoutAcceptance ()
 
 testUses ()
 

Detailed Description

Definition at line 36 of file ConsumerTest.php.

Member Function Documentation

◆ testConstruct()

ILIAS\DataProtection\test\ConsumerTest::testConstruct ( )

Definition at line 40 of file ConsumerTest.php.

40 : void
41 {
42 $this->assertInstanceOf(Consumer::class, new Consumer($this->mock(Container::class)));
43 }

◆ testDisabledUses()

ILIAS\DataProtection\test\ConsumerTest::testDisabledUses ( )

Definition at line 50 of file ConsumerTest.php.

50 : void
51 {
52 $by_trying = $this->mockTree(ByTrying::class, ['transform' => false]);
53 $settings = $this->mockMethod(ilSetting::class, 'get', ['dpro_enabled', ''], 'false');
54
55 $container = $this->mockTree(Container::class, [
56 'settings' => $settings,
57 'refinery' => ['byTrying' => $by_trying],
58 ]);
59 $container->method('offsetGet')->with('ilObjDataCache')->willReturn($this->mock(ilObjectDataCache::class));
60
61 $slot = $this->mock(UseSlot::class);
62 $slot->expects(self::once())->method('hasDocuments')->willReturn($slot);
63 $slot->expects(self::once())->method('hasHistory')->willReturn($slot);
64 $slot->expects(self::once())->method('hasPublicApi')->willReturn($slot);
65 $slot->expects(self::once())->method('hasPublicPage')->willReturn($slot);
66 $slot->expects(self::once())->method('showInFooter')->willReturn($slot);
67
68 $instance = new Consumer($container);
69
70 $this->assertSame($slot, $instance->uses($slot, $this->mock(LazyProvide::class)));
71 }
$container
@noRector
Definition: wac.php:37

References $container.

◆ testId()

ILIAS\DataProtection\test\ConsumerTest::testId ( )

Definition at line 45 of file ConsumerTest.php.

45 : void
46 {
47 $this->assertSame(Consumer::ID, (new Consumer($this->mock(Container::class)))->id());
48 }

References ILIAS\DataProtection\Consumer\ID.

◆ testUses()

ILIAS\DataProtection\test\ConsumerTest::testUses ( )

Definition at line 106 of file ConsumerTest.php.

106 : void
107 {
108 $by_trying = $this->mock(ByTrying::class);
109 $by_trying->method('transform')->willReturnOnConsecutiveCalls(true, false);
110
111 $settings = $this->mock(ilSetting::class);
112 $consecutive = ['dpro_enabled', 'dpro_no_acceptance'];
113 $settings->method('get')->with(
114 $this->callback(function ($value) use (&$consecutive) {
115 $this->assertSame(array_shift($consecutive), $value);
116 return true;
117 }),
118 $this->identicalTo('')
119 )->willReturnOnConsecutiveCalls('true', 'false');
120
121 $container = $this->mockTree(Container::class, [
122 'settings' => $settings,
123 'refinery' => ['byTrying' => $by_trying],
124 'ctrl' => $this->mock(ilCtrl::class),
125 ]);
126 $container->method('offsetGet')->with('ilObjDataCache')->willReturn($this->mock(ilObjectDataCache::class));
127
128 $slot = $this->mock(UseSlot::class);
129 $slot->expects(self::once())->method('hasDocuments')->willReturn($slot);
130 $slot->expects(self::once())->method('hasHistory')->willReturn($slot);
131 $slot->expects(self::once())->method('showOnLoginPage')->willReturn($slot);
132 $slot->expects(self::once())->method('canWithdraw')->willReturn($slot);
133 $slot->expects(self::once())->method('hasAgreement')->willReturn($slot);
134 $slot->expects(self::once())->method('showInFooter')->willReturn($slot);
135 $slot->expects(self::once())->method('onSelfRegistration')->willReturn($slot);
136 $slot->expects(self::once())->method('hasOnlineStatusFilter')->willReturn($slot);
137 $slot->expects(self::once())->method('hasUserManagementFields')->willReturn($slot);
138 $slot->expects(self::once())->method('hasPublicApi')->willReturn($slot);
139 $slot->expects(self::once())->method('canReadInternalMails')->willReturn($slot);
140 $slot->expects(self::once())->method('canUseSoapApi')->willReturn($slot);
141
142 $instance = new Consumer($container);
143
144 $this->assertSame($slot, $instance->uses($slot, $this->mock(LazyProvide::class)));
145 }

References $container.

◆ testUsesWithoutAcceptance()

ILIAS\DataProtection\test\ConsumerTest::testUsesWithoutAcceptance ( )

Definition at line 73 of file ConsumerTest.php.

73 : void
74 {
75 $by_trying = $this->mockTree(ByTrying::class, ['transform' => true]);
76 $settings = $this->mock(ilSetting::class);
77 $consecutive = ['dpro_enabled', 'dpro_no_acceptance'];
78 $settings->method('get')->with(
79 $this->callback(function ($value) use (&$consecutive) {
80 $this->assertSame(array_shift($consecutive), $value);
81 return true;
82 }),
83 $this->identicalTo('')
84 )->willReturn('true');
85
86 $container = $this->mockTree(Container::class, [
87 'settings' => $settings,
88 'refinery' => ['byTrying' => $by_trying],
89 'ctrl' => $this->mock(ilCtrl::class),
90 ]);
91 $container->method('offsetGet')->with('ilObjDataCache')->willReturn($this->mock(ilObjectDataCache::class));
92
93 $slot = $this->mock(UseSlot::class);
94 $slot->expects(self::once())->method('hasDocuments')->willReturn($slot);
95 $slot->expects(self::once())->method('hasHistory')->willReturn($slot);
96 $slot->expects(self::once())->method('showOnLoginPage')->willReturn($slot);
97 $slot->expects(self::once())->method('showInFooter')->willReturn($slot);
98 $slot->expects(self::once())->method('hasPublicPage')->willReturn($slot);
99 $slot->expects(self::once())->method('hasPublicApi')->willReturn($slot);
100
101 $instance = new Consumer($container);
102
103 $this->assertSame($slot, $instance->uses($slot, $this->mock(LazyProvide::class)));
104 }

References $container.


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