@@ -100,7 +100,8 @@ public function it_creates_log_file()
100100 $ this ->formatter ->shouldReceive ('getLine ' )->once ()->with ($ query )->andReturn ($ lineContent );
101101 $ this ->formatter ->shouldReceive ('getHeader ' )->once ()->withNoArgs ()->andReturn ('-- header ' );
102102 $ this ->config ->shouldReceive ('queriesEnabled ' )->once ()->withNoArgs ()->andReturn (true );
103- $ this ->config ->shouldReceive ('queriesPattern ' )->once ()->withNoArgs ()->andReturn ('#.*#i ' );
103+ $ this ->config ->shouldReceive ('queriesIncludePattern ' )->once ()->withNoArgs ()->andReturn ('#.*#i ' );
104+ $ this ->config ->shouldReceive ('queriesExcludePattern ' )->once ()->withNoArgs ()->andReturn ('/^$/ ' );
104105 $ this ->config ->shouldReceive ('logDirectory ' )->times (3 )->withNoArgs ()->andReturn ($ this ->directory );
105106 $ this ->config ->shouldReceive ('queriesOverrideLog ' )->once ()->withNoArgs ()->andReturn (false );
106107 $ this ->config ->shouldReceive ('queriesMinExecTime ' )->once ()->withNoArgs ()->andReturn (0 );
@@ -127,7 +128,8 @@ public function it_appends_to_existing_log_file()
127128 $ this ->formatter ->shouldReceive ('getLine ' )->once ()->with ($ query )->andReturn ($ lineContent );
128129 $ this ->formatter ->shouldReceive ('getHeader ' )->once ()->withNoArgs ()->andReturn ('-- header ' );
129130 $ this ->config ->shouldReceive ('queriesEnabled ' )->once ()->withNoArgs ()->andReturn (true );
130- $ this ->config ->shouldReceive ('queriesPattern ' )->once ()->withNoArgs ()->andReturn ('#.*#i ' );
131+ $ this ->config ->shouldReceive ('queriesIncludePattern ' )->once ()->withNoArgs ()->andReturn ('#.*#i ' );
132+ $ this ->config ->shouldReceive ('queriesExcludePattern ' )->once ()->withNoArgs ()->andReturn ('/^$/ ' );
131133 $ this ->config ->shouldReceive ('logDirectory ' )->times (3 )->withNoArgs ()->andReturn ($ this ->directory );
132134 $ this ->config ->shouldReceive ('queriesOverrideLog ' )->once ()->withNoArgs ()->andReturn (false );
133135 $ this ->config ->shouldReceive ('queriesMinExecTime ' )->once ()->withNoArgs ()->andReturn (0 );
@@ -154,7 +156,8 @@ public function it_replaces_current_file_content_for_1st_query_when_overriding_i
154156 $ this ->formatter ->shouldReceive ('getLine ' )->once ()->with ($ query )->andReturn ($ lineContent );
155157 $ this ->formatter ->shouldReceive ('getHeader ' )->once ()->withNoArgs ()->andReturn ('-- header ' );
156158 $ this ->config ->shouldReceive ('queriesEnabled ' )->once ()->withNoArgs ()->andReturn (true );
157- $ this ->config ->shouldReceive ('queriesPattern ' )->once ()->withNoArgs ()->andReturn ('#.*#i ' );
159+ $ this ->config ->shouldReceive ('queriesIncludePattern ' )->once ()->withNoArgs ()->andReturn ('#.*#i ' );
160+ $ this ->config ->shouldReceive ('queriesExcludePattern ' )->once ()->withNoArgs ()->andReturn ('/^$/ ' );
158161 $ this ->config ->shouldReceive ('logDirectory ' )->times (3 )->withNoArgs ()->andReturn ($ this ->directory );
159162 $ this ->config ->shouldReceive ('queriesOverrideLog ' )->once ()->withNoArgs ()->andReturn (true );
160163 $ this ->config ->shouldReceive ('queriesMinExecTime ' )->once ()->withNoArgs ()->andReturn (0 );
@@ -182,7 +185,8 @@ public function it_appends_to_current_file_content_for_2nd_query_when_overriding
182185 $ this ->formatter ->shouldReceive ('getLine ' )->twice ()->andReturn ($ lineContent );
183186 $ this ->formatter ->shouldReceive ('getHeader ' )->once ()->withNoArgs ()->andReturn ('-- header ' );
184187 $ this ->config ->shouldReceive ('queriesEnabled ' )->twice ()->withNoArgs ()->andReturn (true );
185- $ this ->config ->shouldReceive ('queriesPattern ' )->twice ()->withNoArgs ()->andReturn ('#.*#i ' );
188+ $ this ->config ->shouldReceive ('queriesIncludePattern ' )->twice ()->withNoArgs ()->andReturn ('#.*#i ' );
189+ $ this ->config ->shouldReceive ('queriesExcludePattern ' )->twice ()->withNoArgs ()->andReturn ('/^$/ ' );
186190 $ this ->config ->shouldReceive ('logDirectory ' )->times (4 )->withNoArgs ()->andReturn ($ this ->directory );
187191 $ this ->config ->shouldReceive ('queriesOverrideLog ' )->once ()->withNoArgs ()->andReturn (true );
188192 $ this ->config ->shouldReceive ('queriesMinExecTime ' )->twice ()->withNoArgs ()->andReturn (0 );
@@ -206,7 +210,8 @@ public function it_saves_select_query_to_file_when_pattern_set_to_select_queries
206210 $ this ->formatter ->shouldReceive ('getLine ' )->once ()->with ($ query )->andReturn ($ lineContent );
207211 $ this ->formatter ->shouldReceive ('getHeader ' )->once ()->withNoArgs ()->andReturn ('' );
208212 $ this ->config ->shouldReceive ('queriesEnabled ' )->once ()->withNoArgs ()->andReturn (true );
209- $ this ->config ->shouldReceive ('queriesPattern ' )->once ()->withNoArgs ()->andReturn ('#^SELECT .*$#i ' );
213+ $ this ->config ->shouldReceive ('queriesIncludePattern ' )->once ()->withNoArgs ()->andReturn ('#^SELECT .*$#i ' );
214+ $ this ->config ->shouldReceive ('queriesExcludePattern ' )->once ()->withNoArgs ()->andReturn ('/^$/ ' );
210215 $ this ->config ->shouldReceive ('logDirectory ' )->times (3 )->withNoArgs ()->andReturn ($ this ->directory );
211216 $ this ->config ->shouldReceive ('queriesMinExecTime ' )->once ()->withNoArgs ()->andReturn (0 );
212217 $ this ->filename ->shouldReceive ('getLogfile ' )->twice ()->withNoArgs ()->andReturn ($ expectedFileName );
@@ -224,7 +229,7 @@ public function it_doesnt_save_select_query_to_file_when_pattern_set_to_insert_o
224229 {
225230 $ query = new SqlQuery (1 , 'select * FROM test ' , [], 5.41 );
226231 $ this ->config ->shouldReceive ('queriesEnabled ' )->once ()->withNoArgs ()->andReturn (true );
227- $ this ->config ->shouldReceive ('queriesPattern ' )->once ()->withNoArgs ()->andReturn ('#^(?:UPDATE|INSERT) .*$#i ' );
232+ $ this ->config ->shouldReceive ('queriesIncludePattern ' )->once ()->withNoArgs ()->andReturn ('#^(?:UPDATE|INSERT) .*$#i ' );
228233 $ this ->config ->shouldReceive ('queriesMinExecTime ' )->once ()->withNoArgs ()->andReturn (0 );
229234 $ this ->config ->shouldReceive ('logDirectory ' )->once ()->withNoArgs ()->andReturn ($ this ->directory );
230235 $ this ->writer ->save ($ query );
@@ -243,7 +248,8 @@ public function it_saves_insert_query_to_file_when_pattern_set_to_insert_or_upda
243248 $ this ->formatter ->shouldReceive ('getLine ' )->once ()->with ($ query )->andReturn ($ lineContent );
244249 $ this ->formatter ->shouldReceive ('getHeader ' )->once ()->withNoArgs ()->andReturn ('' );
245250 $ this ->config ->shouldReceive ('queriesEnabled ' )->once ()->withNoArgs ()->andReturn (true );
246- $ this ->config ->shouldReceive ('queriesPattern ' )->once ()->withNoArgs ()->andReturn ('#^(?:UPDATE|INSERT) .*$#i ' );
251+ $ this ->config ->shouldReceive ('queriesIncludePattern ' )->once ()->withNoArgs ()->andReturn ('#^(?:UPDATE|INSERT) .*$#i ' );
252+ $ this ->config ->shouldReceive ('queriesExcludePattern ' )->once ()->withNoArgs ()->andReturn ('/^$/ ' );
247253 $ this ->config ->shouldReceive ('logDirectory ' )->times (3 )->withNoArgs ()->andReturn ($ this ->directory );
248254 $ this ->config ->shouldReceive ('queriesMinExecTime ' )->once ()->withNoArgs ()->andReturn (0 );
249255 $ this ->filename ->shouldReceive ('getLogfile ' )->twice ()->withNoArgs ()->andReturn ($ expectedFileName );
@@ -267,7 +273,8 @@ public function it_uses_raw_query_without_bindings_when_using_query_pattern()
267273 $ this ->formatter ->shouldReceive ('getLine ' )->once ()->with ($ query )->andReturn ($ lineContent );
268274 $ this ->formatter ->shouldReceive ('getHeader ' )->once ()->withNoArgs ()->andReturn ('' );
269275 $ this ->config ->shouldReceive ('queriesEnabled ' )->once ()->withNoArgs ()->andReturn (true );
270- $ this ->config ->shouldReceive ('queriesPattern ' )->once ()->withNoArgs ()->andReturn ('#^(?:UPDATE test SET x = \? |INSERT ).*$#i ' );
276+ $ this ->config ->shouldReceive ('queriesIncludePattern ' )->once ()->withNoArgs ()->andReturn ('#^(?:UPDATE test SET x = \? |INSERT ).*$#i ' );
277+ $ this ->config ->shouldReceive ('queriesExcludePattern ' )->once ()->withNoArgs ()->andReturn ('/^$/ ' );
271278 $ this ->config ->shouldReceive ('logDirectory ' )->times (3 )->withNoArgs ()->andReturn ($ this ->directory );
272279 $ this ->filename ->shouldReceive ('getLogfile ' )->twice ()->withNoArgs ()->andReturn ($ expectedFileName );
273280 $ this ->config ->shouldReceive ('queriesMinExecTime ' )->once ()->withNoArgs ()->andReturn (0 );
0 commit comments