In order to run this project you will need:
- Docker (https://www.docker.com/community-edition)
- Docker compose (https://docs.docker.com/compose/install/)
- Nginx
- PHP 7.3 (FPM)
- MySQL
If you use Linux or Mac a Makefile is included, so you can run these commands to start and stop all containers at once. Go to project root and run:
To start docker
make up
To stop docker
make down
- Install Docker and Docker compose
- If you use Windows copy
docker-compose.override.yml.windows
todocker-compose.override.yml
- In project root execute
make up
- Then execute
make php
and then you will be taken into php docker. - Execute
composer install
- Copy .env.example to .env and replace the fields if necessary.
- Go inside src folder (please, go inside don't run the command above from outside this folder)
- Execute
php yii migrate
to create tables // pwd : /var/www/html/src - If they not exist, create
runtime
andweb/assets
directories insidesrc
folder. - Execute
chmod -R 777 runtime && chmod -R 777 web/assets
- import the dumps found in additional to these databases: thn and thn_test
Base url: http://localhost:8097
In the additional folder you will have a collection of postman, please import it
- Nginx 80 / 8096
- PostgreSQL 3306 / 3010
- PHP-FPM 9000 (User & pass defined in docker-compose.yml)
We have Unit, Integration & Api test. All your work must be tested before send the Pull Request.
Test setup:
- Go to your database and create a new one called
thn_test
- Go to the config folder copy
test_params.example.php
totest_params.php
- Inside the docker container run from root
cd src/tests/bin && php yii migrate
Run test (go inside the docker and run it from root):
1.- docker exec -it php-api-container bash OR make php
2.- php vendor/bin/codecept run // for all (unit, integration, api)
or
composer test-u // for unit tersting
composer test-i // for integration tersting
composer test-a // for api tersting
- Config/routes.php
- Controllers
- Services
- Repositories
- Tests
- Unit
- Integration
- Api
- Additional
The test entails send by param the ID of any hotel that’s in database so the project returns:
- The basic data of the selected hotel
- Registered rooms
- Users who have booked rooms at the hotel
If you have come this far, thank you very much for your time. You can ask me questions to my email [email protected]