Write simple but expressive functions

Published: Thursday, January 8th, 2015 by Chris Taylor

This is a quick demonstration of the trade-off of readability and efficiency of coding. Currently I have a function that is well written and commented (in my opinion) that looks something like this: public function constructPayLoad(array $template, array $report, $companyId) { //format the payload to contact the service $payLoad = [ ‘objectName’ => $template[‘objectName’], ‘reportName’ […]

How to test internal functions of a class

Published: Monday, January 5th, 2015 by Chris Taylor

Using PHPUnit and partial mocks Let’s say you have a super complicated class that has lots of functions that are used to manipulate data or call a third party class or just does something that is repeated thoughout your class so it’s useful to have it as a seperate function. If you’re using a tool […]