ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
PageContentTest.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
30 
31 require_once __DIR__ . '/../ContainerMock.php';
32 
33 class 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 }