ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\LegalDocuments\test\ConsumerToolbox\RoutingTest Class Reference
+ Inheritance diagram for ILIAS\LegalDocuments\test\ConsumerToolbox\RoutingTest:
+ Collaboration diagram for ILIAS\LegalDocuments\test\ConsumerToolbox\RoutingTest:

Public Member Functions

 testConstruct ()
 
 testCtrl ()
 
 testLogoutUrl ()
 
 testRedirectToStartingPage ()
 
 testRedirectToOriginalTarget ()
 

Detailed Description

Definition at line 32 of file RoutingTest.php.

Member Function Documentation

◆ testConstruct()

ILIAS\LegalDocuments\test\ConsumerToolbox\RoutingTest::testConstruct ( )

Definition at line 36 of file RoutingTest.php.

36 : void
37 {
38 $this->assertInstanceOf(Routing::class, new Routing(
39 $this->mock(ilCtrl::class),
40 $this->mock(SelectSetting::class),
41 $this->fail(...),
42 $this->fail(...)
43 ));
44 }

◆ testCtrl()

ILIAS\LegalDocuments\test\ConsumerToolbox\RoutingTest::testCtrl ( )

Definition at line 46 of file RoutingTest.php.

46 : void
47 {
48 $ctrl = $this->mock(ilCtrl::class);
49 $this->assertSame($ctrl, (new Routing($ctrl, $this->mock(SelectSetting::class), $this->fail(...), $this->fail(...)))->ctrl());
50 }

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ testLogoutUrl()

ILIAS\LegalDocuments\test\ConsumerToolbox\RoutingTest::testLogoutUrl ( )

Definition at line 52 of file RoutingTest.php.

52 : void
53 {
54 $this->assertSame('dummy logout url', (new Routing(
55 $this->mock(ilCtrl::class),
56 $this->mock(SelectSetting::class),
57 $this->fail(...),
58 fn() => 'dummy logout url'
59 ))->logoutUrl());
60 }

◆ testRedirectToOriginalTarget()

ILIAS\LegalDocuments\test\ConsumerToolbox\RoutingTest::testRedirectToOriginalTarget ( )

Definition at line 84 of file RoutingTest.php.

84 : void
85 {
86 $setting = $this->mock(Setting::class);
87 $setting->method('value')->willReturn('some url');
88 $setting->expects(self::once())->method('update')->with(null);
89
90 $session = $this->mock(SelectSetting::class);
91 $session->method('typed')->willReturnCallback(function (string $key, callable $proc) use ($setting) {
92 $this->assertSame('orig_request_target', $key);
93
94 return $setting;
95 });
96
97 $ctrl = $this->mock(ilCtrl::class);
98 $ctrl->expects(self::once())->method('redirectToURL')->with('some url');
99
100 (new Routing(
101 $ctrl,
102 $session,
103 $this->fail(...),
104 $this->fail(...)
105 ))->redirectToOriginalTarget();
106 }
ilSetting $setting
Definition: class.ilias.php:68

References ILIAS\$setting.

◆ testRedirectToStartingPage()

ILIAS\LegalDocuments\test\ConsumerToolbox\RoutingTest::testRedirectToStartingPage ( )

Definition at line 62 of file RoutingTest.php.

62 : void
63 {
64 $called = false;
65
66 $session = $this->mock(SelectSetting::class);
67 $session->expects(self::once())->method('typed')->willReturnCallback(function (string $key, callable $proc) {
68 $this->assertSame('orig_request_target', $key);
69 return $this->mockTree(Setting::class, ['value' => null]);
70 });
71
72 (new Routing(
73 $this->mock(ilCtrl::class),
74 $session,
75 static function () use (&$called): void {
76 $called = true;
77 },
78 $this->fail(...)
79 ))->redirectToOriginalTarget();
80
81 $this->assertTrue($called);
82 }

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