6
6
use Clue \React \SQLite \Factory ;
7
7
use Clue \React \SQLite \Result ;
8
8
use PHPUnit \Framework \TestCase ;
9
+ use React \EventLoop \Loop ;
9
10
10
11
class FunctionalDatabaseTest extends TestCase
11
12
{
@@ -24,7 +25,7 @@ public function provideSocketFlags()
24
25
*/
25
26
public function testOpenMemoryDatabaseResolvesWithDatabaseAndRunsUntilClose ($ flag )
26
27
{
27
- $ loop = \ React \ EventLoop \Factory:: create ();
28
+ $ loop = Loop:: get ();
28
29
$ factory = new Factory ($ loop );
29
30
30
31
$ ref = new \ReflectionProperty ($ factory , 'useSocket ' );
@@ -50,7 +51,7 @@ public function testOpenMemoryDatabaseResolvesWithDatabaseAndRunsUntilClose($fla
50
51
*/
51
52
public function testOpenMemoryDatabaseResolvesWithDatabaseAndRunsUntilQuit ($ flag )
52
53
{
53
- $ loop = \ React \ EventLoop \Factory:: create ();
54
+ $ loop = Loop:: get ();
54
55
$ factory = new Factory ($ loop );
55
56
56
57
$ ref = new \ReflectionProperty ($ factory , 'useSocket ' );
@@ -79,7 +80,7 @@ public function testOpenMemoryDatabaseShouldNotInheritActiveFileDescriptors()
79
80
$ this ->markTestSkipped ('Platform does not prevent binding to same address (Windows?) ' );
80
81
}
81
82
82
- $ loop = \ React \ EventLoop \Factory:: create ();
83
+ $ loop = Loop:: get ();
83
84
$ factory = new Factory ($ loop );
84
85
85
86
$ promise = $ factory ->open (':memory: ' );
@@ -117,7 +118,7 @@ public function testOpenMemoryDatabaseShouldNotInheritActiveFileDescriptors()
117
118
*/
118
119
public function testOpenInvalidPathRejects ($ flag )
119
120
{
120
- $ loop = \ React \ EventLoop \Factory:: create ();
121
+ $ loop = Loop:: get ();
121
122
$ factory = new Factory ($ loop );
122
123
123
124
$ ref = new \ReflectionProperty ($ factory , 'useSocket ' );
@@ -140,7 +141,7 @@ public function testOpenInvalidPathRejects($flag)
140
141
*/
141
142
public function testOpenInvalidPathWithNullByteRejects ($ flag )
142
143
{
143
- $ loop = \ React \ EventLoop \Factory:: create ();
144
+ $ loop = Loop:: get ();
144
145
$ factory = new Factory ($ loop );
145
146
146
147
$ ref = new \ReflectionProperty ($ factory , 'useSocket ' );
@@ -163,7 +164,7 @@ public function testOpenInvalidPathWithNullByteRejects($flag)
163
164
*/
164
165
public function testOpenInvalidFlagsRejects ($ flag )
165
166
{
166
- $ loop = \ React \ EventLoop \Factory:: create ();
167
+ $ loop = Loop:: get ();
167
168
$ factory = new Factory ($ loop );
168
169
169
170
$ ref = new \ReflectionProperty ($ factory , 'useSocket ' );
@@ -186,7 +187,7 @@ public function testOpenInvalidFlagsRejects($flag)
186
187
*/
187
188
public function testQuitResolvesAndRunsUntilQuit ($ flag )
188
189
{
189
- $ loop = \ React \ EventLoop \Factory:: create ();
190
+ $ loop = Loop:: get ();
190
191
$ factory = new Factory ($ loop );
191
192
192
193
$ ref = new \ReflectionProperty ($ factory , 'useSocket ' );
@@ -214,7 +215,7 @@ public function testQuitResolvesAndRunsUntilQuitWhenParentHasManyFileDescriptors
214
215
$ servers [] = stream_socket_server ('tcp://127.0.0.1:0 ' );
215
216
}
216
217
217
- $ loop = \ React \ EventLoop \Factory:: create ();
218
+ $ loop = Loop:: get ();
218
219
$ factory = new Factory ($ loop );
219
220
220
221
$ ref = new \ReflectionProperty ($ factory , 'useSocket ' );
@@ -241,7 +242,7 @@ public function testQuitResolvesAndRunsUntilQuitWhenParentHasManyFileDescriptors
241
242
*/
242
243
public function testQuitTwiceWillRejectSecondCall ($ flag )
243
244
{
244
- $ loop = \ React \ EventLoop \Factory:: create ();
245
+ $ loop = Loop:: get ();
245
246
$ factory = new Factory ($ loop );
246
247
247
248
$ ref = new \ReflectionProperty ($ factory , 'useSocket ' );
@@ -265,7 +266,7 @@ public function testQuitTwiceWillRejectSecondCall($flag)
265
266
*/
266
267
public function testQueryIntegerResolvesWithResultWithTypeIntegerAndRunsUntilQuit ($ flag )
267
268
{
268
- $ loop = \ React \ EventLoop \Factory:: create ();
269
+ $ loop = Loop:: get ();
269
270
$ factory = new Factory ($ loop );
270
271
271
272
$ ref = new \ReflectionProperty ($ factory , 'useSocket ' );
@@ -294,7 +295,7 @@ public function testQueryIntegerResolvesWithResultWithTypeIntegerAndRunsUntilQui
294
295
*/
295
296
public function testQueryStringResolvesWithResultWithTypeStringAndRunsUntilQuit ($ flag )
296
297
{
297
- $ loop = \ React \ EventLoop \Factory:: create ();
298
+ $ loop = Loop:: get ();
298
299
$ factory = new Factory ($ loop );
299
300
300
301
$ ref = new \ReflectionProperty ($ factory , 'useSocket ' );
@@ -323,7 +324,7 @@ public function testQueryStringResolvesWithResultWithTypeStringAndRunsUntilQuit(
323
324
*/
324
325
public function testQueryInvalidTableRejectsWithExceptionAndRunsUntilQuit ($ flag )
325
326
{
326
- $ loop = \ React \ EventLoop \Factory:: create ();
327
+ $ loop = Loop:: get ();
327
328
$ factory = new Factory ($ loop );
328
329
329
330
$ ref = new \ReflectionProperty ($ factory , 'useSocket ' );
@@ -352,7 +353,7 @@ public function testQueryInvalidTableRejectsWithExceptionAndRunsUntilQuit($flag)
352
353
*/
353
354
public function testQueryInvalidTableWithPlaceholderRejectsWithExceptionAndRunsUntilQuit ($ flag )
354
355
{
355
- $ loop = \ React \ EventLoop \Factory:: create ();
356
+ $ loop = Loop:: get ();
356
357
$ factory = new Factory ($ loop );
357
358
358
359
$ ref = new \ReflectionProperty ($ factory , 'useSocket ' );
@@ -404,7 +405,7 @@ public function provideSqlDataWillBeReturnedWithType()
404
405
*/
405
406
public function testQueryValueInStatementResolvesWithResultWithTypeAndRunsUntilQuit ($ value , $ expected )
406
407
{
407
- $ loop = \ React \ EventLoop \Factory:: create ();
408
+ $ loop = Loop:: get ();
408
409
$ factory = new Factory ($ loop );
409
410
410
411
$ promise = $ factory ->open (':memory: ' );
@@ -447,7 +448,7 @@ public function provideDataWillBeReturnedWithType()
447
448
*/
448
449
public function testQueryValuePlaceholderPositionalResolvesWithResultWithExactTypeAndRunsUntilQuit ($ value , $ type )
449
450
{
450
- $ loop = \ React \ EventLoop \Factory:: create ();
451
+ $ loop = Loop:: get ();
451
452
$ factory = new Factory ($ loop );
452
453
453
454
$ promise = $ factory ->open (':memory: ' );
@@ -472,7 +473,7 @@ public function testQueryValuePlaceholderPositionalResolvesWithResultWithExactTy
472
473
*/
473
474
public function testQueryValuePlaceholderNamedResolvesWithResultWithExactTypeAndRunsUntilQuit ($ value , $ type )
474
475
{
475
- $ loop = \ React \ EventLoop \Factory:: create ();
476
+ $ loop = Loop:: get ();
476
477
$ factory = new Factory ($ loop );
477
478
478
479
$ promise = $ factory ->open (':memory: ' );
@@ -506,7 +507,7 @@ public function provideDataWillBeReturnedWithOtherType()
506
507
*/
507
508
public function testQueryValuePlaceholderPositionalResolvesWithResultWithOtherTypeAndRunsUntilQuit ($ value , $ expected )
508
509
{
509
- $ loop = \ React \ EventLoop \Factory:: create ();
510
+ $ loop = Loop:: get ();
510
511
$ factory = new Factory ($ loop );
511
512
512
513
$ promise = $ factory ->open (':memory: ' );
@@ -532,7 +533,7 @@ public function testQueryValuePlaceholderPositionalResolvesWithResultWithOtherTy
532
533
*/
533
534
public function testQueryValuePlaceholderNamedResolvesWithResultWithOtherTypeAndRunsUntilQuit ($ value , $ expected )
534
535
{
535
- $ loop = \ React \ EventLoop \Factory:: create ();
536
+ $ loop = Loop:: get ();
536
537
$ factory = new Factory ($ loop );
537
538
538
539
$ promise = $ factory ->open (':memory: ' );
@@ -557,7 +558,7 @@ public function testQueryValuePlaceholderNamedResolvesWithResultWithOtherTypeAnd
557
558
*/
558
559
public function testQueryRejectsWhenQueryIsInvalid ($ flag )
559
560
{
560
- $ loop = \ React \ EventLoop \Factory:: create ();
561
+ $ loop = Loop:: get ();
561
562
$ factory = new Factory ($ loop );
562
563
563
564
$ ref = new \ReflectionProperty ($ factory , 'useSocket ' );
@@ -582,7 +583,7 @@ public function testQueryRejectsWhenQueryIsInvalid($flag)
582
583
*/
583
584
public function testQueryRejectsWhenClosedImmediately ($ flag )
584
585
{
585
- $ loop = \ React \ EventLoop \Factory:: create ();
586
+ $ loop = Loop:: get ();
586
587
$ factory = new Factory ($ loop );
587
588
588
589
$ ref = new \ReflectionProperty ($ factory , 'useSocket ' );
@@ -607,7 +608,7 @@ public function testQueryRejectsWhenClosedImmediately($flag)
607
608
*/
608
609
public function testExecCreateTableResolvesWithResultWithoutRows ($ flag )
609
610
{
610
- $ loop = \ React \ EventLoop \Factory:: create ();
611
+ $ loop = Loop:: get ();
611
612
$ factory = new Factory ($ loop );
612
613
613
614
$ ref = new \ReflectionProperty ($ factory , 'useSocket ' );
@@ -636,7 +637,7 @@ public function testExecCreateTableResolvesWithResultWithoutRows($flag)
636
637
*/
637
638
public function testExecRejectsWhenClosedImmediately ($ flag )
638
639
{
639
- $ loop = \ React \ EventLoop \Factory:: create ();
640
+ $ loop = Loop:: get ();
640
641
$ factory = new Factory ($ loop );
641
642
642
643
$ ref = new \ReflectionProperty ($ factory , 'useSocket ' );
@@ -661,7 +662,7 @@ public function testExecRejectsWhenClosedImmediately($flag)
661
662
*/
662
663
public function testExecRejectsWhenAlreadyClosed ($ flag )
663
664
{
664
- $ loop = \ React \ EventLoop \Factory:: create ();
665
+ $ loop = Loop:: get ();
665
666
$ factory = new Factory ($ loop );
666
667
667
668
$ ref = new \ReflectionProperty ($ factory , 'useSocket ' );
@@ -685,7 +686,7 @@ public function testExecRejectsWhenAlreadyClosed($flag)
685
686
*/
686
687
public function testQueryInsertResolvesWithEmptyResultSetWithLastInsertIdAndRunsUntilQuit ($ flag )
687
688
{
688
- $ loop = \ React \ EventLoop \Factory:: create ();
689
+ $ loop = Loop:: get ();
689
690
$ factory = new Factory ($ loop );
690
691
691
692
$ ref = new \ReflectionProperty ($ factory , 'useSocket ' );
@@ -718,7 +719,7 @@ public function testQueryInsertResolvesWithEmptyResultSetWithLastInsertIdAndRuns
718
719
*/
719
720
public function testQuerySelectEmptyResolvesWithEmptyResultSetWithColumnsAndNoRowsAndRunsUntilQuit ($ flag )
720
721
{
721
- $ loop = \ React \ EventLoop \Factory:: create ();
722
+ $ loop = Loop:: get ();
722
723
$ factory = new Factory ($ loop );
723
724
724
725
$ ref = new \ReflectionProperty ($ factory , 'useSocket ' );
0 commit comments