This project is using docker to run required containers. It will create PHP, nginx, postgres and pgadmin containers.
git clone [email protected]:tjodalv/undabot_demo.git undabot_demo
cd undabot_demo
The easiest way is just to copy .env.example file like this:
cp .env.example .env
docker compose up
You can optionally use -d
flag to run the containers in background mode. like this:
docker compose up -d
Enter app container to install composer dependencies with command:
docker compose exec -it app bash
composer install
Create database tables with command:
php bin/console doctrine:migrations:migrate
Now you can run the project in the browser with this URL:
http://localhost:11223/score?term=php
It should return JSON with term and it's score. The score is decimal number between 0-10 calculated as ratio of positive results and total results. If you do not provide the term to search for, service will return JSON error response with status code 400.
To run the tests first create the test database with these commands from within app container:
php bin/console --env=test doctrine:database:create
And then with this command create schema and tables in the database:
php bin/console --env=test doctrine:schema:create
Now you are ready to run tests with command:
php bin/phpunit