File tree Expand file tree Collapse file tree 2 files changed +25
-2
lines changed
lib/internal/Magento/Framework/View Expand file tree Collapse file tree 2 files changed +25
-2
lines changed Original file line number Diff line number Diff line change @@ -547,8 +547,7 @@ public function renderNonCachedElement($name)
547547 if ($ this ->appState ->getMode () === AppState::MODE_DEVELOPER ) {
548548 throw $ e ;
549549 }
550- $ message = ($ e instanceof LocalizedException) ? $ e ->getLogMessage () : $ e ->getMessage ();
551- $ this ->logger ->critical ($ message );
550+ $ this ->logger ->critical ($ e );
552551 }
553552 return $ result ;
554553 }
Original file line number Diff line number Diff line change 1919use Magento \Framework \View \Element \AbstractBlock ;
2020use Magento \Framework \View \Element \Template ;
2121use Magento \Framework \View \Layout ;
22+ use Magento \Framework \View \Layout \BuilderInterface ;
2223use Magento \Framework \View \Layout \Data \Structure as LayoutStructure ;
2324use Magento \Framework \View \Layout \Element ;
2425use Magento \Framework \View \Layout \Generator \Block ;
@@ -1169,4 +1170,27 @@ public function renderElementDisplayDataProvider(): array
11691170 [null ],
11701171 ];
11711172 }
1173+
1174+ /**
1175+ * Test render element with exception
1176+ *
1177+ * @return void
1178+ */
1179+ public function testRenderNonCachedElementWithException (): void
1180+ {
1181+ $ exception = new \Exception ('Error message ' );
1182+
1183+ $ builderMock = $ this ->createMock (BuilderInterface::class);
1184+ $ builderMock ->expects ($ this ->once ())
1185+ ->method ('build ' )
1186+ ->willThrowException ($ exception );
1187+
1188+ $ this ->loggerMock ->expects ($ this ->once ())
1189+ ->method ('critical ' )
1190+ ->with ($ exception );
1191+
1192+ $ model = clone $ this ->model ;
1193+ $ model ->setBuilder ($ builderMock );
1194+ $ model ->renderNonCachedElement ('test_container ' );
1195+ }
11721196}
You can’t perform that action at this time.
0 commit comments