You need to say that phpunit uses the test suite so that it runs the tests in the correct order. I assume you are just using phpunit . or something similar to run tests. In this case, PHPUnit loads the tests and runs them in a rather random manner. To use the order you specify, you need to do phpunit --testsuite ModelTest . This tells PHPUnit to use the order specified in the package.
However, it will also run tests listed in XML, so make sure your list is exhaustive.
Also, as stated in the related answer in the comments, if your tests should be run in a specific order, this is not an ideal situation. You should try either to change the design or your tests so that you are not dependent on running them in a certain order.
Schleis
source share