Skip to content

Commit 3c3362a

Browse files
committed
Make timer tests run for all loops, contains failing libevent case
1 parent dc3727b commit 3c3362a

File tree

7 files changed

+52
-10
lines changed

7 files changed

+52
-10
lines changed

tests/React/Tests/EventLoop/LibEvLoopTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
namespace React\Tests\EventLoop;
44

5-
use React\EventLoop\LoopInterface;
65
use React\EventLoop\LibEvLoop;
76

87
class LibEvLoopTest extends AbstractLoopTest

tests/React/Tests/EventLoop/LibEventLoopTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
namespace React\Tests\EventLoop;
44

5-
use React\EventLoop\LoopInterface;
65
use React\EventLoop\LibEventLoop;
76

87
class LibEventLoopTest extends AbstractLoopTest

tests/React/Tests/EventLoop/StreamSelectLoopTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
namespace React\Tests\EventLoop;
44

5-
use React\EventLoop\LoopInterface;
65
use React\EventLoop\StreamSelectLoop;
76

87
class StreamSelectLoopTest extends AbstractLoopTest

tests/React/Tests/EventLoop/TimerTest.php renamed to tests/React/Tests/EventLoop/Timer/AbstractTimerTest.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
11
<?php
22

3-
namespace React\Tests\EventLoop;
3+
namespace React\Tests\EventLoop\Timer;
44

55
use React\Tests\Socket\TestCase;
6-
use React\EventLoop\StreamSelectLoop;
76
use React\EventLoop\Timer\Timers;
87

9-
class TimerTest extends TestCase
8+
abstract class AbstractTimerTest extends TestCase
109
{
11-
private function createLoop()
12-
{
13-
return new StreamSelectLoop();
14-
}
10+
abstract public function createLoop();
1511

1612
/**
1713
* @covers React\EventLoop\StreamSelectLoop::tick
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
3+
namespace React\Tests\EventLoop\Timer;
4+
5+
use React\EventLoop\LibEvLoop;
6+
7+
class LibEvTimerTest extends AbstractTimerTest
8+
{
9+
public function createLoop()
10+
{
11+
if (!class_exists('libev\EventLoop')) {
12+
$this->markTestSkipped('libev tests skipped because ext-libev is not installed.');
13+
}
14+
15+
return new LibEvLoop();
16+
}
17+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
3+
namespace React\Tests\EventLoop\Timer;
4+
5+
use React\EventLoop\LibEventLoop;
6+
7+
class LibEventTimerTest extends AbstractTimerTest
8+
{
9+
public function createLoop()
10+
{
11+
$this->markTestSkipped('libevent timers are currently broken.');
12+
13+
if (!function_exists('event_base_new')) {
14+
$this->markTestSkipped('libevent tests skipped because ext-libevent is not installed.');
15+
}
16+
17+
return new LibEventLoop();
18+
}
19+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
namespace React\Tests\EventLoop\Timer;
4+
5+
use React\EventLoop\StreamSelectLoop;
6+
7+
class StreamSelectTimerTest extends AbstractTimerTest
8+
{
9+
public function createLoop()
10+
{
11+
return new StreamSelectLoop();
12+
}
13+
}

0 commit comments

Comments
 (0)