aboutsummaryrefslogtreecommitdiffhomepage
path: root/assets/php/vendor/react/event-loop/tests/ExtLibeventLoopTest.php
diff options
context:
space:
mode:
authormarvin-borner@live.com2018-04-10 21:50:16 +0200
committermarvin-borner@live.com2018-04-10 21:54:48 +0200
commitfc9401f04a3aca5abb22f87ebc210de8afe11d32 (patch)
treeb0b310f3581764ec3955f4e496a05137a32951c3 /assets/php/vendor/react/event-loop/tests/ExtLibeventLoopTest.php
parent286d643180672f20526f3dc3bd19d7b751e2fa97 (diff)
Initial Commit
Diffstat (limited to 'assets/php/vendor/react/event-loop/tests/ExtLibeventLoopTest.php')
-rw-r--r--assets/php/vendor/react/event-loop/tests/ExtLibeventLoopTest.php58
1 files changed, 58 insertions, 0 deletions
diff --git a/assets/php/vendor/react/event-loop/tests/ExtLibeventLoopTest.php b/assets/php/vendor/react/event-loop/tests/ExtLibeventLoopTest.php
new file mode 100644
index 0000000..8497065
--- /dev/null
+++ b/assets/php/vendor/react/event-loop/tests/ExtLibeventLoopTest.php
@@ -0,0 +1,58 @@
+<?php
+
+namespace React\Tests\EventLoop;
+
+use React\EventLoop\ExtLibeventLoop;
+
+class ExtLibeventLoopTest extends AbstractLoopTest
+{
+ private $fifoPath;
+
+ public function createLoop()
+ {
+ if ('Linux' === PHP_OS && !extension_loaded('posix')) {
+ $this->markTestSkipped('libevent tests skipped on linux due to linux epoll issues.');
+ }
+
+ if (!function_exists('event_base_new')) {
+ $this->markTestSkipped('libevent tests skipped because ext-libevent is not installed.');
+ }
+
+ return new ExtLibeventLoop();
+ }
+
+ public function tearDown()
+ {
+ if (file_exists($this->fifoPath)) {
+ unlink($this->fifoPath);
+ }
+ }
+
+ public function createStream()
+ {
+ if ('Linux' !== PHP_OS) {
+ return parent::createStream();
+ }
+
+ $this->fifoPath = tempnam(sys_get_temp_dir(), 'react-');
+
+ unlink($this->fifoPath);
+
+ // Use a FIFO on linux to get around lack of support for disk-based file
+ // descriptors when using the EPOLL back-end.
+ posix_mkfifo($this->fifoPath, 0600);
+
+ $stream = fopen($this->fifoPath, 'r+');
+
+ return $stream;
+ }
+
+ public function writeToStream($stream, $content)
+ {
+ if ('Linux' !== PHP_OS) {
+ return parent::writeToStream($stream, $content);
+ }
+
+ fwrite($stream, $content);
+ }
+}