66
77class ExtEventLoopTest extends AbstractLoopTest
88{
9- public function createLoop ()
9+ public function createLoop ($ readStreamCompatible = false )
1010 {
1111 if ('Linux ' === PHP_OS && !extension_loaded ('posix ' )) {
1212 $ this ->markTestSkipped ('libevent tests skipped on linux due to linux epoll issues. ' );
@@ -16,7 +16,13 @@ public function createLoop()
1616 $ this ->markTestSkipped ('ext-event tests skipped because ext-event is not installed. ' );
1717 }
1818
19- return new ExtEventLoop ();
19+ $ cfg = null ;
20+ if ($ readStreamCompatible ) {
21+ $ cfg = new \EventConfig ();
22+ $ cfg ->requireFeatures (\EventConfig::FEATURE_FDS );
23+ }
24+
25+ return new ExtEventLoop ($ cfg );
2026 }
2127
2228 public function createStream ()
@@ -56,4 +62,25 @@ public function writeToStream($stream, $content)
5662
5763 fwrite ($ stream , $ content );
5864 }
65+
66+ /**
67+ * @group epoll-readable-error
68+ */
69+ public function testCanUseReadableStreamWithFeatureFds ()
70+ {
71+ $ this ->loop = $ this ->createLoop (true );
72+
73+ $ input = fopen ('php://temp/maxmemory:0 ' , 'r+ ' );
74+
75+ fwrite ($ input , 'x ' );
76+ ftruncate ($ input , 0 );
77+
78+ $ this ->loop ->addReadStream ($ input , $ this ->expectCallableExactly (2 ));
79+
80+ $ this ->writeToStream ($ input , "foo \n" );
81+ $ this ->loop ->tick ();
82+
83+ $ this ->writeToStream ($ input , "bar \n" );
84+ $ this ->loop ->tick ();
85+ }
5986}
0 commit comments