PHPUnit's setUpBeforeClass not working

Posted 1 year ago by itstrueimryan

I'm setting up some tests and I can't get setUpBeforeClass working:

public function setUpBeforeClass()
{
        parent::setUpBeforeClass();
}

I get Fatal error: Cannot make static method PHPUnit\Framework\TestCase::setUpBeforeClass() non static

However, when I make it static, i.e.:

public static function setUpBeforeClass()
{
        parent::setUpBeforeClass();
}

I get the error ReflectionException: Class config does not exist.

FYI, the setUp method works fine, but I don't want the setup to run before each test method.

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.