database restore for integration tests with phpunit

638 views Asked by At


I'm using phpunit and I'd like to know if there is a correct form for restoring the database before running integration tests. At the moment I'm calling an sql server script with php exec() on the testcase setUp method, but don't know if this is the best choice

class TestCase extends PHPUnit_FrameWork_TestCase {
    protected function setUp() {
        exec("the restore command line");
    }
}

Is there a more correct form to do that?
Thank you

1

There are 1 answers

3
Sebastian Bergmann On BEST ANSWER

This is what DbUnit is all about. Have you looked at it?