ILIAS  trunk Revision v12.0_alpha-1221-g4e438232683
Component\Layout\Page\MailPageTest Class Reference
+ Inheritance diagram for Component\Layout\Page\MailPageTest:
+ Collaboration diagram for Component\Layout\Page\MailPageTest:

Public Member Functions

 setUp ()
 
 testConstruction ()
 
 testGet (mixed $expected, string $method_to_call, string $assert_method)
 
 testRenderMailPage ()
 
 getUIFactory ()
 

Static Public Member Functions

static provideGetData ()
 

Protected Attributes

Page Mail $mailpage
 
Page Factory $factory
 
string $logo
 
string $installation_title
 
string $stylesheet_path
 
URI $uri
 
Content $html_content
 
DataLink $footer_url
 

Detailed Description

Definition at line 35 of file MailPageTest.php.

Member Function Documentation

◆ getUIFactory()

Component\Layout\Page\MailPageTest::getUIFactory ( )

Definition at line 163 of file MailPageTest.php.

164 {
165 return new class () extends NoUIFactory {
166 public function link(): Link\Factory
167 {
168 return new Link\Factory();
169 }
170 };
171 }
link(string $caption, string $href, bool $new_viewport=false)

References ILIAS\Repository\link().

+ Here is the call graph for this function:

◆ provideGetData()

static Component\Layout\Page\MailPageTest::provideGetData ( )
static

Definition at line 78 of file MailPageTest.php.

78 : array
79 {
80 return [
81 ['html_content', 'getContent', 'assertContains'],
82 ['logo', 'getLogoURL', 'assertEquals'],
83 ['installation_title', 'getInstallationTitle', 'assertEquals'],
84 ['stylesheet_path', 'getStyleSheetPath', 'assertEquals'],
85 ['footer_url', 'getFooterURL', 'assertEquals'],
86 ];
87 }

◆ setUp()

Component\Layout\Page\MailPageTest::setUp ( )

Definition at line 46 of file MailPageTest.php.

46 : void
47 {
48 $this->html_content = $this->createMock(Content::class);
49 $this->html_content->method('getContent')->willReturn('ILIAS HTML Content');
50
51 $this->logo = 'cid:ILIAS Logo';
52 $this->installation_title = 'ILIAS Installation Title';
53 $this->stylesheet_path = __FILE__;
54 $this->uri = $this->createMock(URI::class);
55 $this->uri->method('getBaseURI')->willReturn('ILIAS Link URI');
56 $this->footer_url = $this->createMock(DataLink::class);
57 $this->footer_url->method('getLabel')->willReturn('ILIAS Link Label');
58 $this->footer_url->method('getURL')->willReturn($this->uri);
59
60 $this->factory = new Page\Factory();
61 $this->mailpage = $this->factory->mail(
62 $this->stylesheet_path,
63 $this->logo,
64 $this->installation_title,
65 $this->html_content,
66 $this->footer_url,
67 );
68 }
factory()

References factory().

+ Here is the call graph for this function:

◆ testConstruction()

Component\Layout\Page\MailPageTest::testConstruction ( )

Definition at line 70 of file MailPageTest.php.

70 : void
71 {
72 static::assertInstanceOf(
73 Page\Mail::class,
74 $this->mailpage,
75 );
76 }

◆ testGet()

Component\Layout\Page\MailPageTest::testGet ( mixed  $expected,
string  $method_to_call,
string  $assert_method 
)

Definition at line 90 of file MailPageTest.php.

90 : void
91 {
92 static::$assert_method(
93 $this->$expected,
94 $this->mailpage->$method_to_call(),
95 );
96 }

◆ testRenderMailPage()

Component\Layout\Page\MailPageTest::testRenderMailPage ( )

Definition at line 98 of file MailPageTest.php.

98 : void
99 {
100 $renderer = $this->getDefaultRenderer(null, [$this->html_content]);
101 $mailpage = $this->factory->mail(
102 $this->stylesheet_path,
103 $this->logo,
104 $this->installation_title,
105 $this->html_content,
106 $this->footer_url,
107 );
108
109 $html = $this->brutallyTrimHTML($renderer->render($mailpage));
110 $expected = $this->brutallyTrimHTML('
111<body>
112<table class="table">
113 <tr class="header">
114 <td class="spacing">
115 <table class="w-750 center">
116 <tr class="rowheight"></tr>
117 <tr>
118 <td class="image-data">
119 <img class="logo" src="' . $this->logo . '" alt="Logo">
120 </td>
121 <td class="installation-text">
122 <span>
123 <strong>' . $this->installation_title . '</strong>
124 </span>
125 </td>
126 </tr>
127 <tr class="rowheight"></tr>
128 </table>
129 </td>
130 </tr>
131 <tr class="content">
132 <td class="spacing">
133 <table class="w-750 center">
134 <tr class="headerheight"></tr>
135 <tr>
136 <td class="font-definition">
137 ' . $renderer->render($this->html_content) . '
138 </td>
139 </tr>
140 <tr class="headerheight"></tr>
141 </table>
142 </td>
143 </tr>
144 <tr class="footer">
145 <td class="spacing">
146 <table class="w-750 center">
147 <tr>
148 <td class="font-definition">
149 <span>' . $this->installation_title . '</span>
150 <br>
151 <a href="ILIAS Link URI">ILIAS Link Label</a>
152 </td>
153 </tr>
154 </table>
155 </td>
156 </tr>
157</table>
158</body>');
159
160 static::assertStringContainsString($expected, $html);
161 }
$renderer

References Component\Layout\Page\MailPageTest\$mailpage, $renderer, and factory().

+ Here is the call graph for this function:

Field Documentation

◆ $factory

Page Factory Component\Layout\Page\MailPageTest::$factory
protected

Definition at line 38 of file MailPageTest.php.

◆ $footer_url

DataLink Component\Layout\Page\MailPageTest::$footer_url
protected

Definition at line 44 of file MailPageTest.php.

◆ $html_content

Content Component\Layout\Page\MailPageTest::$html_content
protected

Definition at line 43 of file MailPageTest.php.

◆ $installation_title

string Component\Layout\Page\MailPageTest::$installation_title
protected

Definition at line 40 of file MailPageTest.php.

◆ $logo

string Component\Layout\Page\MailPageTest::$logo
protected

Definition at line 39 of file MailPageTest.php.

◆ $mailpage

Page Mail Component\Layout\Page\MailPageTest::$mailpage
protected

◆ $stylesheet_path

string Component\Layout\Page\MailPageTest::$stylesheet_path
protected

Definition at line 41 of file MailPageTest.php.

◆ $uri

URI Component\Layout\Page\MailPageTest::$uri
protected

Definition at line 42 of file MailPageTest.php.


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