Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test Coverage #123

Open
philipjohn opened this issue Dec 4, 2016 · 4 comments
Open

Test Coverage #123

philipjohn opened this issue Dec 4, 2016 · 4 comments

Comments

@philipjohn
Copy link
Contributor

There are no automated tests for this plugin, which is a shame.

We should ensure good test coverage for checking existing functionality is free of obvious bugs and that new contributions don't introduce regressions.

@philipjohn
Copy link
Contributor Author

Basic functionality:

  • Add/edit/delete Sitegroups
  • Add/edit/delete sites of each type
  • RSS (pull) operations
  • XML (pull) operations
  • XML-RPC (push) operations (would probably have to use Multisite for tests)
  • WordPress.com REST (push) (it's possible to run tests on wpcom but this may need to be snowflaked)

@philipjohn
Copy link
Contributor Author

Some progress in test-coverage

@MattGeri
Copy link

@philipjohn I've completed all the tests except for the PUSH operations.

You've mentioned that for the XML RPC push tests, we should probably use Multisite, however when running tests, a web server is not involved and so it wouldn't be possible to send requests from one site to another.

The only option here is mocking. However the code isn't written using dependency injection so it's quite difficult. What I am currently thinking is that we try intercept the HTTP calls and return the response we expect to get from the XMLRPC service. The same would go for the REST service.

What do you think of the above? Any other suggestions?

@MattGeri
Copy link

@philipjohn I went ahead and implemented the interceptor for the XMLRPC push syndications. You can see how it was implemented here:

https://github.com/xwp/syndication/blob/a69191b841e887f416bcbf4e4825fccea1eb7cde/tests/clients/test-xml-push-client.php

It's somewhat hackish, but it works and implements a real XMLRPC service, so that tests are pretty solid. It also uses a multisite instance to send the requests from one blog to another and tests the results on the other side.

Let me know your thoughts. PR #136 is ready for final review. It doesn't include REST tests because I will write those as part of issue #116

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants