Skip to content

Commit a208226

Browse files
committed
Test case updated with if content NULL & fixed health check issue
1 parent 6220474 commit a208226

File tree

1 file changed

+26
-7
lines changed

1 file changed

+26
-7
lines changed

app/code/Magento/Theme/Test/Unit/Controller/Result/JsFooterPluginTest.php

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ protected function setUp(): void
5959
}
6060

6161
/**
62-
* Data Provider for beforeSendResponse()
62+
* Data Provider for testBeforeSendResponse()
6363
*
6464
* @return array
6565
*/
@@ -68,14 +68,14 @@ public function sendResponseDataProvider(): array
6868
return [
6969
[
7070
"content" => "<body><h1>Test Title</h1>" .
71-
"<script text=\"text/javascript\">test</script>" .
72-
"<script text=\"text/x-magento-template\">test</script>" .
71+
"<script type=\"text/x-magento-init\">test</script>" .
72+
"<script type=\"text/x-magento-template\">test</script>" .
7373
"<p>Test Content</p></body>",
7474
"flag" => true,
7575
"result" => "<body><h1>Test Title</h1>" .
76-
"<script text=\"text/x-magento-template\">test</script>" .
76+
"<script type=\"text/x-magento-template\">test</script>" .
7777
"<p>Test Content</p>" .
78-
"<script text=\"text/javascript\">test</script>" .
78+
"<script type=\"text/x-magento-init\">test</script>" .
7979
"\n</body>"
8080
],
8181
[
@@ -121,16 +121,35 @@ public function testBeforeSendResponse($content, $isSetFlag, $result): void
121121
$this->plugin->beforeSendResponse($this->httpMock);
122122
}
123123

124+
/**
125+
* Data Provider for testBeforeSendResponseIfGetContentIsNotAString()
126+
*
127+
* @return array
128+
*/
129+
public function ifGetContentIsNotAStringDataProvider(): array
130+
{
131+
return [
132+
[
133+
'content' => []
134+
],
135+
[
136+
'content' => NULL
137+
]
138+
];
139+
}
140+
124141
/**
125142
* Test BeforeSendResponse if content is not a string
126143
*
144+
* @param string $content
127145
* @return void
146+
* @dataProvider ifGetContentIsNotAStringDataProvider
128147
*/
129-
public function testBeforeSendResponseIfGetContentIsNotAString(): void
148+
public function testBeforeSendResponseIfGetContentIsNotAString($content): void
130149
{
131150
$this->httpMock->expects($this->once())
132151
->method('getContent')
133-
->willReturn([]);
152+
->willReturn($content);
134153

135154
$this->scopeConfigMock->expects($this->never())
136155
->method('isSetFlag')

0 commit comments

Comments
 (0)