phpunit - Problem generating skeleton test classes [SOLVED]
Posted: Tue Nov 01, 2011 3:34 am
Hello,
I am running into a problem using phpunit to generate test classes for classes that inherit from another class.
For example, if I have the following class :
class cow extends animal{
}
[text]phpunit skeleton-test cow [/text]
will not work.
If the cow class does not extend Animal, then phpunit will generate the test class as expected.
I have spent hours searching the web and numerous people have had similar problems but the solutions posted are not clear.
From what I can gather, there seems to be some issue with autoloading. Some solutions seem to imply that a bootstrap.php file needs to be loaded using phpunit --bootsrap <bootstrap file>
But this file isn't explained properly. I was under the impression that this file needed to contain my __autoload() function and my include path setup using set_include_path(), however this is not working.
My bootstrap.php file ended up looking like this:
Then at the command line I type the following
phpunit --bootstrap bootstrap.php skeleton-test cow
Nothing happens. No file is generated
I'm at a loss.
Help
I am running into a problem using phpunit to generate test classes for classes that inherit from another class.
For example, if I have the following class :
class cow extends animal{
}
[text]phpunit skeleton-test cow [/text]
will not work.
If the cow class does not extend Animal, then phpunit will generate the test class as expected.
I have spent hours searching the web and numerous people have had similar problems but the solutions posted are not clear.
From what I can gather, there seems to be some issue with autoloading. Some solutions seem to imply that a bootstrap.php file needs to be loaded using phpunit --bootsrap <bootstrap file>
But this file isn't explained properly. I was under the impression that this file needed to contain my __autoload() function and my include path setup using set_include_path(), however this is not working.
My bootstrap.php file ended up looking like this:
Code: Select all
<?php
set_include_path( ... a bunch of directories added here ...);
function __autoload($class)
{
require $class . '.php';
}
?>phpunit --bootstrap bootstrap.php skeleton-test cow
Nothing happens. No file is generated
I'm at a loss.
Help