ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 8 of file ComponentRendererLoaderResourceRegistryWrapperTest.php.

References $l, and $r.

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

◆ test_passthrough_getRendererFactory()

ComponentRendererLoaderResourceRegistryWrapperTest::test_passthrough_getRendererFactory ( )

Definition at line 62 of file ComponentRendererLoaderResourceRegistryWrapperTest.php.

References $factory, and $l.

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

◆ test_registerResources()

ComponentRendererLoaderResourceRegistryWrapperTest::test_registerResources ( )

Definition at line 34 of file ComponentRendererLoaderResourceRegistryWrapperTest.php.

References $l, and $r.

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

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