summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWolfy-J <[email protected]>2018-06-12 18:40:33 +0300
committerWolfy-J <[email protected]>2018-06-12 18:40:33 +0300
commit87571a4aa52c4267ed88a2246cf038d88cf5b4a3 (patch)
tree03d2742a6774e7f2ebbd3ebae73450af25a65cea
parent62518a119eb4c1372d6f1b6f1d0b75a017989c50 (diff)
tests!
-rw-r--r--php-src/tests/http/data.php18
-rw-r--r--php-src/tests/http/payload.php13
2 files changed, 31 insertions, 0 deletions
diff --git a/php-src/tests/http/data.php b/php-src/tests/http/data.php
new file mode 100644
index 00000000..c5e0bab0
--- /dev/null
+++ b/php-src/tests/http/data.php
@@ -0,0 +1,18 @@
+<?php
+
+use Psr\Http\Message\ResponseInterface;
+use Psr\Http\Message\ServerRequestInterface;
+
+function handleRequest(ServerRequestInterface $req, ResponseInterface $resp): ResponseInterface
+{
+
+ $data = $req->getParsedBody();
+
+ ksort($data);
+ ksort($data['arr']);
+ ksort($data['arr']['x']['y']);
+
+ $resp->getBody()->write(json_encode($data));
+
+ return $resp;
+} \ No newline at end of file
diff --git a/php-src/tests/http/payload.php b/php-src/tests/http/payload.php
new file mode 100644
index 00000000..a16984c5
--- /dev/null
+++ b/php-src/tests/http/payload.php
@@ -0,0 +1,13 @@
+<?php
+
+use Psr\Http\Message\ResponseInterface;
+use Psr\Http\Message\ServerRequestInterface;
+
+function handleRequest(ServerRequestInterface $req, ResponseInterface $resp): ResponseInterface
+{
+ // we expect json body
+ $p = json_decode($req->getBody(), true);
+ $resp->getBody()->write(json_encode(array_flip($p)));
+
+ return $resp;
+} \ No newline at end of file