19 declare(strict_types=1);
35 protected function setUp(): void
43 $mocked_observer = $this->createMock(ilCtrlObserver::class);
44 $mocked_subject = $this->createMock(ilCtrlSubject::class);
46 $mocked_subject->expects($this->once())
50 $mocked_ilctrl->attachObserver($mocked_observer);
52 $mocked_subject->expects($this->once())
55 $mocked_ilctrl->detachObserver($mocked_observer);
58 $mocked_observer = $this->createMock(ilCtrlObserver::class);
59 $mocked_subject = $this->createMock(ilCtrlSubject::class);
61 $mocked_subject->expects($this->once())
63 ->with($mocked_observer, ilCtrlEvent::COMMAND_CLASS_FORWARD);
65 $mocked_ilctrl->attachObserver($mocked_observer, ilCtrlEvent::COMMAND_CLASS_FORWARD);
67 $mocked_subject->expects($this->once())
69 ->with($mocked_observer, ilCtrlEvent::COMMAND_CLASS_FORWARD);
70 $mocked_ilctrl->detachObserver($mocked_observer, ilCtrlEvent::COMMAND_CLASS_FORWARD);
73 $mocked_observer = $this->createMock(ilCtrlObserver::class);
74 $mocked_subject = $this->createMock(ilCtrlSubject::class);
76 $mocked_subject->expects($this->once())
78 ->with($mocked_observer, ilCtrlEvent::COMMAND_DETERMINATION);
80 $mocked_ilctrl->attachObserver($mocked_observer, ilCtrlEvent::COMMAND_DETERMINATION);
82 $mocked_subject->expects($this->once())
84 ->with($mocked_observer, ilCtrlEvent::COMMAND_DETERMINATION);
85 $mocked_ilctrl->detachObserver($mocked_observer, ilCtrlEvent::COMMAND_DETERMINATION);
90 require_once __DIR__ .
'/Data/GUI/class.ilCtrlBaseClass1TestGUI.php';
95 $mocked_observer = $this->createMock(ilCtrlObserver::class);
98 [ilCtrlEvent::COMMAND_CLASS_FORWARD, ilCtrlBaseClass1TestGUI::class],
99 [ilCtrlEvent::COMMAND_DETERMINATION,
'fallback']
102 ->expects($this->exactly(2))
104 ->willReturnCallback(
105 function ($event, $cmd) use (&$consecutive) {
106 $expected = array_shift($consecutive);
107 $this->assertEquals($expected, [$event, $cmd]);
111 $mocked_ilctrl->forwardCommand($base_class);
112 $command = $mocked_ilctrl->getCmd(
'fallback');
122 $this->createMock(ilCtrlStructureInterface::class),
123 $this->createMock(ilCtrlTokenRepositoryInterface::class),
124 $this->createMock(ilCtrlPathFactoryInterface::class),
125 $this->createMock(ilCtrlContextInterface::class),
126 $this->createMock(ResponseSenderStrategy::class),
127 $this->createMock(ServerRequestInterface::class),
128 $this->createMock(RequestWrapper::class),
129 $this->createMock(RequestWrapper::class),
130 $this->createMock(Refinery::class),
131 $this->createMock(ilComponentFactory::class),
132 $subject ?? $this->subject,
133 $this->createMock(ilCtrlQueryParserInterface::class),
getMockedCtrl(?ilCtrlSubject $subject=null)
Helper function that returns an ilCtrl instance with mocked dependencies.
event string being used if
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
Class ilCtrlBaseClass1TestGUI.