What's Brain Monkey Brain Monkey is a tests utility for PHP. It comes with 2 group of features: the first allow mocking and testing any PHP function. This part is a general tool and 2 times framework agnostic: can be used to test code that uses any frameworks (or no framework) and in combination with any testing framework. the second group of features can be used with any testing framework as well, but is specific to test WordPress code. Who is interested in the first part can use only it, just like this second group of features does not exists. When unit tests are done in the right way, the SUT (System Under Test) must be tested in isolation. Long story short, it means that any external code used in the SUT must be assumed as perfectly working. This is a key concept in unit tests. In PHP, to create mock and stub objects for the scope is a pretty easy task, framework like PHPUnit or phpspec have embedded features to do that, and libraries like Mockery make it even easier. But when external code make use of functions things become harder, because PHP testing framework can't mock or monkey patch functions. This is where Brain Monkey comes into play: its aim is to bring that easiness to
Share This