1
1
<?php
2
2
3
+ namespace Clue \Tests \React \SQLite ;
4
+
3
5
use Clue \React \SQLite \DatabaseInterface ;
4
6
use Clue \React \SQLite \Factory ;
5
7
use Clue \React \SQLite \Result ;
@@ -22,10 +24,10 @@ public function provideSocketFlags()
22
24
*/
23
25
public function testOpenMemoryDatabaseResolvesWithDatabaseAndRunsUntilClose ($ flag )
24
26
{
25
- $ loop = React \EventLoop \Factory::create ();
27
+ $ loop = \ React \EventLoop \Factory::create ();
26
28
$ factory = new Factory ($ loop );
27
29
28
- $ ref = new ReflectionProperty ($ factory , 'useSocket ' );
30
+ $ ref = new \ ReflectionProperty ($ factory , 'useSocket ' );
29
31
$ ref ->setAccessible (true );
30
32
$ ref ->setValue ($ factory , $ flag );
31
33
@@ -48,10 +50,10 @@ public function testOpenMemoryDatabaseResolvesWithDatabaseAndRunsUntilClose($fla
48
50
*/
49
51
public function testOpenMemoryDatabaseResolvesWithDatabaseAndRunsUntilQuit ($ flag )
50
52
{
51
- $ loop = React \EventLoop \Factory::create ();
53
+ $ loop = \ React \EventLoop \Factory::create ();
52
54
$ factory = new Factory ($ loop );
53
55
54
- $ ref = new ReflectionProperty ($ factory , 'useSocket ' );
56
+ $ ref = new \ ReflectionProperty ($ factory , 'useSocket ' );
55
57
$ ref ->setAccessible (true );
56
58
$ ref ->setValue ($ factory , $ flag );
57
59
@@ -77,7 +79,7 @@ public function testOpenMemoryDatabaseShouldNotInheritActiveFileDescriptors()
77
79
$ this ->markTestSkipped ('Platform does not prevent binding to same address (Windows?) ' );
78
80
}
79
81
80
- $ loop = React \EventLoop \Factory::create ();
82
+ $ loop = \ React \EventLoop \Factory::create ();
81
83
$ factory = new Factory ($ loop );
82
84
83
85
$ promise = $ factory ->open (':memory: ' );
@@ -115,10 +117,10 @@ public function testOpenMemoryDatabaseShouldNotInheritActiveFileDescriptors()
115
117
*/
116
118
public function testOpenInvalidPathRejects ($ flag )
117
119
{
118
- $ loop = React \EventLoop \Factory::create ();
120
+ $ loop = \ React \EventLoop \Factory::create ();
119
121
$ factory = new Factory ($ loop );
120
122
121
- $ ref = new ReflectionProperty ($ factory , 'useSocket ' );
123
+ $ ref = new \ ReflectionProperty ($ factory , 'useSocket ' );
122
124
$ ref ->setAccessible (true );
123
125
$ ref ->setValue ($ factory , $ flag );
124
126
@@ -138,10 +140,10 @@ public function testOpenInvalidPathRejects($flag)
138
140
*/
139
141
public function testOpenInvalidFlagsRejects ($ flag )
140
142
{
141
- $ loop = React \EventLoop \Factory::create ();
143
+ $ loop = \ React \EventLoop \Factory::create ();
142
144
$ factory = new Factory ($ loop );
143
145
144
- $ ref = new ReflectionProperty ($ factory , 'useSocket ' );
146
+ $ ref = new \ ReflectionProperty ($ factory , 'useSocket ' );
145
147
$ ref ->setAccessible (true );
146
148
$ ref ->setValue ($ factory , $ flag );
147
149
@@ -161,10 +163,10 @@ public function testOpenInvalidFlagsRejects($flag)
161
163
*/
162
164
public function testQuitResolvesAndRunsUntilQuit ($ flag )
163
165
{
164
- $ loop = React \EventLoop \Factory::create ();
166
+ $ loop = \ React \EventLoop \Factory::create ();
165
167
$ factory = new Factory ($ loop );
166
168
167
- $ ref = new ReflectionProperty ($ factory , 'useSocket ' );
169
+ $ ref = new \ ReflectionProperty ($ factory , 'useSocket ' );
168
170
$ ref ->setAccessible (true );
169
171
$ ref ->setValue ($ factory , $ flag );
170
172
@@ -189,10 +191,10 @@ public function testQuitResolvesAndRunsUntilQuitWhenParentHasManyFileDescriptors
189
191
$ servers [] = stream_socket_server ('tcp://127.0.0.1:0 ' );
190
192
}
191
193
192
- $ loop = React \EventLoop \Factory::create ();
194
+ $ loop = \ React \EventLoop \Factory::create ();
193
195
$ factory = new Factory ($ loop );
194
196
195
- $ ref = new ReflectionProperty ($ factory , 'useSocket ' );
197
+ $ ref = new \ ReflectionProperty ($ factory , 'useSocket ' );
196
198
$ ref ->setAccessible (true );
197
199
$ ref ->setValue ($ factory , $ flag );
198
200
@@ -216,10 +218,10 @@ public function testQuitResolvesAndRunsUntilQuitWhenParentHasManyFileDescriptors
216
218
*/
217
219
public function testQuitTwiceWillRejectSecondCall ($ flag )
218
220
{
219
- $ loop = React \EventLoop \Factory::create ();
221
+ $ loop = \ React \EventLoop \Factory::create ();
220
222
$ factory = new Factory ($ loop );
221
223
222
- $ ref = new ReflectionProperty ($ factory , 'useSocket ' );
224
+ $ ref = new \ ReflectionProperty ($ factory , 'useSocket ' );
223
225
$ ref ->setAccessible (true );
224
226
$ ref ->setValue ($ factory , $ flag );
225
227
@@ -240,10 +242,10 @@ public function testQuitTwiceWillRejectSecondCall($flag)
240
242
*/
241
243
public function testQueryIntegerResolvesWithResultWithTypeIntegerAndRunsUntilQuit ($ flag )
242
244
{
243
- $ loop = React \EventLoop \Factory::create ();
245
+ $ loop = \ React \EventLoop \Factory::create ();
244
246
$ factory = new Factory ($ loop );
245
247
246
- $ ref = new ReflectionProperty ($ factory , 'useSocket ' );
248
+ $ ref = new \ ReflectionProperty ($ factory , 'useSocket ' );
247
249
$ ref ->setAccessible (true );
248
250
$ ref ->setValue ($ factory , $ flag );
249
251
@@ -269,10 +271,10 @@ public function testQueryIntegerResolvesWithResultWithTypeIntegerAndRunsUntilQui
269
271
*/
270
272
public function testQueryStringResolvesWithResultWithTypeStringAndRunsUntilQuit ($ flag )
271
273
{
272
- $ loop = React \EventLoop \Factory::create ();
274
+ $ loop = \ React \EventLoop \Factory::create ();
273
275
$ factory = new Factory ($ loop );
274
276
275
- $ ref = new ReflectionProperty ($ factory , 'useSocket ' );
277
+ $ ref = new \ ReflectionProperty ($ factory , 'useSocket ' );
276
278
$ ref ->setAccessible (true );
277
279
$ ref ->setValue ($ factory , $ flag );
278
280
@@ -298,18 +300,18 @@ public function testQueryStringResolvesWithResultWithTypeStringAndRunsUntilQuit(
298
300
*/
299
301
public function testQueryInvalidTableRejectsWithExceptionAndRunsUntilQuit ($ flag )
300
302
{
301
- $ loop = React \EventLoop \Factory::create ();
303
+ $ loop = \ React \EventLoop \Factory::create ();
302
304
$ factory = new Factory ($ loop );
303
305
304
- $ ref = new ReflectionProperty ($ factory , 'useSocket ' );
306
+ $ ref = new \ ReflectionProperty ($ factory , 'useSocket ' );
305
307
$ ref ->setAccessible (true );
306
308
$ ref ->setValue ($ factory , $ flag );
307
309
308
310
$ promise = $ factory ->open (':memory: ' );
309
311
310
312
$ data = null ;
311
313
$ promise ->then (function (DatabaseInterface $ db ) use (&$ data ){
312
- $ db ->query ('SELECT 1 FROM foo ' )->then ('var_dump ' , function (Exception $ e ) use (&$ data ) {
314
+ $ db ->query ('SELECT 1 FROM foo ' )->then ('var_dump ' , function (\ Exception $ e ) use (&$ data ) {
313
315
$ data = $ e ->getMessage ();
314
316
});
315
317
@@ -327,18 +329,18 @@ public function testQueryInvalidTableRejectsWithExceptionAndRunsUntilQuit($flag)
327
329
*/
328
330
public function testQueryInvalidTableWithPlaceholderRejectsWithExceptionAndRunsUntilQuit ($ flag )
329
331
{
330
- $ loop = React \EventLoop \Factory::create ();
332
+ $ loop = \ React \EventLoop \Factory::create ();
331
333
$ factory = new Factory ($ loop );
332
334
333
- $ ref = new ReflectionProperty ($ factory , 'useSocket ' );
335
+ $ ref = new \ ReflectionProperty ($ factory , 'useSocket ' );
334
336
$ ref ->setAccessible (true );
335
337
$ ref ->setValue ($ factory , $ flag );
336
338
337
339
$ promise = $ factory ->open (':memory: ' );
338
340
339
341
$ data = null ;
340
342
$ promise ->then (function (DatabaseInterface $ db ) use (&$ data ){
341
- $ db ->query ('SELECT ? FROM foo ' , [1 ])->then ('var_dump ' , function (Exception $ e ) use (&$ data ) {
343
+ $ db ->query ('SELECT ? FROM foo ' , [1 ])->then ('var_dump ' , function (\ Exception $ e ) use (&$ data ) {
342
344
$ data = $ e ->getMessage ();
343
345
});
344
346
@@ -363,7 +365,7 @@ public function provideSqlDataWillBeReturnedWithType()
363
365
['X \'01020300 \'' , "\x01\x02\x03\x00" ],
364
366
['X \'3FF3 \'' , "\x3f\xf3" ]
365
367
],
366
- (SQLite3::version ()['versionNumber ' ] < 3023000 ) ? [] : [
368
+ (\ SQLite3::version ()['versionNumber ' ] < 3023000 ) ? [] : [
367
369
// boolean identifiers exist only as of SQLite 3.23.0 (2018-04-02)
368
370
// @link https://www.sqlite.org/lang_expr.html#booleanexpr
369
371
['true ' , 1 ],
@@ -379,7 +381,7 @@ public function provideSqlDataWillBeReturnedWithType()
379
381
*/
380
382
public function testQueryValueInStatementResolvesWithResultWithTypeAndRunsUntilQuit ($ value , $ expected )
381
383
{
382
- $ loop = React \EventLoop \Factory::create ();
384
+ $ loop = \ React \EventLoop \Factory::create ();
383
385
$ factory = new Factory ($ loop );
384
386
385
387
$ promise = $ factory ->open (':memory: ' );
@@ -422,7 +424,7 @@ public function provideDataWillBeReturnedWithType()
422
424
*/
423
425
public function testQueryValuePlaceholderPositionalResolvesWithResultWithExactTypeAndRunsUntilQuit ($ value , $ type )
424
426
{
425
- $ loop = React \EventLoop \Factory::create ();
427
+ $ loop = \ React \EventLoop \Factory::create ();
426
428
$ factory = new Factory ($ loop );
427
429
428
430
$ promise = $ factory ->open (':memory: ' );
@@ -447,7 +449,7 @@ public function testQueryValuePlaceholderPositionalResolvesWithResultWithExactTy
447
449
*/
448
450
public function testQueryValuePlaceholderNamedResolvesWithResultWithExactTypeAndRunsUntilQuit ($ value , $ type )
449
451
{
450
- $ loop = React \EventLoop \Factory::create ();
452
+ $ loop = \ React \EventLoop \Factory::create ();
451
453
$ factory = new Factory ($ loop );
452
454
453
455
$ promise = $ factory ->open (':memory: ' );
@@ -481,7 +483,7 @@ public function provideDataWillBeReturnedWithOtherType()
481
483
*/
482
484
public function testQueryValuePlaceholderPositionalResolvesWithResultWithOtherTypeAndRunsUntilQuit ($ value , $ expected )
483
485
{
484
- $ loop = React \EventLoop \Factory::create ();
486
+ $ loop = \ React \EventLoop \Factory::create ();
485
487
$ factory = new Factory ($ loop );
486
488
487
489
$ promise = $ factory ->open (':memory: ' );
@@ -507,7 +509,7 @@ public function testQueryValuePlaceholderPositionalResolvesWithResultWithOtherTy
507
509
*/
508
510
public function testQueryValuePlaceholderNamedResolvesWithResultWithOtherTypeAndRunsUntilQuit ($ value , $ expected )
509
511
{
510
- $ loop = React \EventLoop \Factory::create ();
512
+ $ loop = \ React \EventLoop \Factory::create ();
511
513
$ factory = new Factory ($ loop );
512
514
513
515
$ promise = $ factory ->open (':memory: ' );
@@ -532,10 +534,10 @@ public function testQueryValuePlaceholderNamedResolvesWithResultWithOtherTypeAnd
532
534
*/
533
535
public function testQueryRejectsWhenQueryIsInvalid ($ flag )
534
536
{
535
- $ loop = React \EventLoop \Factory::create ();
537
+ $ loop = \ React \EventLoop \Factory::create ();
536
538
$ factory = new Factory ($ loop );
537
539
538
- $ ref = new ReflectionProperty ($ factory , 'useSocket ' );
540
+ $ ref = new \ ReflectionProperty ($ factory , 'useSocket ' );
539
541
$ ref ->setAccessible (true );
540
542
$ ref ->setValue ($ factory , $ flag );
541
543
@@ -557,10 +559,10 @@ public function testQueryRejectsWhenQueryIsInvalid($flag)
557
559
*/
558
560
public function testQueryRejectsWhenClosedImmediately ($ flag )
559
561
{
560
- $ loop = React \EventLoop \Factory::create ();
562
+ $ loop = \ React \EventLoop \Factory::create ();
561
563
$ factory = new Factory ($ loop );
562
564
563
- $ ref = new ReflectionProperty ($ factory , 'useSocket ' );
565
+ $ ref = new \ ReflectionProperty ($ factory , 'useSocket ' );
564
566
$ ref ->setAccessible (true );
565
567
$ ref ->setValue ($ factory , $ flag );
566
568
@@ -582,10 +584,10 @@ public function testQueryRejectsWhenClosedImmediately($flag)
582
584
*/
583
585
public function testExecCreateTableResolvesWithResultWithoutRows ($ flag )
584
586
{
585
- $ loop = React \EventLoop \Factory::create ();
587
+ $ loop = \ React \EventLoop \Factory::create ();
586
588
$ factory = new Factory ($ loop );
587
589
588
- $ ref = new ReflectionProperty ($ factory , 'useSocket ' );
590
+ $ ref = new \ ReflectionProperty ($ factory , 'useSocket ' );
589
591
$ ref ->setAccessible (true );
590
592
$ ref ->setValue ($ factory , $ flag );
591
593
@@ -611,10 +613,10 @@ public function testExecCreateTableResolvesWithResultWithoutRows($flag)
611
613
*/
612
614
public function testExecRejectsWhenClosedImmediately ($ flag )
613
615
{
614
- $ loop = React \EventLoop \Factory::create ();
616
+ $ loop = \ React \EventLoop \Factory::create ();
615
617
$ factory = new Factory ($ loop );
616
618
617
- $ ref = new ReflectionProperty ($ factory , 'useSocket ' );
619
+ $ ref = new \ ReflectionProperty ($ factory , 'useSocket ' );
618
620
$ ref ->setAccessible (true );
619
621
$ ref ->setValue ($ factory , $ flag );
620
622
@@ -636,10 +638,10 @@ public function testExecRejectsWhenClosedImmediately($flag)
636
638
*/
637
639
public function testExecRejectsWhenAlreadyClosed ($ flag )
638
640
{
639
- $ loop = React \EventLoop \Factory::create ();
641
+ $ loop = \ React \EventLoop \Factory::create ();
640
642
$ factory = new Factory ($ loop );
641
643
642
- $ ref = new ReflectionProperty ($ factory , 'useSocket ' );
644
+ $ ref = new \ ReflectionProperty ($ factory , 'useSocket ' );
643
645
$ ref ->setAccessible (true );
644
646
$ ref ->setValue ($ factory , $ flag );
645
647
@@ -660,10 +662,10 @@ public function testExecRejectsWhenAlreadyClosed($flag)
660
662
*/
661
663
public function testQueryInsertResolvesWithEmptyResultSetWithLastInsertIdAndRunsUntilQuit ($ flag )
662
664
{
663
- $ loop = React \EventLoop \Factory::create ();
665
+ $ loop = \ React \EventLoop \Factory::create ();
664
666
$ factory = new Factory ($ loop );
665
667
666
- $ ref = new ReflectionProperty ($ factory , 'useSocket ' );
668
+ $ ref = new \ ReflectionProperty ($ factory , 'useSocket ' );
667
669
$ ref ->setAccessible (true );
668
670
$ ref ->setValue ($ factory , $ flag );
669
671
@@ -693,10 +695,10 @@ public function testQueryInsertResolvesWithEmptyResultSetWithLastInsertIdAndRuns
693
695
*/
694
696
public function testQuerySelectEmptyResolvesWithEmptyResultSetWithColumnsAndNoRowsAndRunsUntilQuit ($ flag )
695
697
{
696
- $ loop = React \EventLoop \Factory::create ();
698
+ $ loop = \ React \EventLoop \Factory::create ();
697
699
$ factory = new Factory ($ loop );
698
700
699
- $ ref = new ReflectionProperty ($ factory , 'useSocket ' );
701
+ $ ref = new \ ReflectionProperty ($ factory , 'useSocket ' );
700
702
$ ref ->setAccessible (true );
701
703
$ ref ->setValue ($ factory , $ flag );
702
704
0 commit comments