Open NateWr opened 6 years ago
I'd love an assist on this one from someone with PHPUnit experience. :smile:
Catch me on Slack!
@NateWr and @asmecher
Here's an initial work.
https://github.com/kaschioudi/ojs3-rest-api-tests
Please take a look and give your feedback. thanks.
@kaschioudi, rather than writing these as a separate repository, I'd suggest putting them alongside the existing tests in lib/pkp/tests
(for shared code) and tests
(for OJS-specific tests). There are patterns there to follow for existing tests.
(https://pkp.sfu.ca/wiki/index.php?title=Developer_Documentation#Testing is dated but has some information on how to get the current unit tests etc. running locally.)
@asmecher : Alright. Actually this was just in order to validate the approach. Anyhow, I will checkout the existing codebase and consolidate everything.
Thanks, @kaschioudi -- I've added some comments to the PRs. Generally this is taking shape well, but needs some sharing with the pkp-lib
library where possible, and I'm also interested in using the Swagger doc to validate rather than writing assertions that partially reiterate what it already declares.
We should introduce tests for the REST API in OJS. It looks like some tools exist for generating tests from a
swagger.yaml
file. This would be great if we can integreate it. It will allow us to design the documentation and tests first, and build the API to match the tests.swagger-codegen seems to build tests for PHPUnit: https://github.com/swagger-api/swagger-codegen/issues/2276
swagger-test looks like another toolset to investigate: https://github.com/byjg/php-swagger-test
cc @kaschioudi