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()

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()

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.

Laracasts Mascot

Hi, Have We Met Yet?

Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.

Sign Me Up


Reply to

Use Markdown with GitHub-flavored code blocks.