[Phpmyadmin-devel] PHPUnit tests 'Mock Objects' | Initialization Problem

Hi everyone, I'm fixing automated test-'testCreateIncidentFromBugReport()' for error-reporting-server and need a little help with 'Mock Objects'. See L#263 [0]. Because of 'will($this->returnValue(true))' there, 'Incident:save()' method of the mock object returns 'true' inside 'Incident::createIncidentFromBugReport()' (called at [3]). Now, I want to make 'save()' method of the mock object to do initialization of '$this' (incident object on which it operates). It is necessary because 'Incident::createIncidentFromBugReport()' is designed to return array of ids of newly created incidents [1]. Currently '$this' is not initialized and that's why '$this->id' is 'bool(false)' [2] in the log. How can that be done?? Is there any method like 'returnValue()' to achieve that?? [0]: https://github.com/dhananjay92/error-reporting-server/compare/b71453d3eaf4..... [1]: https://github.com/dhananjay92/error-reporting-server/compare/b71453d3eaf4..... [2]: https://travis-ci.org/dhananjay92/error-reporting-server/jobs/26998211#L259 [3]: https://github.com/dhananjay92/error-reporting-server/compare/b71453d3eaf4..... Thanks, Dhananjay Nakrani.
participants (1)
-
Dhananjay Nakrani