From 28be862af317fd1510a452129e9131bd81042ca8 Mon Sep 17 00:00:00 2001
From: "Hahn Axel (hahn)" <axel.hahn@unibe.ch>
Date: Mon, 3 Mar 2025 17:08:17 +0100
Subject: [PATCH] add phpmodules, ping

---
 TODO.md                      |  4 ++--
 tests/200_phpmodules.php     |  7 +++++++
 tests/200_ping.php           |  7 +++++++
 tests/configs/phpmodules.ini | 23 +++++++++++++++++++++++
 tests/configs/ping.ini       | 22 ++++++++++++++++++++++
 5 files changed, 61 insertions(+), 2 deletions(-)
 create mode 100644 tests/200_phpmodules.php
 create mode 100644 tests/200_ping.php
 create mode 100644 tests/configs/phpmodules.ini
 create mode 100644 tests/configs/ping.ini

diff --git a/TODO.md b/TODO.md
index 4937271..cb6d7f8 100644
--- a/TODO.md
+++ b/TODO.md
@@ -26,8 +26,8 @@ was ich so sehe ...
     ✅ Loadmeter
     ✅ MysqlConnect -> mysqli->real_connect() Fatal error: Uncaught mysqli_sql_exception: No such file or directory
     ✅ PdoConnect
-    ⬜ Phpmodules
-    ⬜ Ping
+    ✅ Phpmodules -> funcktioniert formal, aber bei Nicht-PHP-Apps nicht relevant; getestet werden die im Binary eincomoilierten Module
+    ✅ Ping
     ⬜ PortTcp
     ⬜ Simple
     ⬜ SqliteConnect
diff --git a/tests/200_phpmodules.php b/tests/200_phpmodules.php
new file mode 100644
index 0000000..967f259
--- /dev/null
+++ b/tests/200_phpmodules.php
@@ -0,0 +1,7 @@
+#!/usr/bin/env php
+<?php
+
+echo "
+WHAT: Run check phpmodules
+";
+_exec("$AMCLI --ini='".__DIR__."/configs/phpmodules.ini'");
diff --git a/tests/200_ping.php b/tests/200_ping.php
new file mode 100644
index 0000000..3cca6e2
--- /dev/null
+++ b/tests/200_ping.php
@@ -0,0 +1,7 @@
+#!/usr/bin/env php
+<?php
+
+echo "
+WHAT: Run check ping
+";
+_exec("$AMCLI --ini='".__DIR__."/configs/ping.ini'");
diff --git a/tests/configs/phpmodules.ini b/tests/configs/phpmodules.ini
new file mode 100644
index 0000000..9355b44
--- /dev/null
+++ b/tests/configs/phpmodules.ini
@@ -0,0 +1,23 @@
+; =======================================================================
+;
+; APPMONITOR CLI CLIENT
+;
+; for the checks see its parameters
+; <https://os-docs.iml.unibe.ch/appmonitor/PHP_client/Plugins/Checks/index.html>
+;
+; =======================================================================
+
+
+; -----------------------------------------------------------------------
+; CHECKS
+; -----------------------------------------------------------------------
+
+["PHP modules"]
+description="Modules test"
+function="Phpmodules"
+params='{
+    "required": ["pdo", "json"],
+    "optional": ["curl"]
+}'
+
+; -----------------------------------------------------------------------
diff --git a/tests/configs/ping.ini b/tests/configs/ping.ini
new file mode 100644
index 0000000..c1b848d
--- /dev/null
+++ b/tests/configs/ping.ini
@@ -0,0 +1,22 @@
+; =======================================================================
+;
+; APPMONITOR CLI CLIENT
+;
+; for the checks see its parameters
+; <https://os-docs.iml.unibe.ch/appmonitor/PHP_client/Plugins/Checks/index.html>
+;
+; =======================================================================
+
+
+; -----------------------------------------------------------------------
+; CHECKS
+; -----------------------------------------------------------------------
+
+["Ping"]
+description="Ping www.example.com"
+function="Ping"
+params='{
+    "host": "www.example.com"
+}'
+
+; -----------------------------------------------------------------------
-- 
GitLab