ILIAS  trunk Revision v11.0_alpha-1769-g99a433fe2dc
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ProvidePublicPageTest.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
26 use ilCtrl;
27 use ilStartUpGUI;
28 
29 require_once __DIR__ . '/../ContainerMock.php';
30 
31 class 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 }