@@ -100,7 +100,8 @@ public function it_creates_log_file()
100
100
$ this ->formatter ->shouldReceive ('getLine ' )->once ()->with ($ query )->andReturn ($ lineContent );
101
101
$ this ->formatter ->shouldReceive ('getHeader ' )->once ()->withNoArgs ()->andReturn ('-- header ' );
102
102
$ 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 ('/^$/ ' );
104
105
$ this ->config ->shouldReceive ('logDirectory ' )->times (3 )->withNoArgs ()->andReturn ($ this ->directory );
105
106
$ this ->config ->shouldReceive ('queriesOverrideLog ' )->once ()->withNoArgs ()->andReturn (false );
106
107
$ this ->config ->shouldReceive ('queriesMinExecTime ' )->once ()->withNoArgs ()->andReturn (0 );
@@ -127,7 +128,8 @@ public function it_appends_to_existing_log_file()
127
128
$ this ->formatter ->shouldReceive ('getLine ' )->once ()->with ($ query )->andReturn ($ lineContent );
128
129
$ this ->formatter ->shouldReceive ('getHeader ' )->once ()->withNoArgs ()->andReturn ('-- header ' );
129
130
$ 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 ('/^$/ ' );
131
133
$ this ->config ->shouldReceive ('logDirectory ' )->times (3 )->withNoArgs ()->andReturn ($ this ->directory );
132
134
$ this ->config ->shouldReceive ('queriesOverrideLog ' )->once ()->withNoArgs ()->andReturn (false );
133
135
$ 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
154
156
$ this ->formatter ->shouldReceive ('getLine ' )->once ()->with ($ query )->andReturn ($ lineContent );
155
157
$ this ->formatter ->shouldReceive ('getHeader ' )->once ()->withNoArgs ()->andReturn ('-- header ' );
156
158
$ 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 ('/^$/ ' );
158
161
$ this ->config ->shouldReceive ('logDirectory ' )->times (3 )->withNoArgs ()->andReturn ($ this ->directory );
159
162
$ this ->config ->shouldReceive ('queriesOverrideLog ' )->once ()->withNoArgs ()->andReturn (true );
160
163
$ 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
182
185
$ this ->formatter ->shouldReceive ('getLine ' )->twice ()->andReturn ($ lineContent );
183
186
$ this ->formatter ->shouldReceive ('getHeader ' )->once ()->withNoArgs ()->andReturn ('-- header ' );
184
187
$ 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 ('/^$/ ' );
186
190
$ this ->config ->shouldReceive ('logDirectory ' )->times (4 )->withNoArgs ()->andReturn ($ this ->directory );
187
191
$ this ->config ->shouldReceive ('queriesOverrideLog ' )->once ()->withNoArgs ()->andReturn (true );
188
192
$ 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
206
210
$ this ->formatter ->shouldReceive ('getLine ' )->once ()->with ($ query )->andReturn ($ lineContent );
207
211
$ this ->formatter ->shouldReceive ('getHeader ' )->once ()->withNoArgs ()->andReturn ('' );
208
212
$ 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 ('/^$/ ' );
210
215
$ this ->config ->shouldReceive ('logDirectory ' )->times (3 )->withNoArgs ()->andReturn ($ this ->directory );
211
216
$ this ->config ->shouldReceive ('queriesMinExecTime ' )->once ()->withNoArgs ()->andReturn (0 );
212
217
$ 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
224
229
{
225
230
$ query = new SqlQuery (1 , 'select * FROM test ' , [], 5.41 );
226
231
$ 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 ' );
228
233
$ this ->config ->shouldReceive ('queriesMinExecTime ' )->once ()->withNoArgs ()->andReturn (0 );
229
234
$ this ->config ->shouldReceive ('logDirectory ' )->once ()->withNoArgs ()->andReturn ($ this ->directory );
230
235
$ this ->writer ->save ($ query );
@@ -243,7 +248,8 @@ public function it_saves_insert_query_to_file_when_pattern_set_to_insert_or_upda
243
248
$ this ->formatter ->shouldReceive ('getLine ' )->once ()->with ($ query )->andReturn ($ lineContent );
244
249
$ this ->formatter ->shouldReceive ('getHeader ' )->once ()->withNoArgs ()->andReturn ('' );
245
250
$ 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 ('/^$/ ' );
247
253
$ this ->config ->shouldReceive ('logDirectory ' )->times (3 )->withNoArgs ()->andReturn ($ this ->directory );
248
254
$ this ->config ->shouldReceive ('queriesMinExecTime ' )->once ()->withNoArgs ()->andReturn (0 );
249
255
$ this ->filename ->shouldReceive ('getLogfile ' )->twice ()->withNoArgs ()->andReturn ($ expectedFileName );
@@ -267,7 +273,8 @@ public function it_uses_raw_query_without_bindings_when_using_query_pattern()
267
273
$ this ->formatter ->shouldReceive ('getLine ' )->once ()->with ($ query )->andReturn ($ lineContent );
268
274
$ this ->formatter ->shouldReceive ('getHeader ' )->once ()->withNoArgs ()->andReturn ('' );
269
275
$ 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 ('/^$/ ' );
271
278
$ this ->config ->shouldReceive ('logDirectory ' )->times (3 )->withNoArgs ()->andReturn ($ this ->directory );
272
279
$ this ->filename ->shouldReceive ('getLogfile ' )->twice ()->withNoArgs ()->andReturn ($ expectedFileName );
273
280
$ this ->config ->shouldReceive ('queriesMinExecTime ' )->once ()->withNoArgs ()->andReturn (0 );
0 commit comments