File tree Expand file tree Collapse file tree 2 files changed +16
-2
lines changed
Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Original file line number Diff line number Diff line change 55use GenericCommand ;
66use Illuminated \Console \Exceptions \ExceptionHandler ;
77use Mockery ;
8+ use Monolog \Handler \AbstractProcessingHandler ;
89use Psr \Log \LoggerInterface ;
910
1011class LoggableTraitOnMysqlTest extends TestCase
@@ -54,9 +55,13 @@ public function it_writes_to_log_file_mysql_specific_information_after_header()
5455 * @runInSeparateProcess
5556 * @preserveGlobalState disabled
5657 */
57- public function it_writes_to_log_file_information_footer_each_iteration ()
58+ public function it_writes_to_log_file_information_footer_each_iteration_and_close_all_handlers_on_shutdown ()
5859 {
5960 $ logger = spy (LoggerInterface::class);
61+ $ logger ->expects ()->getHandlers ()->andReturn ([
62+ $ processingHandler1 = spy (AbstractProcessingHandler::class),
63+ $ processingHandler2 = spy (AbstractProcessingHandler::class),
64+ ]);
6065
6166 $ handler = app (ExceptionHandler::class);
6267 $ handler ->initialize ($ logger );
@@ -65,5 +70,7 @@ public function it_writes_to_log_file_information_footer_each_iteration()
6570 $ logger ->shouldHaveReceived ()->info (Mockery::pattern ('/Execution time\: .*? sec\./ ' ));
6671 $ logger ->shouldHaveReceived ()->info (Mockery::pattern ('/Memory peak usage\: .*?\./ ' ));
6772 $ logger ->shouldHaveReceived ()->info ('%separator% ' );
73+ $ processingHandler1 ->shouldHaveReceived ()->close ();
74+ $ processingHandler2 ->shouldHaveReceived ()->close ();
6875 }
6976}
Original file line number Diff line number Diff line change 55use GenericCommand ;
66use Illuminated \Console \Exceptions \ExceptionHandler ;
77use Mockery ;
8+ use Monolog \Handler \AbstractProcessingHandler ;
89use Psr \Log \LoggerInterface ;
910
1011class LoggableTraitTest extends TestCase
@@ -40,9 +41,13 @@ public function it_does_not_write_mysql_specific_information_for_non_mysql_conne
4041 * @runInSeparateProcess
4142 * @preserveGlobalState disabled
4243 */
43- public function it_writes_to_log_file_information_footer_each_iteration ()
44+ public function it_writes_to_log_file_information_footer_each_iteration_and_close_all_handlers_on_shutdown ()
4445 {
4546 $ logger = spy (LoggerInterface::class);
47+ $ logger ->expects ()->getHandlers ()->andReturn ([
48+ $ processingHandler1 = spy (AbstractProcessingHandler::class),
49+ $ processingHandler2 = spy (AbstractProcessingHandler::class),
50+ ]);
4651
4752 $ handler = app (ExceptionHandler::class);
4853 $ handler ->initialize ($ logger );
@@ -51,6 +56,8 @@ public function it_writes_to_log_file_information_footer_each_iteration()
5156 $ logger ->shouldHaveReceived ()->info (Mockery::pattern ('/Execution time\: .*? sec\./ ' ));
5257 $ logger ->shouldHaveReceived ()->info (Mockery::pattern ('/Memory peak usage\: .*?\./ ' ));
5358 $ logger ->shouldHaveReceived ()->info ('%separator% ' );
59+ $ processingHandler1 ->shouldHaveReceived ()->close ();
60+ $ processingHandler2 ->shouldHaveReceived ()->close ();
5461 }
5562
5663 /** @test */
You can’t perform that action at this time.
0 commit comments