Simple quiz demo.
- Checkout the repo and run
composer install
. - Create MySQL/MariaDB database and user and update credentials in
class/Database.php
- Use file
quiz.sql
to fill the database.
To run execute:
php quiz.php '{"userId":1}'
to get a question
or
php quiz.php '{"userId":1,"answerId":4}'
to set an answer and to get the next question.
For a weekly rewards a cron should be set.
See instructions in file cron.php
Execute ./test.sh
Included tests:
- test for PSR2 (PHP CodeSniffer)
- test for PHP mess (phpmd)
- Unit tests (PHPUnit)