Files

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 test/run-authentication-test.sh

If Docker requires root on your machine:

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:

KEEP_TEST_ENV=1 bash test/run-authentication-test.sh

Use another host port if 8080 is busy:

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