ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ProvidePublicPageTest.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
23use ILIAS\LegalDocuments\test\ContainerMock;
24use PHPUnit\Framework\TestCase;
26use ilCtrl;
27use ilStartUpGUI;
28
29require_once __DIR__ . '/../ContainerMock.php';
30
31class ProvidePublicPageTest extends TestCase
32{
33 use ContainerMock;
34
35 public function testConstruct(): void
36 {
37 $this->assertInstanceOf(ProvidePublicPage::class, new ProvidePublicPage('foo', $this->mock(ilCtrl::class)));
38 }
39
40 public function testUrl(): void
41 {
42 $ctrl = $this->mock(ilCtrl::class);
43 $consecutive = ['foo', ''];
44 $ctrl->expects(self::exactly(2))->method('setParameterByClass')->with(
45 $this->identicalTo(ilStartUpGUI::class),
46 $this->identicalTo('id'),
47 $this->callback(function ($value) use (&$consecutive) {
48 $this->assertSame(array_shift($consecutive), $value);
49 return true;
50 })
51 );
52 $ctrl->expects(self::once())->method('getLinkTargetByClass')->with(ilStartUpGUI::class, 'showLegalDocuments')->willReturn('url');
53
54 $instance = new ProvidePublicPage('foo', $ctrl);
55 $this->assertSame('url', $instance->url());
56 }
57}
Class ilCtrl provides processing control methods.
@ilCtrl_Calls ilStartUpGUI: ilAccountRegistrationGUI, ilPasswordAssistanceGUI, ilLoginPageGUI,...