Run PHPUnit Tests in Certain Order

前端 未结 8 1422
悲哀的现实
悲哀的现实 2020-12-04 15:20

Is there a way to get the tests inside of a TestCase to run in a certain order? For example, I want to separate the life cycle of an object from creation to use

8条回答
  •  日久生厌
    2020-12-04 15:40

    The correct answer for this is a proper configuration file for tests. I had the same problem and fixed it by creating testsuite with necessary test files order:

    phpunit.xml:
    
    
        
            
                file1 //this will be run before file2
                file2 //this depends on file1
            
        
    
    

提交回复
热议问题