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 5
5
use GenericCommand ;
6
6
use Illuminated \Console \Exceptions \ExceptionHandler ;
7
7
use Mockery ;
8
+ use Monolog \Handler \AbstractProcessingHandler ;
8
9
use Psr \Log \LoggerInterface ;
9
10
10
11
class LoggableTraitOnMysqlTest extends TestCase
@@ -54,9 +55,13 @@ public function it_writes_to_log_file_mysql_specific_information_after_header()
54
55
* @runInSeparateProcess
55
56
* @preserveGlobalState disabled
56
57
*/
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 ()
58
59
{
59
60
$ logger = spy (LoggerInterface::class);
61
+ $ logger ->expects ()->getHandlers ()->andReturn ([
62
+ $ processingHandler1 = spy (AbstractProcessingHandler::class),
63
+ $ processingHandler2 = spy (AbstractProcessingHandler::class),
64
+ ]);
60
65
61
66
$ handler = app (ExceptionHandler::class);
62
67
$ handler ->initialize ($ logger );
@@ -65,5 +70,7 @@ public function it_writes_to_log_file_information_footer_each_iteration()
65
70
$ logger ->shouldHaveReceived ()->info (Mockery::pattern ('/Execution time\: .*? sec\./ ' ));
66
71
$ logger ->shouldHaveReceived ()->info (Mockery::pattern ('/Memory peak usage\: .*?\./ ' ));
67
72
$ logger ->shouldHaveReceived ()->info ('%separator% ' );
73
+ $ processingHandler1 ->shouldHaveReceived ()->close ();
74
+ $ processingHandler2 ->shouldHaveReceived ()->close ();
68
75
}
69
76
}
Original file line number Diff line number Diff line change 5
5
use GenericCommand ;
6
6
use Illuminated \Console \Exceptions \ExceptionHandler ;
7
7
use Mockery ;
8
+ use Monolog \Handler \AbstractProcessingHandler ;
8
9
use Psr \Log \LoggerInterface ;
9
10
10
11
class LoggableTraitTest extends TestCase
@@ -40,9 +41,13 @@ public function it_does_not_write_mysql_specific_information_for_non_mysql_conne
40
41
* @runInSeparateProcess
41
42
* @preserveGlobalState disabled
42
43
*/
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 ()
44
45
{
45
46
$ logger = spy (LoggerInterface::class);
47
+ $ logger ->expects ()->getHandlers ()->andReturn ([
48
+ $ processingHandler1 = spy (AbstractProcessingHandler::class),
49
+ $ processingHandler2 = spy (AbstractProcessingHandler::class),
50
+ ]);
46
51
47
52
$ handler = app (ExceptionHandler::class);
48
53
$ handler ->initialize ($ logger );
@@ -51,6 +56,8 @@ public function it_writes_to_log_file_information_footer_each_iteration()
51
56
$ logger ->shouldHaveReceived ()->info (Mockery::pattern ('/Execution time\: .*? sec\./ ' ));
52
57
$ logger ->shouldHaveReceived ()->info (Mockery::pattern ('/Memory peak usage\: .*?\./ ' ));
53
58
$ logger ->shouldHaveReceived ()->info ('%separator% ' );
59
+ $ processingHandler1 ->shouldHaveReceived ()->close ();
60
+ $ processingHandler2 ->shouldHaveReceived ()->close ();
54
61
}
55
62
56
63
/** @test */
You can’t perform that action at this time.
0 commit comments