I'm currently doing some modifications on the Wordpress plugin that I created in order to make it testable. The problem is I don't know which methods am I suppose to write tests for. I have methods which uses some of these functions and global variables:
is_singular() $_GET $_POST $_SESSION
is_home and other functions depends on the context. I'm not sure how to fake those context in a test.
I tried passing those as arguments to the methods instead but there are some hooks that doesn't accept additional arguments so I can't really pass them.
Is it OK to just supply those from the test class? I'm really having difficulty modifying the plugin in such a way that I don't use those.
I'm using wordpress-tests and PHP Unit for the unit testing. I've done some research on unit testing before I started and there's a practice that when unit testing global variables should be avoided.