Container uses PHP 8.2. Expectation is that solutions provided should use modern PHP where appropriate.
You will need php, composer & docker in order to complete this challenge.
Please clone this repository and then follow the below steps from there. Do not directly commit or create a pull request to this repo.
cd plugin
composer install
cd ..
docker compose up -d
You can open the post type admin panel once the containers are running. As the database container is created with a seed database it may not be immediately available (this normally takes only a couple of seconds to apply).
Username: admin
Password: X4JCRpiMLDW783oT3%
This technical challenge is broken into 2 steps: fixing issues, & a refactoring of the existing class.
You should complete these 2 steps in order and at least commit once at the end of each step.
A project (ID: 28
) already exists in the seed database. This project will be used for the API specification tests.
Find & fix this issue. You will be asked about your approach to diagnosing the issue.
Again, you will be asked about your approach to diagnosing the issue & any alternative solutions you may have considered.
These inputs currently accept empty values. This behaviour should be corrected.
spec.yaml contains an agreed API contract. Update the API output to meet this contract.
To test the output ensure the docker containers are running & execute:
# from root of the project
php plugin/openapi/test.php
This will yield either an ERROR: {message}
or OK
result.
An example unit test exists utilising BrainMonkey for mocking WordPress functions. This should assist with any unit testing, but feel free to consult their documentation
ProjectPostType breaks SOLID principles. Provide comments in the code briefly describing what you feel should change, why & how. If you have extra time is insuffient, then feel free to implement some of your suggestions.
Your solution after refactoring should demonstrate modern php syntax, should be readable & well tested.