You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.