- PHP 8.3 (FPM) + Nginx (via Docker)
- The only library used is PHPunit
- This is not a real API, as per the task requirements. It is simulating API behaviour using
Router::handle()method. - There is
index.phpentry point which does work, but won't return much useful data due to absence of database (and will spit out html, not json). - It has no database, objects are stored in arrays, so the "real" API approach wouldn't even work properly. However, it does have "routes" for adding entities to be used in unit tests.
- I instantiate the
Routerclass directly in the tests and make calls to itshandle()method so the data can "live" during the test. - It is also returning http codes but only as a part of resulting json, to simulate api returns.
- For the sake of simplicity, all class properties are public, to avoid boilerplate getters/setters.
Student,Course,Enrolmentclasses have static arrays to hold created objects during the test run.ApiHydrationTestis testing data object creation / hydration and validation.ExerciseScenarioTestis using scenarios from the task description.
GET /access{ "name": "Emma", "course": "A-Level Biology", "date": "2025-05-30", "lesson": "Cell Structure"}POST /add/student{ "name": "Emma"}POST /add/course{ "name": "A-Level Biology", "startDate": "2025-05-01", "endDate": "2025-12-15", "lessons": [...], "homeworks": [...], "prepMaterials": [...]}POST /add/enrolment{ "name": "Emma", "course": "A-Level Biology", "startDate": "2025-05-01", "endDate": "2025-12-15"}