db58b51de3
The "code hacker" is a class that hooks on filesystem events (using stream_wrapper_unregister) in order to allow for dynamically modifying the content of PHP code files while they are loaded. The code hacker class allows registering hacks, which are functions that take source code as input and return the modified code. A hack can be a standalone function or a class with a "hack" method. A few hacks are provided off the shelf. One allows mocking standalone PHP functions (WP, WOO or not), another one allows mocking static methods, and there's the one that removes the "final" qualifier from a class definition. This helps unit testing stuff that would otherwise be quite hard to test. |
||
---|---|---|
.. | ||
bypass-finals-hack.php | ||
code-hack.php | ||
functions-mocker-hack.php | ||
static-mocker-hack.php |