ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
PageContentTest.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
24use ILIAS\LegalDocuments\test\ContainerMock;
27use PHPUnit\Framework\TestCase;
30
31require_once __DIR__ . '/../ContainerMock.php';
32
33class PageContentTest extends TestCase
34{
35 use ContainerMock;
36
37 public function testConstruct(): void
38 {
39 $this->assertInstanceOf(PageContent::class, new PageContent('foo', []));
40 }
41
42 public function testRender(): void
43 {
44 $template = $this->mock(ilGlobalTemplateInterface::class);
45 $template->expects(self::once())->method('setTitle')->with('foo');
46 $components = [$this->mock(Component::class), $this->mock(Component::class)];
47 $renderer = $this->mockMethod(Renderer::class, 'render', [$components], 'rendered');
48
49 $instance = new PageContent('foo', $components);
50 $this->assertSame('rendered', $instance->render($template, $renderer));
51 }
52
53 public function testWithOnScreenMessage(): void
54 {
55 $instance = new PageContent('foo', []);
56 $this->assertInstanceOf(ShowOnScreenMessage::class, $instance->withOnScreenMessage('foo', 'bar', true));
57 }
58}
$components
$renderer
A component is the most general form of an entity in the UI.
Definition: Component.php:28
An entity that renders components to a string output.
Definition: Renderer.php:31