Skip to content

rosswald/lms-test

Repository files navigation

MyEdSpace Coding Assignment

  • 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.php entry 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 Router class directly in the tests and make calls to its handle() 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, Enrolment classes have static arrays to hold created objects during the test run.
  • ApiHydrationTest is testing data object creation / hydration and validation.
  • ExerciseScenarioTest is using scenarios from the task description.

Endpoints

  • 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"}

About

MyEdSpace Coding Exercise

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published