devinsays/portfolio-post-type — pull request #53 by GaryJones (2014-05-03 16:10:47+00:00)
Title: Introduce tests

Introduction of unit and integration tests. Not comprehensive, but the 4 tests / 6 assertions all currently pass (though #52 will make them fail so will need to be updated once that is merged).

My setup doesn't match the notes in bootstrap.php - I've got the plugin installed in a VVV (vagrant) instance under the wordpress-develop/src/wp-content/plugins directory, so that's the paths I've used. In theory, if your WP tests are elsewhere, you should be able to set `WP_TEST_DIR` accordingly and the bootstrap.php shouldn't need editing.

Plenty more can be done on the integration testing, to check that the URL is correct for a given slug (i.e. testing that the rewrite->slug value is working). Can also try adding a filter to the post type / tax, check that the filter exists, and then check the results after registering to see if the filter worked as intended.

The unit test submitted tests a protected method, so it's a little more complicated than usual.

My intention with these tests is as a pre-cursor to switching over the registration aspect to use [Gamajo_Registerable](https://github.com/GaryJones/Gamajo-Registerable) so wanted to have existing tests in place to try and ensure no breakages.