Skip to content


Example 6.2. Setting the Mock Class Loader #55

isidromerayo opened this Issue · 4 comments

3 participants


I add de Phake::setLoader in my bootstrap/testhelper



But phpunit say

PHP Fatal error: Call to undefined method Phake::setLoader()
PHP Stack trace:
PHP 1. {main}() /usr/bin/phpunit:0
PHP 2. PHPUnit_TextUI_Command::main() /usr/bin/phpunit:46
PHP 3. PHPUnit_TextUI_Command->run() /usr/share/php/PHPUnit/TextUI/Command.php:125
PHP 4. PHPUnit_TextUI_Command->handleArguments() /usr/share/php/PHPUnit/TextUI/Command.php:134
PHP 5. PHPUnit_TextUI_Command->handleBootstrap() /usr/share/php/PHPUnit/TextUI/Command.php:615
PHP 6. PHPUnit_Util_Fileloader::checkAndLoad() /usr/share/php/PHPUnit/TextUI/Command.php:862
PHP 7. PHPUnit_Util_Fileloader::load() /usr/share/php/PHPUnit/Util/Fileloader.php:79
PHP 8. include_once() /usr/share/php/PHPUnit/Util/Fileloader.php:95

My enviroment
$ php -v
PHP 5.3.6-13ubuntu3.3 with Suhosin-Patch (cli) (built: Dec 13 2011 18:18:37)
Copyright (c) 1997-2011 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies
with Xdebug v2.1.0, Copyright (c) 2002-2010, by Derick Rethans
with Suhosin v0.9.32.1, Copyright (c) 2007-2010, by SektionEins GmbH

$ phpunit --version
PHPUnit 3.6.8 by Sebastian Bergmann.

$ pear list -c

Installed packages, channel

Package Version State
Phake 1.0.2 stable



Instead of Phake::setLoader() use Phake::setClient().

Where did you get Phake::setLoader in the documentation? I didn't see it there. I just want to make sure if there is bad documentation out there I get it corrected.


@mlively mlively closed this

Ah, I see, I this is different functionality then what I thought you were looking at. That is definitely a documentation error. The rest of the documentation appears to be correct, but the actual example is wrong.

@mlively mlively reopened this

I think you just switched the examples between the pages :

I'll submit a pull request soon.

@mlively mlively closed this in b07ed88
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.