In that case, I think that keeping the method private and changing its visibility in a test is a better option (you can do it with [reflection](http://php.net/manual/en/book.reflection.php)). I'd say it's better to "hack" in a test (as you called it), rather than open the visibility of a method. The production code, which is there just because it's needed in a test, smells.