ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
ComponentRendererLoaderResourceRegistryWrapperTest Class Reference
+ Inheritance diagram for ComponentRendererLoaderResourceRegistryWrapperTest:
+ Collaboration diagram for ComponentRendererLoaderResourceRegistryWrapperTest:

Public Member Functions

 test_forwards_from_underlying ()
 
 test_registerResources ()
 
 test_passthrough_getRendererFactory ()
 

Detailed Description

Member Function Documentation

◆ test_forwards_from_underlying()

ComponentRendererLoaderResourceRegistryWrapperTest::test_forwards_from_underlying ( )

Definition at line 9 of file ComponentRendererLoaderResourceRegistryWrapperTest.php.

References $context.

10  {
11  $underlying = $this->getMockBuilder(\ILIAS\UI\Implementation\Render\Loader::class)
12  ->setMethods(["getRendererFor", "getRendererFactoryFor"])
13  ->getMock();
14 
15  $renderer = $this->getMockBuilder(\ILIAS\UI\Implementation\Render\ComponentRenderer::class)
16  ->setMethods(["registerResources", "render"])
17  ->getMock();
18  $component = $this->getMockBuilder(\ILIAS\UI\Component\Component::class)->getMock();
19  $context = ["a", "b"];
20  $underlying
21  ->expects($this->once())
22  ->method("getRendererFor")
23  ->with($component, $context)
24  ->willReturn($renderer);
25 
26  $registry = $this->getMockBuilder(\ILIAS\UI\Implementation\Render\ResourceRegistry::class)
27  ->getMock();
28 
29  $l = new \ILIAS\UI\Implementation\Render\LoaderResourceRegistryWrapper($registry, $underlying);
30  $r = $l->getRendererFor($component, $context);
31 
32  $this->assertSame($renderer, $r);
33  }
$context
Definition: webdav.php:26
Class Factory.
Class ChatMainBarProvider .

◆ test_passthrough_getRendererFactory()

ComponentRendererLoaderResourceRegistryWrapperTest::test_passthrough_getRendererFactory ( )

Definition at line 63 of file ComponentRendererLoaderResourceRegistryWrapperTest.php.

References $factory.

64  {
65  $underlying = $this->getMockBuilder(\ILIAS\UI\Implementation\Render\Loader::class)
66  ->setMethods(["getRendererFor", "getRendererFactoryFor"])
67  ->getMock();
68 
69  $c1 = $this->createMock(\ILIAS\UI\Component\Component::class);
70 
71  $factory = "FACTORY";
72  $underlying
73  ->expects($this->exactly(1))
74  ->method("getRendererFactoryFor")
75  ->with($c1)
76  ->willReturn($factory);
77 
78  $l = new \ILIAS\UI\Implementation\Render\LoaderCachingWrapper($underlying);
79 
80  $this->assertSame($factory, $l->getRendererFactoryFor($c1));
81  }
Class Factory.
Class ChatMainBarProvider .
$factory
Definition: metadata.php:58

◆ test_registerResources()

ComponentRendererLoaderResourceRegistryWrapperTest::test_registerResources ( )

Definition at line 35 of file ComponentRendererLoaderResourceRegistryWrapperTest.php.

36  {
37  $underlying = $this->getMockBuilder(\ILIAS\UI\Implementation\Render\Loader::class)
38  ->setMethods(["getRendererFor", "getRendererFactoryFor"])
39  ->getMock();
40 
41  $renderer = $this->getMockBuilder(\ILIAS\UI\Implementation\Render\ComponentRenderer::class)
42  ->setMethods(["registerResources", "render"])
43  ->getMock();
44  $component = $this->getMockBuilder(\ILIAS\UI\Component\Component::class)->getMock();
45  $underlying
46  ->expects($this->once())
47  ->method("getRendererFor")
48  ->with($component, [])
49  ->willReturn($renderer);
50 
51  $registry = $this->getMockBuilder(\ILIAS\UI\Implementation\Render\ResourceRegistry::class)
52  ->getMock();
53 
54  $renderer
55  ->expects($this->once())
56  ->method("registerResources")
57  ->with($registry);
58 
59  $l = new \ILIAS\UI\Implementation\Render\LoaderResourceRegistryWrapper($registry, $underlying);
60  $r = $l->getRendererFor($component, []);
61  }
Class Factory.
Class ChatMainBarProvider .

The documentation for this class was generated from the following file: