ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ComponentRendererLoaderResourceRegistryWrapperTest Class Reference
+ Inheritance diagram for ComponentRendererLoaderResourceRegistryWrapperTest:
+ Collaboration diagram for ComponentRendererLoaderResourceRegistryWrapperTest:

Public Member Functions

 testForwardsFromUnderlying ()
 
 testRegisterResources ()
 
 testPassthroughGetRendererFactory ()
 

Detailed Description

Member Function Documentation

◆ testForwardsFromUnderlying()

ComponentRendererLoaderResourceRegistryWrapperTest::testForwardsFromUnderlying ( )

Definition at line 32 of file ComponentRendererLoaderResourceRegistryWrapperTest.php.

32 : void
33 {
34 $underlying = $this->getMockBuilder(\ILIAS\UI\Implementation\Render\Loader::class)
35 ->onlyMethods(["getRendererFor", "getRendererFactoryFor"])
36 ->getMock();
37
38 $renderer = $this->getMockBuilder(\ILIAS\UI\Implementation\Render\ComponentRenderer::class)
39 ->onlyMethods(["registerResources", "render"])
40 ->getMock();
41 $component = $this->getMockBuilder(Component::class)->getMock();
42 $context = ["a", "b"];
43 $underlying
44 ->expects($this->once())
45 ->method("getRendererFor")
46 ->with($component, $context)
47 ->willReturn($renderer);
48
49 $registry = $this->getMockBuilder(ResourceRegistry::class)
50 ->getMock();
51
52 $l = new LoaderResourceRegistryWrapper($registry, $underlying);
53 $r = $l->getRendererFor($component, $context);
54
55 $this->assertSame($renderer, $r);
56 }
$renderer
Registers resources for retreived renderers at a ResourceRegistry.
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.
$context
Definition: webdav.php:31

References $context, and $renderer.

◆ testPassthroughGetRendererFactory()

ComponentRendererLoaderResourceRegistryWrapperTest::testPassthroughGetRendererFactory ( )

Definition at line 86 of file ComponentRendererLoaderResourceRegistryWrapperTest.php.

86 : void
87 {
88 $underlying = $this->getMockBuilder(\ILIAS\UI\Implementation\Render\Loader::class)
89 ->onlyMethods(["getRendererFor", "getRendererFactoryFor"])
90 ->getMock();
91
92 $c1 = $this->createMock(Component::class);
93
94 $factory = $this->createMock(RendererFactory::class);
95 $underlying
96 ->expects($this->exactly(1))
97 ->method("getRendererFactoryFor")
98 ->with($c1)
99 ->willReturn($factory);
100
101 $l = new LoaderCachingWrapper($underlying);
102
103 $this->assertSame($factory, $l->getRendererFactoryFor($c1));
104 }
Caches renderers loaded by another loader.

◆ testRegisterResources()

ComponentRendererLoaderResourceRegistryWrapperTest::testRegisterResources ( )

Definition at line 58 of file ComponentRendererLoaderResourceRegistryWrapperTest.php.

58 : void
59 {
60 $underlying = $this->getMockBuilder(\ILIAS\UI\Implementation\Render\Loader::class)
61 ->onlyMethods(["getRendererFor", "getRendererFactoryFor"])
62 ->getMock();
63
64 $renderer = $this->getMockBuilder(\ILIAS\UI\Implementation\Render\ComponentRenderer::class)
65 ->onlyMethods(["registerResources", "render"])
66 ->getMock();
67 $component = $this->getMockBuilder(Component::class)->getMock();
68 $underlying
69 ->expects($this->once())
70 ->method("getRendererFor")
71 ->with($component, [])
72 ->willReturn($renderer);
73
74 $registry = $this->getMockBuilder(ResourceRegistry::class)
75 ->getMock();
76
78 ->expects($this->once())
79 ->method("registerResources")
80 ->with($registry);
81
82 $l = new LoaderResourceRegistryWrapper($registry, $underlying);
83 $l->getRendererFor($component, []);
84 }

References $renderer.


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