ILIAS  trunk Revision v11.0_alpha-2662-g519ff7d528f
ILIAS\LegalDocuments\ConsumerToolbox\ConsumerSlots\ShowOnLoginPageTest Class Reference
+ Inheritance diagram for ILIAS\LegalDocuments\ConsumerToolbox\ConsumerSlots\ShowOnLoginPageTest:
+ Collaboration diagram for ILIAS\LegalDocuments\ConsumerToolbox\ConsumerSlots\ShowOnLoginPageTest:

Public Member Functions

 testConstruct ()
 
 testInvokeWithoutDocuments ()
 
 testInvoke ()
 

Detailed Description

Definition at line 33 of file ShowOnLoginPageTest.php.

Member Function Documentation

◆ testConstruct()

ILIAS\LegalDocuments\ConsumerToolbox\ConsumerSlots\ShowOnLoginPageTest::testConstruct ( )

Definition at line 37 of file ShowOnLoginPageTest.php.

37  : void
38  {
39  $this->assertInstanceOf(ShowOnLoginPage::class, new ShowOnLoginPage($this->mock(Provide::class), $this->mock(UI::class), $this->fail(...)));
40  }

◆ testInvoke()

ILIAS\LegalDocuments\ConsumerToolbox\ConsumerSlots\ShowOnLoginPageTest::testInvoke ( )

Definition at line 51 of file ShowOnLoginPageTest.php.

References $url.

51  : void
52  {
53  $translated = 'Translated<br/>';
54  $url = 'Dummy URL';
55 
56  $legacy = $this->mock(Legacy\Content::class);
57  $legacy_factory = $this->mock(Legacy\Factory::class);
58  $legacy_factory
59  ->expects($this->once())
60  ->method('content')
61  ->willReturn($legacy);
62 
63 
64  $template = $this->mock(ilTemplate::class);
65  $expected = [
66  ['LABEL', htmlentities($translated)],
67  ['HREF', $url]
68  ];
69  $template
70  ->expects(self::exactly(2))
71  ->method('setVariable')
72  ->willReturnCallback(
73  function (string $k, string $v) use (&$expected) {
74  [$ek, $ev] = array_shift($expected);
75  $this->assertEquals($ek, $k);
76  $this->assertEquals($ev, $v);
77  }
78  );
79 
80  $template->expects(self::once())->method('get')->willReturn('Rendered');
81 
82  $instance = new ShowOnLoginPage($this->mockTree(Provide::class, [
83  'document' => ['repository' => ['countAll' => 1]],
84  'publicPage' => ['url' => $url],
85  ]), $this->mockTree(UI::class, [
86  'txt' => $translated,
87  'create' => $this->mockMethod(UIFactory::class, 'legacy', [], $legacy_factory),
88  ]), fn() => $template);
89 
90  $array = $instance();
91 
92  $this->assertSame(1, count($array));
93  $this->assertSame($legacy, $array[0]);
94  }
$url
Definition: shib_logout.php:68

◆ testInvokeWithoutDocuments()

ILIAS\LegalDocuments\ConsumerToolbox\ConsumerSlots\ShowOnLoginPageTest::testInvokeWithoutDocuments ( )

Definition at line 42 of file ShowOnLoginPageTest.php.

42  : void
43  {
44  $instance = new ShowOnLoginPage($this->mockTree(Provide::class, [
45  'document' => ['repository' => ['countAll' => 0]],
46  ]), $this->mock(UI::class), $this->fail(...));
47 
48  $this->assertSame([], $instance());
49  }

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