19 declare(strict_types=1);
34 require_once __DIR__ .
'/bootstrap.php';
42 $this->assertInstanceOf(Consumer::class,
new Consumer($this->mock(Container::class)));
52 $by_trying = $this->mockTree(ByTrying::class, [
'transform' =>
false]);
53 $settings = $this->mockMethod(ilSetting::class,
'get', [
'dpro_enabled',
''],
'false');
55 $container = $this->mockTree(Container::class, [
57 'refinery' => [
'byTrying' => $by_trying],
59 $container->method(
'offsetGet')->with(
'ilObjDataCache')->willReturn($this->mock(ilObjectDataCache::class));
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);
69 $this->assertSame($slot, $instance->uses($slot, $this->mock(LazyProvide::class)));
74 $by_trying = $this->mockTree(ByTrying::class, [
'transform' =>
true]);
75 $settings = $this->mock(ilSetting::class);
76 $settings->method(
'get')->withConsecutive([
'dpro_enabled',
''], [
'dpro_no_acceptance',
''])->willReturn(
'true');
78 $container = $this->mockTree(Container::class, [
80 'refinery' => [
'byTrying' => $by_trying],
81 'ctrl' => $this->mock(ilCtrl::class),
83 $container->method(
'offsetGet')->with(
'ilObjDataCache')->willReturn($this->mock(ilObjectDataCache::class));
85 $slot = $this->mock(UseSlot::class);
86 $slot->expects(self::once())->method(
'hasDocuments')->willReturn($slot);
87 $slot->expects(self::once())->method(
'hasHistory')->willReturn($slot);
88 $slot->expects(self::once())->method(
'showOnLoginPage')->willReturn($slot);
89 $slot->expects(self::once())->method(
'showInFooter')->willReturn($slot);
90 $slot->expects(self::once())->method(
'hasPublicPage')->willReturn($slot);
91 $slot->expects(self::once())->method(
'hasPublicApi')->willReturn($slot);
95 $this->assertSame($slot, $instance->uses($slot, $this->mock(LazyProvide::class)));
100 $by_trying = $this->mock(ByTrying::class);
101 $by_trying->method(
'transform')->willReturnOnConsecutiveCalls(
true,
false);
103 $settings = $this->mock(ilSetting::class);
104 $settings->method(
'get')->withConsecutive([
'dpro_enabled',
''], [
'dpro_no_acceptance',
''])->willReturnOnConsecutiveCalls(
'true',
'false');
106 $container = $this->mockTree(Container::class, [
108 'refinery' => [
'byTrying' => $by_trying],
109 'ctrl' => $this->mock(ilCtrl::class),
111 $container->method(
'offsetGet')->with(
'ilObjDataCache')->willReturn($this->mock(ilObjectDataCache::class));
113 $slot = $this->mock(UseSlot::class);
114 $slot->expects(self::once())->method(
'hasDocuments')->willReturn($slot);
115 $slot->expects(self::once())->method(
'hasHistory')->willReturn($slot);
116 $slot->expects(self::once())->method(
'showOnLoginPage')->willReturn($slot);
117 $slot->expects(self::once())->method(
'canWithdraw')->willReturn($slot);
118 $slot->expects(self::once())->method(
'hasAgreement')->willReturn($slot);
119 $slot->expects(self::once())->method(
'showInFooter')->willReturn($slot);
120 $slot->expects(self::once())->method(
'onSelfRegistration')->willReturn($slot);
121 $slot->expects(self::once())->method(
'hasOnlineStatusFilter')->willReturn($slot);
122 $slot->expects(self::once())->method(
'hasUserManagementFields')->willReturn($slot);
123 $slot->expects(self::once())->method(
'hasPublicApi')->willReturn($slot);
124 $slot->expects(self::once())->method(
'canReadInternalMails')->willReturn($slot);
125 $slot->expects(self::once())->method(
'canUseSoapApi')->willReturn($slot);
129 $this->assertSame($slot, $instance->uses($slot, $this->mock(LazyProvide::class)));
testUsesWithoutAcceptance()