From 1b14e7f01bc4303c67c03210179661c9544c38ce Mon Sep 17 00:00:00 2001
From: Jan Wennrich <jan.wennrich@pcsg.de>
Date: Fri, 24 May 2024 17:07:39 +0200
Subject: [PATCH] chore: setup PHPUnit for project tooling

---
 .gitignore                  |  4 ++++
 .phive/phars.xml            |  1 +
 phpunit.dist.xml            |  8 ++++++++
 tests/phpunit-bootstrap.php | 11 +++++++++++
 4 files changed, 24 insertions(+)
 create mode 100644 phpunit.dist.xml
 create mode 100644 tests/phpunit-bootstrap.php

diff --git a/.gitignore b/.gitignore
index bb11804..e25391c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,3 +5,7 @@ phpunit.xml
 tools/
 
 phpstan.neon
+
+.phpunit.result.cache
+
+phpunit.xml
diff --git a/.phive/phars.xml b/.phive/phars.xml
index f909b52..6984891 100644
--- a/.phive/phars.xml
+++ b/.phive/phars.xml
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <phive xmlns="https://phar.io/phive">
   <phar name="phpstan" version="1.11.1" installed="1.11.1" location="./tools/phpstan" copy="false"/>
+  <phar name="phpunit" version="^10.5.20" installed="10.5.20" location="./tools/phpunit" copy="false"/>
 </phive>
diff --git a/phpunit.dist.xml b/phpunit.dist.xml
new file mode 100644
index 0000000..f6c7bec
--- /dev/null
+++ b/phpunit.dist.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<phpunit bootstrap="tests/phpunit-bootstrap.php">
+    <testsuites>
+        <testsuite name="Tests">
+            <directory>tests/</directory>
+        </testsuite>
+    </testsuites>
+</phpunit>
diff --git a/tests/phpunit-bootstrap.php b/tests/phpunit-bootstrap.php
new file mode 100644
index 0000000..eca92fd
--- /dev/null
+++ b/tests/phpunit-bootstrap.php
@@ -0,0 +1,11 @@
+<?php
+
+if (!defined('QUIQQER_SYSTEM')) {
+    define('QUIQQER_SYSTEM', true);
+}
+
+if (!defined('QUIQQER_AJAX')) {
+    define('QUIQQER_AJAX', true);
+}
+
+require_once __DIR__ . '/../../../../bootstrap.php';
-- 
GitLab