This code test involves performing work on an existing Laravel project. The task is split into several sub-categories and shouldn't take longer than 2-4 hours of your time.
- This challenge requires Docker to be installed on your system. The easiest way to accomplish this is to install Docker Desktop.
- You should focus on code quality and structure.
- Wherever possible, try to follow the SOLID principles.
This repository has been set up for you to start right away. We are using Docker to ensure that this code challenge can be run locally on your machine, regardless of your installed system environment.
- The project can be brought up by running the following commands from the root directory of the project:
docker-compose up --remove-orphans
docker-compose run --rm php composer install
docker-compose run --rm php /var/www/artisan migrate:fresh --seed
docker-compose run --rm php /var/www/artisan l5-swagger:generate
You have been given access to a list of users.
The assignment is to add a column named nickname
(via a migration) to the database as well as updating the related endpoints.
- The GET request needs to include the new column.
- The POST request and the PUT request need to be able to change the value of the column asserting the following validation rules:
- A valid
nickname
must be unique among users. - A valid
nickname
must be shorter than 30 characters.
- A valid
- Documentation should be updated so Swagger can be generated and used to smoke test.
- We are using the open-source package L5-Swagger to generate OpenAPI Swagger.
- Tests
- Integration and Acceptance tests should be updated to reflect your changes
- Tests should be added to assert that your changes function as expected
- Tests should be added to assert that given "bad" cases will fail (assert failures)
- Please carefully review the existing codebase and find/fix(handle) any errors that you come across. For instance, make sure to handle 404 errors for all requests appropriately. Thoroughly test your fixes to ensure that the application behaves as expected under various scenarios.
- Feel free to add relevant comments and documentation in the code to explain any changes you make or any assumptions you may have made during the process.
- When you are ready to submit your work: do not open a PR.
- Instead, push your changes to a public repository on GitHub and email a link to [email protected].
- In the email please specify your name in the subject field.
- If you are developing on a Windows machine or an Intel Mac machine, you may need to remove
platform: linux/x86_64
from thedocker-compose.yml
file (under mysql) - The OpenAPI Swagger documentation can be generated on demand by running
docker-compose run --rm php /var/www/artisan l5-swagger:generate
in the root directory of the project.- This documentation can be viewed by navigating to http://localhost:7777/api/documentation.
- Don't worry about authentication.
- Tests can be run by executing the following commands:
docker exec -it mysql bash -c "mysql -u root -ppassword -e \"DROP DATABASE IF EXISTS testing; CREATE DATABASE testing\""
(creates the test DB)docker-compose run --rm php php /var/www/artisan test
(runs the tests)