In my test cases, I have extend my test case class to another base class, where I have used setUp to set the global variables. I have extended this base class to child class where I have written test cases. Now, I have many child test classes which extends this base class. That's why, rather than using setUp in each child class, I have used only in base class.
This is my setup:
Base Class
use PHPUnit\Framework\TestCase; class BaseClass extends TestCase { public static function setUpBeforeClass(){ //global vars setup } public static function tearDownAfterClass(){ //global vars teardown } }Child Class
class ChildClass extends BaseClass { public static function setUpBeforeClass(){ //setup some other stuff related to only this child class parent::setUpBeforeClass(); } public static function tearDownAfterClass(){ //teardown some other stuff related to only this child class parent::tearDownAfterClass(); } }
Now, I want to use PHPUnit's setUpBeforeClass and tearDownAfterClass in my child classes to do some other stuff which is only related to only this child class.
But it is not working. After running tests, PHPUnit stops suddenly without throwing any errors. Kindly guide me here.