Right now when I setup a new test for my Laravel application, it extends from the base TestCase
class
class SomeTest extends TestCase
{
}
I'd like to create a new base test class named AnotherTestCase
, so I can create test cases that share setup/teardown/helper methods/etc...
class SomeTest extends AnotherTestCase
{
}
However, when I run
phpunit app/tests/SomeTest.php
I get the following error
PHP Fatal error: Class 'AnotherTestCase' not found in /[...]/app/tests/SomeTest.php on line 3
This is despite the fact I have a class defined at
#File: app/tests/AnotherTestCase.php
<?php
class AnotherTestCase extends TestCase
{
}
This is confusing, since phpunit seems to automatically load the TestCase
class.
Do I need to manually require in custom base test classes, or is there a way to tell phpunit about my new base test class? Put another way, why does phpunit automatically load TestCase
, but doesn't automatically load AnotherTestCase