diff --git a/.gitignore b/.gitignore
index d34e123..528d586 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,3 +2,4 @@ node_modules
vendor
composer.lock
js/dist
+.phpunit.result.cache
diff --git a/composer.json b/composer.json
index 5150fb2..4563316 100644
--- a/composer.json
+++ b/composer.json
@@ -71,13 +71,30 @@
"flarum/subscriptions": "*",
"flarum/phpstan": "*",
"flarum/mentions": "*",
- "flarum/gdpr": "dev-main"
+ "flarum/gdpr": "dev-main",
+ "flarum/testing": "^1.0.0"
+ },
+ "autoload-dev": {
+ "psr-4": {
+ "FoF\\FollowTags\\": "tests/"
+ }
},
"scripts": {
"analyse:phpstan": "phpstan analyse",
- "clear-cache:phpstan": "phpstan clear-result-cache"
+ "clear-cache:phpstan": "phpstan clear-result-cache",
+ "test": [
+ "@test:unit",
+ "@test:integration"
+ ],
+ "test:unit": "phpunit -c tests/phpunit.unit.xml",
+ "test:integration": "phpunit -c tests/phpunit.integration.xml",
+ "test:setup": "@php tests/integration/setup.php"
},
"scripts-descriptions": {
- "analyse:phpstan": "Run static analysis"
+ "analyse:phpstan": "Run static analysis",
+ "test": "Runs all tests.",
+ "test:unit": "Runs all unit tests.",
+ "test:integration": "Runs all integration tests.",
+ "test:setup": "Sets up a database for use with integration tests. Execute this only once."
}
}
diff --git a/tests/fixtures/.gitkeep b/tests/fixtures/.gitkeep
new file mode 100644
index 0000000..e69de29
diff --git a/tests/integration/setup.php b/tests/integration/setup.php
new file mode 100644
index 0000000..5f24462
--- /dev/null
+++ b/tests/integration/setup.php
@@ -0,0 +1,9 @@
+run();
diff --git a/tests/phpunit.integration.xml b/tests/phpunit.integration.xml
new file mode 100644
index 0000000..90fbbff
--- /dev/null
+++ b/tests/phpunit.integration.xml
@@ -0,0 +1,25 @@
+
+
+
+
+ ../src/
+
+
+
+
+ ./integration
+ ./integration/tmp
+
+
+
diff --git a/tests/phpunit.unit.xml b/tests/phpunit.unit.xml
new file mode 100644
index 0000000..d3a4a3e
--- /dev/null
+++ b/tests/phpunit.unit.xml
@@ -0,0 +1,27 @@
+
+
+
+
+ ../src/
+
+
+
+
+ ./unit
+
+
+
+
+
+
diff --git a/tests/unit/.gitkeep b/tests/unit/.gitkeep
new file mode 100644
index 0000000..e69de29