While browsing /r/javascript Thursday night, I came across a post regrading a mildly interesting interview question which had to do with flattening a Javascript object to a URI.
Two things immediately jumped into my mind:
I have to show one of my coworkers. This would make a “midly interesting” Python challenge! Friday morning, the first thing I did when I got into work was write the challenge on our white board and my solution in Python....
It seems that Javascript challenges are more frequent at work. Thursday afternoon when we got back from lunch, my coworker was testing himself in the You Can’t Javascript Under Pressure challenges. As great coworkers, we (by that I mean, me) decided to help out and put more pressure on our fellow coworker, without even being asked to! One of the challenges that came up during the test was a function ArraySum() which accepts a list (array) of values and you must total all the integers within the array....
Besides writing test cases just because “everyone else is”, we should be writing test cases since they’ll help create a stronger trust in our code that our functions are doing what they should be doing.
Requirements PHP PHPUnit (you will most likely need a global install) Test Cases (DUH) Helpers Helpers are a set of classes that we create to take care of common mundane tasks. For example, the User Helper for testing provides functions for returning a user with a specified role or easily create a new user with the specified role if one does not exist or the user requests one....