Files
mahak-authenticate-bridge/test/README.md
T

40 lines
994 B
Markdown

# 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