0
class A extends B
{
    public function methodA()
    {
    }
}

class B
{
    public function methodB()
    {
    }
}

class TestA extends PHPUnit_Framework_TestCase
{
    public function testmethodA()
    {
    }
}

calling TestA::testmethodA() would be failed, because class A needs B but its not loaded. How to workaround it? Require the class manually? And if I test a more complex class structure?

John Smith
  • 6,129
  • 12
  • 68
  • 123
  • 1
    Why would class B not be loaded? Does the class A definition not already include/require class B itself? Are you using an autoloader? Have you bootstrapped your class autoloader into PHPUnit? – Michael Berkowski Jun 15 '14 at 13:06
  • In other words, please post more details about how you are loading classes to begin with. – Michael Berkowski Jun 15 '14 at 13:07
  • well, if I just run this test, this depends on other class, so it cant run. How to bootstrap my autoloader to PHPunit? – John Smith Jun 15 '14 at 14:16
  • 1
    What kind of autoloader do you use? Typically you include your autoloader in phpunit's bootstrap.php. Refer to the phpunit docs for how to define a bootstrap file – Michael Berkowski Jun 15 '14 at 14:48
  • oh yea, that solved, I didnt know something like this exists :) – John Smith Jun 16 '14 at 07:38

0 Answers0