ILIAS  trunk Revision v11.0_alpha-1866-gfa368f7776e
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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.

References $container.

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 
67  $instance = new Consumer($container);
68 
69  $this->assertSame($slot, $instance->uses($slot, $this->mock(LazyProvide::class)));
70  }
$container
Definition: wac.php:36

◆ testId()

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

Definition at line 45 of file ConsumerTest.php.

References ILIAS\DataProtection\Consumer\ID.

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

◆ testUses()

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

Definition at line 105 of file ConsumerTest.php.

References $container.

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

◆ testUsesWithoutAcceptance()

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

Definition at line 72 of file ConsumerTest.php.

References $container.

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

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