1313use PHPUnit \Framework \MockObject \MockObject ;
1414use PHPUnit \Framework \TestCase ;
1515
16+ /**
17+ * Test for BrowserMonitoringFooterJs ViewModel
18+ *
19+ * @covers \Magento\NewRelicReporting\ViewModel\BrowserMonitoringFooterJs
20+ */
1621class BrowserMonitoringFooterJsTest extends TestCase
1722{
1823 /**
@@ -47,8 +52,8 @@ public static function getContentDataProvider(): array
4752 {
4853 return [
4954 'enabled_with_content ' => [true ,
50- '<script>/* NewRelic Footer code */ </script> ' ,
51- '<script>/* NewRelic Footer code */ </script> '
55+ '<script type="text/x-magento-init">{"*":{"newRelicFooter":{"enabled":true}}} </script> ' ,
56+ '<script type="text/x-magento-init">{"*":{"newRelicFooter":{"enabled":true}}} </script> '
5257 ],
5358 'enabled_with_null ' => [true , null , null ],
5459 'enabled_with_empty ' => [true , '' , '' ],
@@ -70,7 +75,8 @@ public function testGetContent(bool $isEnabled, ?string $footerContent, ?string
7075 $ this ->newRelicWrapperMock ->method ('isAutoInstrumentEnabled ' )->willReturn ($ isEnabled );
7176
7277 if ($ isEnabled ) {
73- $ this ->newRelicWrapperMock ->method ('getBrowserTimingFooter ' )->with (false )->willReturn ($ footerContent );
78+ $ this ->newRelicWrapperMock ->method ('getBrowserTimingFooter ' )
79+ ->with (false )->willReturn ($ footerContent );
7480 }
7581
7682 $ this ->assertEquals ($ expected , $ this ->viewModel ->getContent ());
@@ -90,7 +96,7 @@ public function testGetContentCallsBrowserTimingFooterWithCorrectParameter(): vo
9096 $ this ->newRelicWrapperMock ->expects ($ this ->once ())
9197 ->method ('getBrowserTimingFooter ' )
9298 ->with ($ this ->identicalTo (false ))
93- ->willReturn ('<script>test </script> ' );
99+ ->willReturn ('<script type="text/x-magento-init">{"*":{"newRelicFooter":{"enabled":true}}} </script> ' );
94100
95101 $ this ->viewModel ->getContent ();
96102 }
0 commit comments