PHPUnit stubs methods that run more than once.

Another day, another PHPUnit revelation. Yesterday some code started returning an internal server error. In true developer fashion, I ran the same process several times and was absolutely staggered to find that the same thing happened every time. No amount of hard refreshing or cache clearing would help. I considered phoning the server hosting company … Continue reading PHPUnit stubs methods that run more than once.

Parsing $_POST variables and arrays with filter_input_array, filter input and FILTER_CALLBACK

Another day, another PHP Codesniffer induced solution to some code that worked fine before, but I just couldn't leave it alone once Codesniffer scolded me. This time it was: Detected access of super global var $_POST, probably needs manual inspection No problem. I've used filter_input before, lets do this. First problem, I'm dealing with an … Continue reading Parsing $_POST variables and arrays with filter_input_array, filter input and FILTER_CALLBACK