This is a solution for a test task v21.0.5.
- Compose V2 (docker compose CLI plugin, not a docker-compose V1);
- make
- yarn (optionally)
Clone this repository
git clone [email protected]:OleksiiBulba/test-task.git .
Run make commands to build and start containers:
make build # can take ~5-15 minutes
make up
When the containers are built, you need to run composer install:
make install # or
make vendor
then yarn install and build js. You can use yarn
on your system:
yarn install
yarn build # production
yarn dev # development
or use node container:
make yarn c='install'
make yarn c='build' # production
make yarn c='dev' # development
# -- or simpler --
make build-front # production
Also, you have to create .env.local
file in the root of the project and copy there your rapid API key:
# .env.local
RAPID_API_KEY=<your_key_here>
Refresh containers and/or cache:
make restart # stops & ups containers
make cc # symfony clear:cache command
After everything is built, installed and up, you can go to https://localhost/ and see the application running. You also will see a link in the navigation menu to a maildev to see outgoing emails.
To run tests:
make test
This command will run:
- Composer normalize command;
- Composer validate with strict command;
- Statics tests:
- phpstan;
- php-cs-fixer with dry run option;
- Unit and functional tests:
- Clear test env cache;
- phpunit with coverage option;
After phpunit coverage test you will find html-coverage
folder, you can open html-coverage/index.html
to check the project test coverage: its 100%.
To stop the project, run
make down
To see what containers are running, run:
docker compose ps -a
In case of troubleshooting, you can see container logs:
docker compose logs <container>
Also all available commands are shown by
make help
Task item list:
- Display a form with elements: symbol, start date, end date and email;
- Upon submit, validate the form on frontend and display validation error messages;
- Upon submit, validate the form on backend and display validation error messages;
- After the submitting, display on screen the historical quotes for the submitted Company Symbol in the given date range in the table format;
- Table should have: Date | Open | High | Low | Close | Volume;
- Based on the Historical data retrieved, display on screen a chart of the Open and Close prices;
- Send to the submitted Email an email message, using as: Subject: the submitted company’s name, Body: Start Date and End Date;
- Framework used is Symfony 6.2.*;
- Tests present;
- The user can select date range using similar to jQuery datepicker element: native
input[type="date"]
; - The chart library anychart is used;
- The project does not require to make changes to
/etc/hosts
orC:\Windows\System32\drivers\etc\hosts
file, you just need to make sure nothing is running on port 443 and start the project, it should be available at https://localhost/ (you might need to accept the auto-generated TLS certificate to open the page). Maildev should be available at http://localhost:8081/; - The project uses docker and compose for running (Symfony docker setup is used: https://github.com/dunglas/symfony-docker);
- 100% phpunit tests coverage;
- Heavily used DI so many parts can be decorated, adapted, replaced;
Start: 2023-04-24 09:50AM (UTC+4)
End: 2023-04-26 01:47AM (UTC+4)
Duration: 39h 57m
Oleksii Bulba [email protected]