summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDaniel Weipert <code@drogueronin.de>2023-11-12 11:16:56 +0100
committerDaniel Weipert <code@drogueronin.de>2023-11-20 17:30:04 +0100
commit6df3d321d9b67c4541f50158b087d37c4b22e886 (patch)
tree06031988bb4b957b76f051af366ced448a48545f /test
initial commit
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