Hi all,

i think this can be VERY usefull in testings for many folks with agavi.
so idea is in Unit testing::setUp method begin a transaction, and in 
tearDown
rollback all changes made by Testing code to DB start state.
So no need to do all database backup / restore by hand..

I would like to hear your opinion about it ;)


class User_ManagerModelTest extends AgaviUnitTestCase {
...
...
    protected function setUp()
    {
        $this->getContext->getDatabaseConnection()->beginTransaction();

        $this->userm = $this->getContext()->getModel('User.Manager');
        $this->user = $this->getContext()->getModel('User.Record');
    }

    protected function tearDown() {
       
        $this->getContext->getDatabaseConnection()->rollback();
    }
...
...
}

_______________________________________________
users mailing list
[email protected]
http://lists.agavi.org/mailman/listinfo/users

Reply via email to