Added a Docker-based fresh WordPress integration test

This commit is contained in:
2026-05-31 13:15:43 +03:30
parent 2703e956da
commit 6419f82ea5
7 changed files with 422 additions and 4 deletions
+39
View File
@@ -0,0 +1,39 @@
# Authentication Integration Test
This test starts a fresh WordPress site with PHP 7.4, installs and configures this plugin, then verifies JWT login through the real HTTP route.
Run from the project root:
```bash
bash test/run-authentication-test.sh
```
If Docker requires root on your machine:
```bash
sudo bash test/run-authentication-test.sh
```
The test resets its Docker volumes on every run. Set `KEEP_TEST_ENV=1` to leave WordPress running after the test:
```bash
KEEP_TEST_ENV=1 bash test/run-authentication-test.sh
```
Use another host port if `8080` is busy:
```bash
WORDPRESS_PORT=8081 bash test/run-authentication-test.sh
```
The test covers:
- PHP 7.4 syntax checks for all project PHP files
- fresh WordPress database installation
- plugin activation without unexpected output
- plugin option configuration
- valid HS256 JWT login
- created WordPress user lookup
- WordPress auth cookie issuance
- follow-up authenticated admin request
- invalid/tampered JWT rejection