ILIAS  trunk Revision v12.0_alpha-16-g3e876e53c80
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)
 @dataProvider provideGetData More...
 
 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 34 of file MailPageTest.php.

Member Function Documentation

◆ getUIFactory()

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

Definition at line 164 of file MailPageTest.php.

165 {
166 return new class () extends NoUIFactory {
167 public function link(): Link\Factory
168 {
169 return new Link\Factory();
170 }
171 };
172 }
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 77 of file MailPageTest.php.

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

◆ setUp()

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

Definition at line 45 of file MailPageTest.php.

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

References factory().

+ Here is the call graph for this function:

◆ testConstruction()

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

Definition at line 69 of file MailPageTest.php.

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

◆ testGet()

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

@dataProvider provideGetData

Definition at line 91 of file MailPageTest.php.

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

◆ testRenderMailPage()

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

Definition at line 99 of file MailPageTest.php.

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

◆ $footer_url

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

Definition at line 43 of file MailPageTest.php.

◆ $html_content

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

Definition at line 42 of file MailPageTest.php.

◆ $installation_title

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

Definition at line 39 of file MailPageTest.php.

◆ $logo

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

Definition at line 38 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 40 of file MailPageTest.php.

◆ $uri

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

Definition at line 41 of file MailPageTest.php.


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