mardi 23 février 2016

What are the benefits of using DbUnit when unit testing with PHPUnit?

I'm thinking of using DbUnit with PHPUnit to support my database testing. What are the benefits of using DbUnit in my project over manual fixture setup and assertions? My current way of doing things is (without DbUnit):

public function testSomething() {
    // Create the fixture.
    $u1 = $this->factory->user->create();
    $u2 = $this->factory->user->create();

    // Modify the fixture.
    foo( $u1, $u2, true );

    // Perform a comparison.
    $this->assertEquals( 'some_value', myClass::myMethod( $u1, $u2 ) );
}

Aucun commentaire:

Enregistrer un commentaire