summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/client.php3
-rw-r--r--test/gemtext.php27
-rw-r--r--test/index.gmi17
-rw-r--r--test/server.php18
-rw-r--r--test/sub/index.gmi3
-rw-r--r--test/test.gmi4
6 files changed, 72 insertions, 0 deletions
diff --git a/test/client.php b/test/client.php
new file mode 100644
index 0000000..50cce95
--- /dev/null
+++ b/test/client.php
@@ -0,0 +1,3 @@
+<?php
+
+
diff --git a/test/gemtext.php b/test/gemtext.php
new file mode 100644
index 0000000..2cf7ed7
--- /dev/null
+++ b/test/gemtext.php
@@ -0,0 +1,27 @@
+<?php
+
+use GeminiFoundation\Gemtext;
+
+require dirname(__DIR__) . '/vendor/autoload.php';
+
+$parser = new Gemtext(<<<GEMTEXT
+ # heading
+
+ text
+
+ * listitem 1
+ * listitem 2
+
+ ```formatted
+ {
+ "key": "value"
+ }
+ ```
+
+ > quote
+
+ => /link
+ => /link link
+ GEMTEXT);
+
+var_dump($parser->parse());
diff --git a/test/index.gmi b/test/index.gmi
new file mode 100644
index 0000000..edc8190
--- /dev/null
+++ b/test/index.gmi
@@ -0,0 +1,17 @@
+# Gemini Foundation PHP library
+
+## How to setup a Gemini Server with the Gemini Foundation PHP library
+
+Step one
+* do it
+
+> just do it yoooo
+
+```php
+$server = new Server();
+$server->onRequest(new DocumentServer());
+$server->listen();
+```
+
+=> https://dweipert.de
+=> test.gmi
diff --git a/test/server.php b/test/server.php
new file mode 100644
index 0000000..c90942a
--- /dev/null
+++ b/test/server.php
@@ -0,0 +1,18 @@
+<?php
+
+use GeminiFoundation\Server;
+use GeminiFoundation\Server\RequestHandlers\DocumentServer;
+
+require dirname(__DIR__) . '/vendor/autoload.php';
+
+$server = new Server(
+ [
+ 'file' => __DIR__ . '/cert.pem',
+ 'key' => __DIR__ . '/key.rsa',
+ 'passphrase' => '',
+ ],
+);
+
+$server->onRequest(new DocumentServer(__DIR__));
+
+$server->listen();
diff --git a/test/sub/index.gmi b/test/sub/index.gmi
new file mode 100644
index 0000000..193cc4d
--- /dev/null
+++ b/test/sub/index.gmi
@@ -0,0 +1,3 @@
+subfolder
+
+=> /
diff --git a/test/test.gmi b/test/test.gmi
new file mode 100644
index 0000000..fb6db92
--- /dev/null
+++ b/test/test.gmi
@@ -0,0 +1,4 @@
+test
+
+=> /
+=> /sub