In phpunit what is the difference between __construct versus setup?
问题 I am curious to know it is good practice to create object in test class __construct or we should always use setup/teardown approach ( or setUpBeforeClass/tearDownAfterClass approach)? I aware of the fact set/teardown gets called for each test so will it do any good if I put my objec creation code in it? e.g. //mytestclass.php class MyTestClass extends PHPUnit_Framework_TestCase { private $obj; protected function setUp() { $this->obj = new FooClass(); } public testFooObj() { //assertions for