ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\LegalDocuments\test\Legacy\ConfirmationTest Class Reference
+ Inheritance diagram for ILIAS\LegalDocuments\test\Legacy\ConfirmationTest:
+ Collaboration diagram for ILIAS\LegalDocuments\test\Legacy\ConfirmationTest:

Public Member Functions

 testConstruct ()
 
 testRender ()
 

Private Member Functions

 confirmationGUIReplacement ()
 

Detailed Description

Definition at line 30 of file ConfirmationTest.php.

Member Function Documentation

◆ confirmationGUIReplacement()

ILIAS\LegalDocuments\test\Legacy\ConfirmationTest::confirmationGUIReplacement ( )
private

Definition at line 60 of file ConfirmationTest.php.

60 : object
61 {
62 return new class () {
63 public string $link;
64 public string $confirm_command;
65 public string $cancel_command;
66 public string $header_text;
67 public array $items = [];
68 public string $cancel_label;
69 public string $submit_label;
70 public string $submit_command;
71
72 public function setFormAction(string $link): void
73 {
74 $this->link = $link;
75 }
76 public function setConfirm(string $label, string $command): void
77 {
78 $this->submit_label = $label;
79 $this->submit_command = $command;
80 }
81 public function setCancel(string $label, string $command): void
82 {
83 $this->cancel_label = $label;
84 $this->cancel_command = $command;
85 }
86 public function setHeaderText(string $text): void
87 {
88 $this->header_text = $text;
89 }
90 public function addItem(string $a, string $b, string $c): void
91 {
92 $this->items[] = [$a, $b, $c];
93 }
94 public function getHTML(): string
95 {
96 return 'rendered string';
97 }
98 };
99 }
$c
Definition: deliver.php:25
link(string $caption, string $href, bool $new_viewport=false)
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples

References Vendor\Package\$a, Vendor\Package\$b, $c, and ILIAS\Repository\link().

Referenced by ILIAS\LegalDocuments\test\Legacy\ConfirmationTest\testRender().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ testConstruct()

ILIAS\LegalDocuments\test\Legacy\ConfirmationTest::testConstruct ( )

Definition at line 34 of file ConfirmationTest.php.

34 : void
35 {
36 $this->assertInstanceOf(Confirmation::class, new Confirmation($this->mock(ilLanguage::class), $this->fail(...)));
37 }

◆ testRender()

ILIAS\LegalDocuments\test\Legacy\ConfirmationTest::testRender ( )

Definition at line 39 of file ConfirmationTest.php.

39 : void
40 {
41 $confirmation = $this->confirmationGUIReplacement();
42 $language = $this->mock(ilLanguage::class);
43 $language->expects(self::exactly(2))->method('txt')->willReturnCallback(static fn(string $key): string => 'translated ' . $key);
44
45 $instance = new Confirmation($language, static fn() => $confirmation);
46 $this->assertSame('rendered string', $instance->render('dummy link', 'submit', 'cancel', 'Hi', [
47 'foo' => 'bar',
48 7 => 'baz',
49 ]));
50
51 $this->assertSame('dummy link', $confirmation->link);
52 $this->assertSame('submit', $confirmation->submit_command);
53 $this->assertSame('cancel', $confirmation->cancel_command);
54 $this->assertSame('translated confirm', $confirmation->submit_label);
55 $this->assertSame('translated cancel', $confirmation->cancel_label);
56 $this->assertSame('Hi', $confirmation->header_text);
57 $this->assertSame([['ids[]', 'foo', 'bar'], ['ids[]', '7', 'baz']], $confirmation->items);
58 }

References ILIAS\LegalDocuments\test\Legacy\ConfirmationTest\confirmationGUIReplacement().

+ Here is the call graph for this function:

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