summaryrefslogtreecommitdiff
path: root/tests/psr-worker-bench.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/psr-worker-bench.php')
-rw-r--r--tests/psr-worker-bench.php24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/psr-worker-bench.php b/tests/psr-worker-bench.php
new file mode 100644
index 00000000..d382098a
--- /dev/null
+++ b/tests/psr-worker-bench.php
@@ -0,0 +1,24 @@
+<?php
+
+use Spiral\RoadRunner;
+use Nyholm\Psr7\Factory;
+
+ini_set('display_errors', 'stderr');
+include "vendor/autoload.php";
+
+$worker = new RoadRunner\Http\PSR7Worker(
+ RoadRunner\Worker::create(),
+ new Factory\Psr17Factory(),
+ new Factory\Psr17Factory(),
+ new Factory\Psr17Factory()
+);
+
+while ($req = $worker->waitRequest()) {
+ try {
+ $rsp = new \Nyholm\Psr7\Response();
+ $rsp->getBody()->write("hello world");
+ $worker->respond($rsp);
+ } catch (\Throwable $e) {
+ $worker->getWorker()->error((string)$e);
+ }
+} \ No newline at end of file