Skip to content

Commit a048f8a

Browse files
committed
Use new Eventloop in tests
1 parent c788322 commit a048f8a

File tree

1 file changed

+26
-25
lines changed

1 file changed

+26
-25
lines changed

tests/FunctionalDatabaseTest.php

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use Clue\React\SQLite\Factory;
77
use Clue\React\SQLite\Result;
88
use PHPUnit\Framework\TestCase;
9+
use React\EventLoop\Loop;
910

1011
class FunctionalDatabaseTest extends TestCase
1112
{
@@ -24,7 +25,7 @@ public function provideSocketFlags()
2425
*/
2526
public function testOpenMemoryDatabaseResolvesWithDatabaseAndRunsUntilClose($flag)
2627
{
27-
$loop = \React\EventLoop\Factory::create();
28+
$loop = Loop::get();
2829
$factory = new Factory($loop);
2930

3031
$ref = new \ReflectionProperty($factory, 'useSocket');
@@ -50,7 +51,7 @@ public function testOpenMemoryDatabaseResolvesWithDatabaseAndRunsUntilClose($fla
5051
*/
5152
public function testOpenMemoryDatabaseResolvesWithDatabaseAndRunsUntilQuit($flag)
5253
{
53-
$loop = \React\EventLoop\Factory::create();
54+
$loop = Loop::get();
5455
$factory = new Factory($loop);
5556

5657
$ref = new \ReflectionProperty($factory, 'useSocket');
@@ -79,7 +80,7 @@ public function testOpenMemoryDatabaseShouldNotInheritActiveFileDescriptors()
7980
$this->markTestSkipped('Platform does not prevent binding to same address (Windows?)');
8081
}
8182

82-
$loop = \React\EventLoop\Factory::create();
83+
$loop = Loop::get();
8384
$factory = new Factory($loop);
8485

8586
$promise = $factory->open(':memory:');
@@ -117,7 +118,7 @@ public function testOpenMemoryDatabaseShouldNotInheritActiveFileDescriptors()
117118
*/
118119
public function testOpenInvalidPathRejects($flag)
119120
{
120-
$loop = \React\EventLoop\Factory::create();
121+
$loop = Loop::get();
121122
$factory = new Factory($loop);
122123

123124
$ref = new \ReflectionProperty($factory, 'useSocket');
@@ -140,7 +141,7 @@ public function testOpenInvalidPathRejects($flag)
140141
*/
141142
public function testOpenInvalidPathWithNullByteRejects($flag)
142143
{
143-
$loop = \React\EventLoop\Factory::create();
144+
$loop = Loop::get();
144145
$factory = new Factory($loop);
145146

146147
$ref = new \ReflectionProperty($factory, 'useSocket');
@@ -163,7 +164,7 @@ public function testOpenInvalidPathWithNullByteRejects($flag)
163164
*/
164165
public function testOpenInvalidFlagsRejects($flag)
165166
{
166-
$loop = \React\EventLoop\Factory::create();
167+
$loop = Loop::get();
167168
$factory = new Factory($loop);
168169

169170
$ref = new \ReflectionProperty($factory, 'useSocket');
@@ -186,7 +187,7 @@ public function testOpenInvalidFlagsRejects($flag)
186187
*/
187188
public function testQuitResolvesAndRunsUntilQuit($flag)
188189
{
189-
$loop = \React\EventLoop\Factory::create();
190+
$loop = Loop::get();
190191
$factory = new Factory($loop);
191192

192193
$ref = new \ReflectionProperty($factory, 'useSocket');
@@ -214,7 +215,7 @@ public function testQuitResolvesAndRunsUntilQuitWhenParentHasManyFileDescriptors
214215
$servers[] = stream_socket_server('tcp://127.0.0.1:0');
215216
}
216217

217-
$loop = \React\EventLoop\Factory::create();
218+
$loop = Loop::get();
218219
$factory = new Factory($loop);
219220

220221
$ref = new \ReflectionProperty($factory, 'useSocket');
@@ -241,7 +242,7 @@ public function testQuitResolvesAndRunsUntilQuitWhenParentHasManyFileDescriptors
241242
*/
242243
public function testQuitTwiceWillRejectSecondCall($flag)
243244
{
244-
$loop = \React\EventLoop\Factory::create();
245+
$loop = Loop::get();
245246
$factory = new Factory($loop);
246247

247248
$ref = new \ReflectionProperty($factory, 'useSocket');
@@ -265,7 +266,7 @@ public function testQuitTwiceWillRejectSecondCall($flag)
265266
*/
266267
public function testQueryIntegerResolvesWithResultWithTypeIntegerAndRunsUntilQuit($flag)
267268
{
268-
$loop = \React\EventLoop\Factory::create();
269+
$loop = Loop::get();
269270
$factory = new Factory($loop);
270271

271272
$ref = new \ReflectionProperty($factory, 'useSocket');
@@ -294,7 +295,7 @@ public function testQueryIntegerResolvesWithResultWithTypeIntegerAndRunsUntilQui
294295
*/
295296
public function testQueryStringResolvesWithResultWithTypeStringAndRunsUntilQuit($flag)
296297
{
297-
$loop = \React\EventLoop\Factory::create();
298+
$loop = Loop::get();
298299
$factory = new Factory($loop);
299300

300301
$ref = new \ReflectionProperty($factory, 'useSocket');
@@ -323,7 +324,7 @@ public function testQueryStringResolvesWithResultWithTypeStringAndRunsUntilQuit(
323324
*/
324325
public function testQueryInvalidTableRejectsWithExceptionAndRunsUntilQuit($flag)
325326
{
326-
$loop = \React\EventLoop\Factory::create();
327+
$loop = Loop::get();
327328
$factory = new Factory($loop);
328329

329330
$ref = new \ReflectionProperty($factory, 'useSocket');
@@ -352,7 +353,7 @@ public function testQueryInvalidTableRejectsWithExceptionAndRunsUntilQuit($flag)
352353
*/
353354
public function testQueryInvalidTableWithPlaceholderRejectsWithExceptionAndRunsUntilQuit($flag)
354355
{
355-
$loop = \React\EventLoop\Factory::create();
356+
$loop = Loop::get();
356357
$factory = new Factory($loop);
357358

358359
$ref = new \ReflectionProperty($factory, 'useSocket');
@@ -404,7 +405,7 @@ public function provideSqlDataWillBeReturnedWithType()
404405
*/
405406
public function testQueryValueInStatementResolvesWithResultWithTypeAndRunsUntilQuit($value, $expected)
406407
{
407-
$loop = \React\EventLoop\Factory::create();
408+
$loop = Loop::get();
408409
$factory = new Factory($loop);
409410

410411
$promise = $factory->open(':memory:');
@@ -447,7 +448,7 @@ public function provideDataWillBeReturnedWithType()
447448
*/
448449
public function testQueryValuePlaceholderPositionalResolvesWithResultWithExactTypeAndRunsUntilQuit($value, $type)
449450
{
450-
$loop = \React\EventLoop\Factory::create();
451+
$loop = Loop::get();
451452
$factory = new Factory($loop);
452453

453454
$promise = $factory->open(':memory:');
@@ -472,7 +473,7 @@ public function testQueryValuePlaceholderPositionalResolvesWithResultWithExactTy
472473
*/
473474
public function testQueryValuePlaceholderNamedResolvesWithResultWithExactTypeAndRunsUntilQuit($value, $type)
474475
{
475-
$loop = \React\EventLoop\Factory::create();
476+
$loop = Loop::get();
476477
$factory = new Factory($loop);
477478

478479
$promise = $factory->open(':memory:');
@@ -506,7 +507,7 @@ public function provideDataWillBeReturnedWithOtherType()
506507
*/
507508
public function testQueryValuePlaceholderPositionalResolvesWithResultWithOtherTypeAndRunsUntilQuit($value, $expected)
508509
{
509-
$loop = \React\EventLoop\Factory::create();
510+
$loop = Loop::get();
510511
$factory = new Factory($loop);
511512

512513
$promise = $factory->open(':memory:');
@@ -532,7 +533,7 @@ public function testQueryValuePlaceholderPositionalResolvesWithResultWithOtherTy
532533
*/
533534
public function testQueryValuePlaceholderNamedResolvesWithResultWithOtherTypeAndRunsUntilQuit($value, $expected)
534535
{
535-
$loop = \React\EventLoop\Factory::create();
536+
$loop = Loop::get();
536537
$factory = new Factory($loop);
537538

538539
$promise = $factory->open(':memory:');
@@ -557,7 +558,7 @@ public function testQueryValuePlaceholderNamedResolvesWithResultWithOtherTypeAnd
557558
*/
558559
public function testQueryRejectsWhenQueryIsInvalid($flag)
559560
{
560-
$loop = \React\EventLoop\Factory::create();
561+
$loop = Loop::get();
561562
$factory = new Factory($loop);
562563

563564
$ref = new \ReflectionProperty($factory, 'useSocket');
@@ -582,7 +583,7 @@ public function testQueryRejectsWhenQueryIsInvalid($flag)
582583
*/
583584
public function testQueryRejectsWhenClosedImmediately($flag)
584585
{
585-
$loop = \React\EventLoop\Factory::create();
586+
$loop = Loop::get();
586587
$factory = new Factory($loop);
587588

588589
$ref = new \ReflectionProperty($factory, 'useSocket');
@@ -607,7 +608,7 @@ public function testQueryRejectsWhenClosedImmediately($flag)
607608
*/
608609
public function testExecCreateTableResolvesWithResultWithoutRows($flag)
609610
{
610-
$loop = \React\EventLoop\Factory::create();
611+
$loop = Loop::get();
611612
$factory = new Factory($loop);
612613

613614
$ref = new \ReflectionProperty($factory, 'useSocket');
@@ -636,7 +637,7 @@ public function testExecCreateTableResolvesWithResultWithoutRows($flag)
636637
*/
637638
public function testExecRejectsWhenClosedImmediately($flag)
638639
{
639-
$loop = \React\EventLoop\Factory::create();
640+
$loop = Loop::get();
640641
$factory = new Factory($loop);
641642

642643
$ref = new \ReflectionProperty($factory, 'useSocket');
@@ -661,7 +662,7 @@ public function testExecRejectsWhenClosedImmediately($flag)
661662
*/
662663
public function testExecRejectsWhenAlreadyClosed($flag)
663664
{
664-
$loop = \React\EventLoop\Factory::create();
665+
$loop = Loop::get();
665666
$factory = new Factory($loop);
666667

667668
$ref = new \ReflectionProperty($factory, 'useSocket');
@@ -685,7 +686,7 @@ public function testExecRejectsWhenAlreadyClosed($flag)
685686
*/
686687
public function testQueryInsertResolvesWithEmptyResultSetWithLastInsertIdAndRunsUntilQuit($flag)
687688
{
688-
$loop = \React\EventLoop\Factory::create();
689+
$loop = Loop::get();
689690
$factory = new Factory($loop);
690691

691692
$ref = new \ReflectionProperty($factory, 'useSocket');
@@ -718,7 +719,7 @@ public function testQueryInsertResolvesWithEmptyResultSetWithLastInsertIdAndRuns
718719
*/
719720
public function testQuerySelectEmptyResolvesWithEmptyResultSetWithColumnsAndNoRowsAndRunsUntilQuit($flag)
720721
{
721-
$loop = \React\EventLoop\Factory::create();
722+
$loop = Loop::get();
722723
$factory = new Factory($loop);
723724

724725
$ref = new \ReflectionProperty($factory, 'useSocket');

0 commit comments

Comments
 (0)